#!/usr/bin/perl


print "Content-type:text/html

";


read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

@pairs = split(/&/, $buffer);

$index2=0;

foreach $pair (@pairs) {
    
    $index2++;

    ($scratch, $value) = split(/=/, $pair);

    $value =~ tr/+/ /;

    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
        $FORM{$index2} = $value;
}


($sec,$min,$hour,$mday,$mon,$year,$wday,$ydat,$isdst) = localtime(time);
$year = $year + 1900;
$mon = substr("0".($mon+1),-2);
$mday = substr("0".$mday,-2);
$date = "$mon-$mday-$year";
$hour = substr("0".$hour,-2);
$min = substr("0".$min,-2);
$sec = substr("0".$sec,-2);
$time = "$hour:$min:$sec";

open(OutPutResults,">>genetics_Assessment_faculty_sm08_results.txt");

flock(OutPutResults,2);
seek(OutPutResults,0,2);
print OutPutResults "
";
print OutPutResults "$time|$date|";

for ($i=1; $i <=$index2; $i++) 
{
    print OutPutResults "$FORM{$i}";
    
print OutPutResults"|";
}




select(STDOUT);


close(OutPutResults);


print<<EndThankYou;

<html><head>
<title>Thank You</title></head>

<body><p>Thank you for taking the time to fill out this
survey.</p>

</body>
</html>

EndThankYou

