#!/usr/bin/perl # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # Stop people from using subshells to execute commands # Not a big deal when using sendmail, but very important # when using UCB mail (aka mailx). # $value =~ s/~!/ ~!/g; # Uncomment for debugging purposes # print "Setting $name to $value

"; $FORM{$name} = $value; } if ($FORM{'poll'}) { open(POLL,">>../data/poll.txt"); print POLL "$FORM{'poll'}\n"; close(POLL); } $#pollq = 0; $#polla = 0; $total = 0; open(POLL,"../data/poll.txt"); while () { chop; $found = 0; for ($i=0;$i<$#pollq;$i++) { if ($_ eq $pollq[$i]) { $polla[$i]++; $total++; $found = 1; } } if (!$found) { $#polla++; $#pollq++; $polla[$#polla-1] = 1; $pollq[$#pollq-1] = $_; $total++; } } close(POLL); print "Content-type: text/html\n\n"; open(FRM,"../rondvraag_reply.htm"); while () { if ($_ =~ //) { print "

\"Zou u gebruik maken van een systeem via het internet om een afspraak te maken in het Reumacentrum?\"

\n"; print "\n"; for ($i=0;$i<$#polla;$i++) { print "\n"; } print "
$pollq[$i]:\"$polla[$i] ($polla[$i] stemmen)
\n"; } else { print; } } close(FRM);