#!/usr/local/bin/perl if ($ENV{'REQUEST_METHOD'} eq 'POST') { # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); # Load the FORM variables foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } } print "Content-type: text/html\n\n"; if(-e "poll.dat") { open(POLL, "poll.dat"); } while() { push(@poll, $_); } close(POLL); @lines = ("1"); foreach $each_line (@lines) { $this_line = "line" . $each_line; $$this_line = $poll[$each_line-1]; chop($$this_line); } if($line1 eq " ") { $line1 = "0\t0\t0"; } @line1_answers = split(/\t/, $line1); if($FORM{'QUESTION'} eq "yes") { $line1_answers[0]++; } elsif($FORM{'QUESTION'} eq "no") { $line1_answers[1]++; } elsif($FORM{'QUESTION'} eq "maybe") { $line1_answers[2]++; } open(POLL, ">poll.dat"); print POLL "$line1_answers[0]\t$line1_answers[1]\t$line1_answers[2]\n"; close(POLL); print "\n"; print "\n"; print "POLL RESULTS\n"; print "\n"; print "
Make your own free website on Tripod.com
\n"; print "

Poll Results

\n"; print "

Would You Go To The North Poll?


\n"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
"; print "Yes: "; print ""; print $line1_answers[0]; print ""; print $line1_answers[0] / ($line1_answers[0] + $line1_answers[1] + $line1_answers[2])*100; print "%"; print "
"; print "No: "; print ""; print $line1_answers[1]; print ""; print $line1_answers[1] / ($line1_answers[0] + $line1_answers[1] + $line1_answers[2])*100; print "%"; print "
"; print "Maybe: "; print ""; print $line1_answers[2]; print ""; print $line1_answers[2] / ($line1_answers[0] + $line1_answers[1] + $line1_answers[2])*100; print "%"; print "
"; print "Total Number of Answers: "; print $line1_answers[0] + $line1_answers[1] + $line1_answers[2]; print "
"; print "

This poll script copyright 2004, Json T. Asuncion" print "\n"; print "\n";