Re: Example needed

From: Date: Tue, 01 Aug 2000 23:06:09 +0000
Subject: Re: Example needed
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-9634@lists.php.net to get a copy of this message
Hello Chris, On 01-Aug-00 16:33:18, you wrote: >Does someone have a quick example on how to prevent multiple submits from a >form? Say, a 30 sec delay until the same person can submit the same form >again? Well if you just want to prevent repeated submission of forms inadvertedly you may want to use this forms generation class. It has an option that lets you specify a message that will show in a confirmation alert box asking the user if he really means to submit the form again, if the form was really already submitted from the same page. This requires a Javascript enable browse but most forms are these days. http://phpclasses.UpperDesign.com/browse.html/package/1 If you really want to prevent all sorts of resubmission (including faked form submissions) you may want to use the technique above in conjunction with another that uses a secret key an a hidden field. The secret key a text sequence generated from unique value ( md5(uniqid("something")) ) that you keep in some persistent storage (database table) on the server. When the user submits the form the first time you check the hidden field value against the list of stored keys. If the key exists delete it to prevent it to be recognized as valid again and process your form normally. If the key is not found, ignore the form submission and present the form again using a newly generated key. Regards, Manuel Lemos Web Programming Components using PHP Classes. Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org -- E-mail: mlemos@acm.org URL: http://www.mlemos.e-na.net/ PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp --

« previous php.general (#9634) next »