Limit voter to only 1 vote on OnlinePolling system using cookies
Limit voter to 1 vote only on OnlinePoll using cookies
I've created an online polling system, using a simple radio button Form with a get method of "Post" The voter simply makes their selection, then clicks on SUBMIT.
My problem is some visitors click on the BACK button and make multiple votes. I've been able to track the users IP Address,Remote Host name and time/date stamp via CGI script. So I can tell pretty much who are the flying voters. So I just delete the excess votes, but that can be a hassle if they vote abt 50 times. Is there a way to use cookies to store the voters selection and prevent them from using my Poll.html to vote over and over again?
I took a crash course in CGI so I'm fairly new at this. Anyway, my polling system consists of 4 files:
1) Poll.html (the actual form)
2) Poll.cgi
When a user clicks on the SUBMIT button from Poll.html, this CGI is then called.
If user made a selection then this CGI prints out a message, "Thank you for your vote,you voted for 'John Doe' for Instructor of the year!" Click here to view current Poll results. The selection is then appended to a text file called votes.txt via the
Code:
open (FILE, ">> votes.txt");
print FILE, "$Instructor\n";
If user didn't make a selection, an error
message is displayed asking user to
return to Poll.html by clicking on
BACK button and make a vote.
3) Poll_results.cgi
This tallies all the votes for each nominee.
This is not actual code... I actually used an array for each and used a foreach loop in my script, this example is for the purpose of demonstrating how I computed the barwidth.
Bookmarks