#!/usr/bin/perl
print "Content-type:text/html\n\n";
print "
Thank You\n";
print "\n";
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;
$value =~ s/\n/ /g; # replace newlines with spaces
$value =~ s/\r//g; # remove hard returns
$value =~ s/\cM//g; # delete ^M's
$FORM{$name} = $value;
}
open(OUTF,">>FlatFile.out") or dienice("Couldn't open FlatFile.out for
writing: $!");
# This locks the file so no other CGI can write to it at the
# same time...
flock(OUTF,2);
# Reset the file pointer to the end of the file, in case
# someone wrote to it while we waited for the lock...
seek(OUTF,0,2);
# print OUTF "$FORM{'Field1'}|";
print OUTF "$FORM{'1A'}|";
print OUTF "$FORM{'1B'}|";
print OUTF "$FORM{'1C'}|";
print OUTF "$FORM{'1D'}|";
print OUTF "$FORM{'1E'}|";
print OUTF "$FORM{'Q2'}|";
print OUTF "$FORM{'Q3'}|";
print OUTF "$FORM{'Q4'}|";
print OUTF "$FORM{'Q5'}|";
print OUTF "$FORM{'Q6'}|";
print OUTF "$FORM{'Comments'}|";
print OUTF "\n";
close(OUTF);
print <
Thank You!
Thank you for your feedback.
Return to our home page
EndHTML
sub dienice {
my($msg) = @_;
print "
Error
\n";
print $msg;
print "