#!/local/bin/perl
#
# index.cgi -- write log to visitor.log and cat index.html
# jw, 22.3.98

$log = "visitor.log";
$idx = "index.html.off";
%cgi = split("[=&]", $ENV{"QUERY_STRING"});

print "Connection: close\n";
print "Content-Type: text/html\n\n";

chop($today = qx{ date });
if (!open(LOG, ">>$log")) { print "cannot open log file $log\n"; exit 0; }
print LOG "$today\t $ENV{'REMOTE_ADDR'} $ENV{'PATH_INFO'}\t $ENV{'HTTP_USER_AGENT'}\r\n";
close(LOG);

if (!open(IDX, "$idx")) { print "cannot open file $idx\n"; exit 0; }
while (<IDX>) { print; }
close(IDX);
