#!/opt/SOLHperl5/bin/perl #pf.pl #This program appends, displays or clears the preflight response file #================================================================================= # #GET DATE FOR SERVER TIMESTAMP $thisday = (Sun,Mon,Tue,Wed,Thur,Fri,Sat)[(localtime)[6]]; $month = (Jan,Feb,Mar,Arp,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[(localtime)[4]]; ($sec,$min,$hour,$mday,$mon,$year,$wday, $yday,$isdst) = localtime(time); $date = $thisday."\, ".$month." ".$mday." 19".$year." ".$hour.":".$min.":".$sec; #================================================================================= # #GET INPUT read(STDIN, $buffer, $ENV{CONTENT_LENGTH}); @inpair = split(/&/,$buffer); foreach $pair(@inpair){ ($name,$val) = split(/=/,$pair); $val =~ tr/+/ /; $val =~ s/%([a-fA-f0-9][a-fA-f0-9])/pack("C",hex($1))/eg; if ($name eq "ssect"){ $name = "section"; } $val =~ s//>/g; $val =~ s/\n/
/g; $pairs{$name} = $val; } $section = $pairs{"section"}; # #ASSIGN OUTPUT FILE #================================================================================== # #STUDENT SUBMISSIONS if (length($section) == 6){ # UPDATE SUBMISSION FILE $htmfile = "$section\.htm"; $htmfile = "/is/www/docs/dfp/dbdocs/cgi-bin/temp/$htmfile"; open(OUTFILE,">>$htmfile") || die "Can't open $htmfile"; chmod(0666,OUTFILE); print OUTFILE "Server Date is $date
","\n"; foreach $key(keys %pairs){ print OUTFILE "$key = $pairs{$key}
","\n"; } print OUTFILE "


","\n"; close(OUTFILE); # ACKNOWLEDGE SUBMISSION print "Content-type: text/html","\n\n"; print "

Your PreFlight has been submitted
","\n"; print "

"; } #=================================================================================== # #INSTRUCTOR DUMP elsif (substr($section,0,3) eq "dmp"){ $section = substr($section,-6); print "Content-type: text/html","\n\n"; print ''; } #=================================================================================== # #CLEAR THE STUDENT SUBMISSION FILE elsif (substr($section,0,3) eq "clr"){ $section = substr($section,-6); $htmfile = "$section\.htm"; $htmfile = "/is/www/docs/dfp/dbdocs/cgi-bin/temp/$htmfile"; open(OUTFL,">$htmfile"); chmod(0666,OUTFL); print OUTFL ""; print "Content-type: text/html","\n\n"; print "

Student Submission File has been cleared"; print "

"; } else{ # ACKNOWLEDGE SUBMISSION print "Content-type: text/html","\n\n"; print "

Error, Section = $section
"; print "

"; }