On Wed, 20 Mar 2002, James Arthur wrote:
> I'm writing a voting script, but I have a problem with it.
> Voters cast their vote by submitting a form. When this form is received
> it is added to the database, and a session variable is set saying that
> they've voted. The problem is that once someone's voted they can just
> press reload on their browser and it sends another vote. This happens in
> Netscape 4.x. All other browsers either do not submit form data or
> recognise that the session variable is set.
How about this:
When they go to the page that provides the voting form, generate a unique
random number and store it in your database. Send that number as a hidden
variable on the voting form.
When the form is submitted, look up the number in the database and store
their vote alongside it.
That way, if they resubmit, it just replaces their earlier vote.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php