[PHP] Avoiding Repeat Posts
Hi all, It seems that there might be some basic solution on this that I never received a memo on... Basically, I'm looking for a way to avoid repeat posts. If someone, for example, adds something to a bulletin board, clicks submit, and then presses F5, they're just 1 click away from re-submitting the form and posting the same information for a second time. Is there an easy way to avoid this? I've thought about using a "unique visit id" or something which gets triggered when a visitor posts, but that seems like a lot to do... Also, do you think I should look into redirecting the user once they've posted so they can't go back? I just don't know where to begin...any input is greatly appreciated. Thanks! Lewis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding Repeat Posts
on 04/01/03 7:26 PM, OrangeHairedBoy ([EMAIL PROTECTED]) wrote: > Hi all, > > It seems that there might be some basic solution on this that I never > received a memo on... it's been mentioned MANY times on the list in the last week :) > Basically, I'm looking for a way to avoid repeat posts. If someone, for > example, adds something to a bulletin board, clicks submit, and then presses > F5, they're just 1 click away from re-submitting the form and posting the > same information for a second time. Is there an easy way to avoid this? when "generating" the form, include a hidden field which has a unique, random value. then the script that recieves/validated the post should check that the value doesn't already exist in the database before inserting... the only way someone can double-post is by actually refreshing the form (thus getting a new hidden field. > I've thought about using a "unique visit id" or something which gets > triggered when a visitor posts, but that seems like a lot to do... > > Also, do you think I should look into redirecting the user once they've > posted so they can't go back? they can still go "back" after a redirect... it's just pages in the browser cache... Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding Repeat Posts
I did searches on this one...I'm using NNTP so it's nice...unfortunatly, no one had quite the same problem. I had thought about the random value already (see paragraph about unique visit id), but it just seems like so much to keep track of... After asking on other board on the same topic, one theme seems to be the same...just use redirects. If anyone else is having the same issue, you can do a redirect using the PHP header() function to send the user directly to the next page. If the user goes back, they will get a new version of the form, and less browsers will support resubmitting. Also, on the same note, if anyone is using buttons as links, make sure you are using an http://whatever'"> command instead of submitting a form with no fields. This will solve the problem here. Lewis "Justin French" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > on 04/01/03 7:26 PM, OrangeHairedBoy ([EMAIL PROTECTED]) wrote: > > > Hi all, > > > > It seems that there might be some basic solution on this that I never > > received a memo on... > > it's been mentioned MANY times on the list in the last week :) > > > Basically, I'm looking for a way to avoid repeat posts. If someone, for > > example, adds something to a bulletin board, clicks submit, and then presses > > F5, they're just 1 click away from re-submitting the form and posting the > > same information for a second time. Is there an easy way to avoid this? > > when "generating" the form, include a hidden field which has a unique, > random value. > > then the script that recieves/validated the post should check that the value > doesn't already exist in the database before inserting... the only way > someone can double-post is by actually refreshing the form (thus getting a > new hidden field. > > > > I've thought about using a "unique visit id" or something which gets > > triggered when a visitor posts, but that seems like a lot to do... > > > > Also, do you think I should look into redirecting the user once they've > > posted so they can't go back? > > they can still go "back" after a redirect... it's just pages in the browser > cache... > > > Justin French > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding Repeat Posts
Actually, there is a different solution to this aswell. One that is used by phpBB and XMB, and maybe some others aswell. Basicly, it's an anti-flood system. It works like this: - You are a member and logged in You post, and the post gets inserted into the database, and with it, also the time of posting is kept. When you post the next thing, the script checks if there was a message posted, by that user in the last X seconds (can be set manually). If so, it will return a message saying not to repost stuff. Otherwise, it just continues... Hope this helps, - Tularis XMB Lead Developer Orangehairedboy wrote: I did searches on this one...I'm using NNTP so it's nice...unfortunatly, no one had quite the same problem. I had thought about the random value already (see paragraph about unique visit id), but it just seems like so much to keep track of... After asking on other board on the same topic, one theme seems to be the same...just use redirects. If anyone else is having the same issue, you can do a redirect using the PHP header() function to send the user directly to the next page. If the user goes back, they will get a new version of the form, and less browsers will support resubmitting. Also, on the same note, if anyone is using buttons as links, make sure you are using an http://whatever'"> command instead of submitting a form with no fields. This will solve the problem here. Lewis "Justin French" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... on 04/01/03 7:26 PM, OrangeHairedBoy ([EMAIL PROTECTED]) wrote: Hi all, It seems that there might be some basic solution on this that I never received a memo on... it's been mentioned MANY times on the list in the last week :) Basically, I'm looking for a way to avoid repeat posts. If someone, for example, adds something to a bulletin board, clicks submit, and then presses F5, they're just 1 click away from re-submitting the form and posting the same information for a second time. Is there an easy way to avoid this? when "generating" the form, include a hidden field which has a unique, random value. then the script that recieves/validated the post should check that the value doesn't already exist in the database before inserting... the only way someone can double-post is by actually refreshing the form (thus getting a new hidden field. I've thought about using a "unique visit id" or something which gets triggered when a visitor posts, but that seems like a lot to do... Also, do you think I should look into redirecting the user once they've posted so they can't go back? they can still go "back" after a redirect... it's just pages in the browser cache... Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding Repeat Posts
Why not create a unique constraint with the userid, day (without time) and post content. Is it going in a DB? Mike *** REPLY SEPARATOR *** On 04/01/2003 at 3:26 AM OrangeHairedBoy wrote: >Hi all, > >It seems that there might be some basic solution on this that I never >received a memo on... > >Basically, I'm looking for a way to avoid repeat posts. If someone, for >example, adds something to a bulletin board, clicks submit, and then >presses >F5, they're just 1 click away from re-submitting the form and posting the >same information for a second time. Is there an easy way to avoid this? > >I've thought about using a "unique visit id" or something which gets >triggered when a visitor posts, but that seems like a lot to do... > >Also, do you think I should look into redirecting the user once they've >posted so they can't go back? > >I just don't know where to begin...any input is greatly appreciated. > >Thanks! > >Lewis > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding Repeat Posts
How about saving a timestamp when the user posts a message and when he posts another message check whether the user already posted a message in the past, let's say, minute. I saw this used in a lot of forums... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding Repeat Posts
Michael J. Pawlowsky wrote: Why not create a unique constraint with the userid, day (without time) and post content. Is it going in a DB? Index on text columns does not seem very efficient, IMHO. If he wants to avoid multiple inserts, the random unique ID is enough. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php