[PHP] Problem with posting

2002-03-20 Thread James Arthur

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.

Any ideas on how to fix this? Thanks.

--jaa

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Problem with posting

2002-03-20 Thread Rick Emery

What do you mean All other browsers either do not submit form data?

show your code.  

What kind of user authentication are you using?  If none, they'll vote and
vote often.


-Original Message-
From: James Arthur [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 20, 2002 1:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Problem with posting


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.

Any ideas on how to fix this? Thanks.

--jaa

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Problem with posting

2002-03-20 Thread Miguel Cruz

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.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Problem with posting

2002-03-20 Thread James Arthur

On Wednesday 20 Mar 2002 19:40, Rick Emery wrote:
 What do you mean All other browsers either do not submit form data?

I mean when the user hits 'reload' the POST data is not resubmitted. Some 
browsers do not resubmit form data, some do, and some prompt.

 What kind of user authentication are you using?  If none, they'll vote and
 vote often.

A session variable is used to store who has voted and who has not. Netscape 
and Mozilla seem to eschew this somehow. Not sure how. In IE it works fine, 
even when you choose to resubmit the form data.

Hit http://wired.st-and.ac.uk/ to see what happens.

--jaa

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php