#!/usr/local/bin/perl -w # CS2734submit.cgi # Get submission of webpage and preferred email address. use strict; use CGI qw( :standard ); use Fcntl qw( :flock ); # main parameters for the program my $infile = "CS2734classweb.html"; my $outfile = "CS2734classweb2.html"; my $passwd = "password"; my $course = "CS 2734"; my $bookimage = "http://www.cs.utsa.edu/~wagner/CS2734/patterson.gif"; my $name = param("name"); my $email = param("email"); my $webpage = param("webpage"); my $password = param("password"); my $line; my $entered; my $oldname; my $sec; my $min; my $hour; my $mday; my $mon; my $year; print header(), start_html('Submit E-mail Address and Webpage'); print "
"; print ""; print "Directions:
"; print start_form(); print "
| Your name in the form: \"Last, First\" "; print " | "; print textfield("name"); print " | (required) |
| Your preferred e-mail address "; print " | "; print textfield("email"); print " | (this or the next required) |
| The URL of your webpage "; print " | "; print textfield("webpage"); print " | (this or the previous required) |
| The password (now it is: \"password\") "; print " | "; print textfield("password"); print " | (required) |
| Push the submit button "; print " | "; print submit("Submit entry"); print " | (required) |
"; print "
"; } elsif ($name eq "" && ($email ne "" || $webpage ne "" || $password ne "")) { print "
"; } elsif ($password eq $passwd) { print "
"; print ("
") if $name; print ("
") if $email; print ("
") if $webpage;
# now start copying and searching ...
open(INFILE, "/home/wagner/public_html/cgi-bin/".$infile) ||
die "Unable to open file for input: $!";
$line = \n";
$line = \n";
# here replacing; DO NOT copy $_ to OUTFILE
$entered = 1;
} # otherwise empty webpage and email, so delete
else {
print p( b(' \n";
$entered = 1;
}
#else {
# print p( b(' \n";
}
else {
print p( b('
Webpage: ";
print OUTFILE $webpage;
print OUTFILE "
Email: ";
print OUTFILE $email;
print OUTFILE "
Webpage: ";
print OUTFILE $webpage;
print OUTFILE "
Email: ";
print OUTFILE $email;
print OUTFILE "
Webpage: ";
print OUTFILE $webpage;
print OUTFILE "
Email: ";
print OUTFILE $email;
print OUTFILE "
Webpage: ";
print OUTFILE $webpage;
print OUTFILE "
Email: ";
print OUTFILE $email;
print OUTFILE "
Revision date: ";
# print date and time in international form
($sec,$min,$hour,$mday,$mon,$year) = localtime(time);
print OUTFILE $year+1900;
print OUTFILE "-";
if ($mon < 9) {print OUTFILE ("0".($mon+1));}
else {print OUTFILE ($mon+1);}
print OUTFILE "-";
if ($mday < 10) {print OUTFILE ("0".($mday));}
else {print OUTFILE ($mday);}
print OUTFILE " ";
if ($hour < 10) {print OUTFILE ("0".($hour));}
else {print OUTFILE ($hour);}
print OUTFILE ":";
if ($min < 10) {print OUTFILE ("0".($min));}
else {print OUTFILE ($min);}
print OUTFILE ":";
if ($sec < 10) {print OUTFILE ("0".($sec));}
else {print OUTFILE ($sec);}
# print OUTFILE scalar(localtime());
print OUTFILE ".";
print OUTFILE " (Please use ISO8601, ";
print OUTFILE "the International Standard.)";
print OUTFILE "