#!/usr/bin/perl use CGI; require "BrunchingHTML.pl"; setup_brunching_vars( "author" => "fs", "section" => "toys", "cat1" => "politics", "title" => "Am I President or Not?", "s_title" => "amipresidentornot", ); $q = new CGI; $datafile = "amipresidentornot.txt"; $last = $q->param("last"); $vote = $q->param("vote"); if ($vote) { exit unless $vote =~ /^\d+$/; exit unless ($vote > 0); exit unless ($vote < 11); } open(DATAFILE,"+>>$datafile"); flock(DATAFILE,2); seek DATAFILE, 0, 0; while () { chomp; ($pres,$tmpvotes,$tmpscore) = split(/:/,$_); push(@candidates,$pres); $votes{$pres} = $tmpvotes; $score{$pres} = $tmpscore; if ($foundlast) { $foundlast = 0; $current = $pres; } if ($pres eq $last) { $foundlast++; $current = "BROWNE"; } } $num = rand(@candidates); $current = $q->param("key") unless $current; $current = "$candidates[$num]" unless $current; $current = "GORE" unless $votes{$current}; if ($votes{$last} && $ENV{REMOTE_ADDR} ne "64.28.67.20") { $score{$last} += $vote; $votes{$last}++; $average{$last} = sprintf("%.1f",($score{$last}/$votes{$last})); } seek DATAFILE, 0, 0; truncate DATAFILE, 0; foreach $candidate ("BROWNE","BUCHANAN","BUSH","GORE","HAGELIN","NADER","PHILLIPS","RATHER") { $votes{$candidate} = 10 unless $votes{$candidate}; $score{$candidate} = 50 unless $score{$candidate}; print DATAFILE "$candidate:$votes{$candidate}:$score{$candidate}\n"; } close(DATAFILE); $inset = < What others thought $average{$last} Based on $votes{$last} votes You rated him: $vote EOFILE $votepane = < Tell me... am I PRESIDENT or NOT ? $inset 1 2 3 4 5 6 7 8 9 10 Show me: MenThat's about it You can share this picture with a friend or judge: http://www.brunching.com/cgi/amipresidentornot.cgi?key=$current Click here if the above image is broken, unviewable, baffling, or inappropriate (ads, porn, ads for porn, pets, ads for pets, ads for porn for your pets, Walter Mondale, etc.) How presidential are YOU? Raise several million dollars and find out! Have questions or suggestions? Huh. © 2000 The Brunching Shuttlecocks email: lfitzgerald\@brunching.com EOFILE print &brunching_header; print <
What others thought $average{$last} Based on $votes{$last} votes You rated him: $vote
Tell me... am I PRESIDENT or NOT ?
1 2 3 4 5 6 7 8 9 10
Show me: MenThat's about it
You can share this picture with a friend or judge: http://www.brunching.com/cgi/amipresidentornot.cgi?key=$current
Click here if the above image is broken, unviewable, baffling, or inappropriate (ads, porn, ads for porn, pets, ads for pets, ads for porn for your pets, Walter Mondale, etc.)
How presidential are YOU? Raise several million dollars and find out!
Have questions or suggestions? Huh.
© 2000 The Brunching Shuttlecocks email: lfitzgerald\@brunching.com