#! /usr/bin/perl ######################################################### # # # Voting Center Version: 1.0C (Beta) # # Last Modified: 10-05-97 # # Written By: David Tsai # # http://www.web-consult.com # # # ######################################################### # # # Copyright © 1997 David Tsai, Web Consultant. # # Permission to use this script granted. This script # # shall not be redistributed in anyway without the # # written consent of David Tsai. This script shall # # not be modified in any way without the written # # consent of David Tsai, although you may modify # # the variables in the config.cgi # # # ######################################################### require 'config.cgi'; &check_exp; &parse_query; #============================================= # M A I N P R O G R A M if($QUERY{'action'} eq "") { print "Content-Type: text/html\n\n"; print "\n"; print "
| List of current topics: (Click on a topic to view the results and to vote) |
| $question  \; \;- \; \; Expires: $exp |
| Previous Topics: (Click on a topic to view the results) |
| $question |
\n";
}
else {
&error("The specified command entered into the query string was not found.
This may be caused by a script misconifguration or a bug in the CGI script.
This may also be caused because by the user.");
}
#===========================================
# S U B R O U T I N E S
sub check {
local($flag) = @_;
if($check >= 1 && $check ne '2') {
$hostname = $ENV{'REMOTE_HOST'};
if ($ENV{'REMOTE_HOST'} && ($ENV{'REMOTE_HOST'} !~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/)) {
$hostname = $ENV{'REMOTE_HOST'};
}
else {
&address_to_name ($ENV{'REMOTE_ADDR'});
}
$ip_file = "$base_dir/$topic\.ip";
open(FILE, "$ip_file") || die "Can't open $ip_file\n";
@lines =