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.
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)
- 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
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.
- 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.
ex: $Totalvotes = 200
$JDvotes = 100
$BDvotes = 38
$BSvotes = 40
and create a bar graph using the number
of votes for each one as the table width.
Click here to see the actual result
<td width = $JDbarwidth bgcolor=Blue>
ex: John Doe ||||||||||| 50%
Jane Doe ||| 11%
Ben Dover |||| 19%
Bart Simpson ||||| 20%
- Consist of data saved via CGI's append to file.
Each line appended/saved is the Voters selection, IP address of voter,date/time stamp per line. (\n)
Thanks in advance for any help you can provide.
Rich AKA Just4Kix
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)