#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
#!/usr/bin/perl
####################################################
#
# Quick Poll
# Version 3.1
# (C) 1999-2000 Taro Sato, All rights reserved.
# See README.TXT for important information.
#
####################################################
##############################
#
# Main routine ---------------
#
##############################
require 'qpoll31.conf';
require 'qpshared31.lib';
$scriptpath = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($urlquery{$key}) {
$urlquery{$key} .= ", $value";
} else {
$urlquery{$key} = $value;
}
}
$action = $urlquery{'action'};
$pollid = "1" . ("0" x (6-length($urlquery{'poll_id'}))) . $urlquery{'poll_id'};
$pollid = substr($pollid, 1, 6);
if (($urlquery{'poll_id'} ne "all") && not (-e "$datafile.$pollid.dat")) {
print "Content-type: text/html\n\n";
&Error("Invalid poll ID", "The specified poll ID is not valid. The associated poll data does not exist.");
} elsif ($urlquery{'poll_id'} eq "all") {
$pollid = "all";
}
$pollCookie = "poll_id$pollid";
if ($action eq "view") {
if ($pollid eq "all") {
&ViewAll();
} else {
&PutResults($pollid);
}
} elsif ($action eq "replace") {
if ($pollid eq "all") {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The action \"replace\" cannot be used with the poll ID.");
}
if ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
&PutResults($pollid);
} else {
&PutForm($pollid);
}
} elsif ($action eq "process") {
&ProcessVote($pollid);
} elsif ($action =~ m/http:\/\/*/) {
&PutForm($pollid);
} else {
print "Content-type: text/html\n\n";
&Error("Invalid query", "The given query is not valid. See README for more info.");
}
exit;
##############################
#
# Subroutines ----------------
#
##############################
sub ProcessVote {
$pollid = $_[0];
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
&ParsePairs(@pairs);
if ($formdata{'choice'} eq "") {
print "Content-type: text/html\n\n";
&Error("No selection was made", "Please make your selection before voting.");
} elsif ($ENV{'HTTP_COOKIE'} =~ m/cookie=set/) {
&ReadPollData($pollid);
for ($i = 0; $i < @choices/3; $i ++) {
$choiceID = "C"."$i"."C";
unless ($ENV{'HTTP_COOKIE'} =~ m/$pollCookie/) {
if ($formdata{'choice'} =~ m/$choiceID/) {
$choices[$i*3+2]++;
}
}
}
&WritePollData($pollid);
&SetPollCookie($pollid, $expiredate);
if ($formdata{'action'} eq "replace") {
print "Location: $ENV{'HTTP_REFERER'}\n\n";
} else {
print "Location: $formdata{'action'}\n\n";
}
} else {
print "Content-type: text/html\n\n";
&Error("Cookies disabled", "Please configure your browser to accept cookies.");
}
}
sub PutForm {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
$submit_reset = "submit";
print "";
print "";
}
sub PutResults {
$pollid = $_[0];
&ReadPollData($pollid);
print "Content-type: text/html\n\n";
$num = @choices;
&PutResultsTable();
}
sub ViewAll {
opendir (DATADIR, "$datadirectory") || &NoDirectory($datadirectory);
@files = readdir (DATADIR);
closedir (DATADIR);
@files = sort{$b cmp $a} (@files);
print "Content-type: text/html\n\n";
print " "; } } $now = gmtime(time); print < $now GMT Generated by Quick Poll ver. $qpversion
|
|
Pro-Choice Art budget regulator
is a pavu.com service