re: Example needed

From: Date: Tue, 01 Aug 2000 21:55:20 +0000
Subject: re: Example needed
Groups: php.general 
Request: Send a blank email to php-general+get-9572@lists.php.net to get a copy of this message
>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? It's easy with if you use sessions: session_start(); session_register("LastPostTime"); if ((time() - $LastPostTime) < 30) { echo "Please wait; we're still processing the last one."; } else { $LastPostingTime = time(); echo "Posted"; } This has the advantage of being impossible for the user to break as long as you control session creation (e.g. requiring users to login first). It'll also work if they have JavaScript or even cookie support disabled.

« previous php.general (#9572) next »