#!/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/>/>/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 "