Re: Dealing with multiple form submissions

From: Date: Thu, 25 Aug 2011 01:53:22 +0000
Subject: Re: Dealing with multiple form submissions
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-314601@lists.php.net to get a copy of this message
On Aug 24, 2011, at 3:46 PM, Ashley Sheridan <ash@ashleysheridan.co.uk> wrote: > > > Mike Mackintosh <mike.mackintosh@angrystatic.com> wrote: > >> >> >> On Aug 24, 2011, at 11:52, John Black <spam@network-technologies.org> >> wrote: >> >>> On 08/24/2011 03:04 AM, Jason Pruim wrote: >>>> Wondering what everyone does to prevent multiple form submissions? >>>> My form is simply getting emailed to my email, and it redirects to a >> success page when submitted... >>>> Would it be as simple as doing something with the cache control? >> Basically I'm trying to avoid someone submitting a form... Then hitting >> back, and submitting again, then hitting back.... I think you get the >> idea... >>>> What do you all do? >>>> Jason Pruim >>> >>> >>> Hi, >>> I am using $_SESSION for this. Set a value on the initial page, a >> timestamp is a good choice, then validate the value on the receiving >> script and clear the value. >>> >>> I like to use a timestamp because it will allow you to deny a comment >> which took too long to submit. >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> >> I've always tended to stay away from session for that, as when the >> browser closes/restarts, the page is accessible again. >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php > > I solved this issue with timestamps stored in the db with the submission. With each submission, > I took all the info that should make it uniqueish, and checked if it was near another one. A time > limit of 10th seconds worked out well. The reason I had the problem was because we were triggering a > counter on an account from get data (which the browser can request in a way that looks like multiple > submissions). We should have used post, which didn't have this problem though really. > > Will you please show an example of using this timestamp methodology? Thank you >

« previous php.general (#314601) next »