diff options
-rwxr-xr-x | minimun | 31 |
1 files changed, 30 insertions, 1 deletions
@@ -5,9 +5,38 @@ use warnings; use IPC::Run qw(run); use Time::HiRes qw( time ); +my ($buffer, @pairs, $pair, $name, $val, %FORM); + +if ($ENV{'REQUEST_METHOD'} eq "GET") { + $buffer = $ENV{'QUERY_STRING'}; +} +@pairs = split(/&/, $buffer); + +foreach $pair (@pairs) { + ($name, $val) = split(/=/, $pair); + $val =~ tr/+/ /; + $val =~ s/%(..)/pack("C", hex($1))/eg; + $FORM{$name} = $val; +} + my ($in, $out); +$in = "\n"; + +if ($ENV{'PATH_INFO'} eq '/award.pdf'){ + $in .= "\\award{$FORM{'committee'}}{$FORM{'country'}}{$FORM{'award'}}{$FORM{'school'}}"; +} +elsif ($ENV{'PATH_INFO'} eq '/room.pdf'){ + $in .= "\\room{$FORM{'committee'}}"; +} +else{ + print "Content-type: text/html\n"; + print "Status: 404 File Not Found Error\n"; + print "\n"; + print '<a href="/">404 Error. Go back.</a>'; + die; +} + -$in .= "\\award\n"; $in .= "\\bye\n"; my $timestamp = time; |