Re: Dealing with multiple form submissions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Mike Mackintosh <mike.mackintosh@xxxxxxxxxxxxxxx> wrote:

>
>
>On Aug 24, 2011, at 11:52, John Black <spam@xxxxxxxxxxxxxxxxxxxxxxxx>
>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.

Thanks,
Ash
http://www.ashleysheridan.co.uk
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux