On 2002. szeptember 17. 15:52, Resarch and Development wrote:
> What is the best way to avoid the "repeated comment/post" syndrome
> caused by the user clicking the submit button one too many times
> because he/she did not wait for the browser to return a confirmation
> page or the script took too long to execute.
The best way i think is not the 'redirecting to success page'
solsution. It may be flooded with back button.
It's easy solution to add a unique id to
every generated form in a hidden field. Unique
id may be generated with uniqid() function
or with apaches UNIQUE_ID envireoment variable, if
mod_unique_id compiled. Check $_SERVER['UNIQUE_ID'];
Before storing data you can check the presence og
that id somewhere (separate used-id storing table, or
in an additional field in your target table).
If check shows that ID was used, do nothing with data,
if that check is negative, store the data.
I prefer separate dup-store table, with an expire_date
field. Expiration time may be from half our to a week.
You can purge old ID-s from cron daily or more frequently.
I have an oop class named dupkiller to handle that
problem, if you interested.
Heilig (Cece) Szabolcs
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php