Re: Example of mail()

From: Date: Sun, 30 Apr 2006 16:34:13 +0000
Subject: Re: Example of mail()
Groups: php.db 
Request: Send a blank email to php-db+get-41783@lists.php.net to get a copy of this message
Hi, Why not use cookies to check if the user has pressed F5 or refreshed the page? There is a number of ways to do this, all should work effectively depending on your how many people hit the page etc. a) Store the message in a cookie, and run PHP code to check before executing the mail() function. If the message matches after a refresh than don't execute the mail() function. You could display the message again in the box or setup a error reporting message saying you cannot refresh the page or send the same message twice. b) Everytime the page is loaded (whatever.php) from a weblink or something have a hidden field like id=rand() ... Use a random generator to randomly uissue lets say a 12 char legnth. So if the user refreshes the hidden field would be the same hence no mail() execution. However if the page is loaded from a weblink the php issues a new code. c) I did have a c.. but forgot. Look up the following on google "checksum or chksum" Anyways. There is more ways but it's time for me to hit the sack(). :P J

« previous php.db (#41783) next »