Re: Example of mail()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
  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

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux