RE: [PEAR] QuickForm - Preventing multiple user submissions?

From: Date: Tue, 08 Jul 2003 16:00:03 +0000
Subject: RE: [PEAR] QuickForm - Preventing multiple user submissions?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-6531@lists.php.net to get a copy of this message
Arnaud - Thanks. This sounds much more robust than JavaScript. Graham
Graham Clarke wrote:
Hi - anyone have a simple solution to make sure users can
only submit a
form once? Something to disable the submit after it is clicked.
only disabling the submit button wont do i guess. since you can still reload the page (CTRL+R in mozilla) and submit the same data again. What would make sense might be adding an additional hidden field to the form, which carries a unique identifier (kind of a session-ID, with the lifetime until the form was processed). and the form class (QF?) knows that when this identifier's 'process()' method had been called once it wont be called again. Therefore this unique identifier needs to be created upon the first visit of the form page, every time. Is this a feature which should/will go in QuickForm? I use Horde Token Class for that. Use is quite simple: on page 1, a form which calls page 2 $token = &Token::factory('file', array('timeout' => 360)); $id = $token->generateID(); input hidden value="$id" on page 2 $token = &Token::factory('file', array('timeout' => 360)); if ($token->verify($id)) { echo 'form processing'; } else { echo 'form was already processed'; } It does what wolfram is talking about. You generate an identifier for the form. You put it in hidden element, then on submission the page which process the form checks that the identifier hasn't been used. Arnaud.
Graham Clarke GrahamC@53Tech.com www.53Tech.com 603.643.9955

« previous php.pear.general (#6531) next »