[eluser]Pygon[/eluser]
[quote author="elitemedia" date="1193763922"]This is what I would do:
- Each form load generate a random ID
- Each submited form put this form ID in a DB field (was suggested by Xwero in #5)
Then you can do something like:
if (form ID exists in the DB)
{
Show error form already submited
}
else
{
Process the form
}[/quote]
If you generate a random number every time the form loads, when the form is submitted again it will always have a different number (until you generate a random number that has been used previously). md5(microtime()) could avoid that, but again, new number for every form.
I'm not quite sure why you aren't just checking the DB to verify that the same information hasn't already been submitted.
For example, if you require an email, query the database for that email -- if it exists, that user has already submitted the form, if not, add it to the database.
There are always down sides to ways of limiting forms, for example:
Session variable to prevent re-submit.
- Is removed once browser is closed (they can return and resubmit).
Cookie to prevent re-submit
- Cookies can be off or removed.
Limit by IP Address
- Multiple users behind a router (companies or home) share same IP. Dial-up or semi-static ips can be re-assigned to a user who has not submitted the form.
The best way is going to be to require some sort of personally identifiable information (email), ofcourse this can be spoofed.
All in all, there is no fool-proof way. There is the same problem in trying to get accurate user statistics.