#!/usr/bin/perl %formdata = &parseForm(); print "content-type:text/html\n\n"; #compose config file location $scriptstring1 = ""; $scriptstring2 = ""; #open the news file and copy all lines to array... open (FILE, "drfnews.html"); foreach $line () { if ($line =~ m//) { print $scriptstring1."
".$scriptstring2."
\n"; } elsif ($line =~ m/INSERT_LICENSEE_ID_/) { $line =~ s/INSERT_LICENSEE_ID_/$formdata{"LID"}/g; print $line; } else { print $line; } } close (FILE); exit; #****** this subroutine parses the form for data *************************** # returns the hash containing the values... #*************************************************************************** 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); if ($ENV{'QUERY_STRING'}) { @getpairs = split(/&/, $ENV{'QUERY_STRING'}); push (@pairs,@getpairs); } } else { #could not use the given method (not get or post) # put error code text in here... } foreach $pair (@pairs) { ($key, $value) = split (/=/, $pair); $key =~ tr/+/ /; $key =~ s/%([a-fA-F0-0][a-fA-F0-9]) /pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-0][a-fA-F0-9]) /pack("C", hex($1))/eg; $value =~s///g; if ($formdata{$key}) { $formdata{$key}.=", $value"; } else { $formdata{$key} = $value; } } return %formdata; }