Conversion tables A-K
  Conversion tables L-Z
  SPAM database query
  Reverse WHOIS utility
  North America area codes
  PHP Example forums

PHP example repository.

Back to examples
Stopping multiple form posts of same data in PHP

If you have a user form and you want to stop multiple submissions of the same data by the same user ( especially if they have hit refresh and ignored the repost warnings ), you can using cookies and md5 to check for duplicates.

The script checks all variable in the $HTTP_POST_ARRAY and makes 1 long string containing all the data values. It then generates a MD5 hash of the string which should uniquely identify the data. This hash is then stored in a cookie ( or session if you whish ). The next time the form process is called it check the hash of the data against the one that was last stored. If they are the same we have duplicate data!

In the top of the destination page from your forms submission include the following, and process according to the results.




$long ""
$hash md5($long); 


// This is new data - do what you want 


// This is repeat data - boooo.