RE: [PHP] Preventing double-clicks APPEARS TO WORK FINE
| From: | Jay Blanchard | Date: | Mon, 26 Jun 2006 18:05:27 +0000 |
| Subject: | RE: [PHP] Preventing double-clicks APPEARS TO WORK FINE | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-238646@lists.php.net to get a copy of this message | ||
[snip]
I am going to do some thinking (typing) out loud here because I need to
come up with a solution to double-clicking on a form button issue.
[/snip]
Because the data is contained in session variables this became an easy
issue once I logiced it out
/*
* we have to find out if a double click occurred but we are going to
allow for a much longer time interval
* of 30 minutes in order to make sure that the ESN can be provisioned
again, just not today.
*/
$getESNDate = "SELECT
ezESN FROM test.provision
";
$getESNDate .= "WHERE updated BETWEEN DATE_SUB(NOW(), INTERVAL 1800
SECOND) AND DATE_SUB(NOW(), INTERVAL 1 SECOND) ";
$getESNDate .= "AND ezESN = '".$_POST['psESN']."'
";
if(!($dbESNDate = mysql_query($getESNDate, $udc))){
echo mysql_error();
exit();
}
/* does it test positive for ESN within the past few minutes? */
if(0 != mysql_num_rows($dbESNDate)){
/* the session data is already set, so go to activation receipt
*/
header("Location: ezActivationReceipt.php");
exit();
} else {
/* process normally */
/* lines and lines of code */
}