#!/usr/bin/perl
# This is the absolute pathname of the email log.
$guestbook="/bechtel/facstaff/znidarci/cgi-bin/downloadlog.html";
# That is the path to PERL just above It MUST be first in the script
# The following accepts the data from the form
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
# The following code posts the log entry
open (GUESTBOOK,"<< $guestbook");
$currenttime=localtime;
# Put the new log entry in.
print GUESTBOOK "$currenttime from $ENV{'REMOTE_HOST'} \n";
print GUESTBOOK "$FORM{program}<\FONT>";
print GUESTBOOK "$FORM{email} ";
close (GUESTBOOK);
&thank_you;
}
#The following creates the Thank You page display
sub thank_you {
print "Content-type: text/html\n\n";
print "\n";
print "\n";
print "Download $FORM{program}\n";
print "
print "\n";
print "\n";
print "Download Now\n";
print "\n";
print "Download $FORM{program}\n";
print "\n";
print "\n";
exit(0);
}