#!/usr/bin/perl # Parseform Sub-Routine. # Usage: drop sub into CGI script. When you need to parse the form, # do a &parseform; . The data is stored in the %FORM hash. To access, # use the form $FORM{'field_name'} . # From http://www.cgi.tj/ sub parseform { if ($ENV{'REQUEST_METHOD'} eq 'GET') {@pairs = split(/&/, $ENV{'QUERY_STRING'});} elsif ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); } else { print "Content-Type: text/html\n\n"; print "

Bad or unknown request method.

\n"; exit(0); } foreach $pair (@pairs) { local($name, $value) = split(/=/, $pair); $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; $FORM{$name} = $value; } } &parseform; print "Content-Type: text/html\n\n"; print ""; print "
"; print ""; if ($video eq "none") { print ""; } else { print ""; } print "\n";