# ReadParse # Reads in GET or POST data, converts it to unescaped text, #and puts one key=value in each member of the list "@in" # Also creates key/value pairs in %in, using '\0' to #separate multiple selections # If a variable-glob parameter (e.g., *cgi_input) is passed #to ReadParse, information is stored there, rather than in #$in, @in, and #%in.$ErrloglogFile = "/export/data/secure03.principal.com/htdocs /logs/pension/ pnactval.log"; $AcclogFile = "/export/data/secure03.principal.com/htdocs/ logs/pension/pnactval.acclog"; $ArchiveDir = "/export/home/pension/logs/rsc"; $zone = `/usr/bin/date \+\%Z`; $gzip = "/usr/local/bin/gzip -d -c"; $grep = "/usr/bin/grep"; $cgi = "/cgi-bin/pension/utilities/rscdetail"; $cat = "/usr/bin/cat"; $tempDir = "/tmp"; $randnum = int( rand(99999999) ); $tempFile = "$today$randnum.pnactval";
As you can see it checks in the beginning portion whether $ ENV{'REQUEST_METHOD'}eq "GET" or "POST". now do i have to make any changes over here? PS: This is not the entire code(just the part of it).sub ReadParse { local (*in) = @_ if @_; local ($i, $loc, $key, $val); # Read in text if ($ENV{'REQUEST_METHOD'} eq "GET") { $in = $ENV{'QUERY_STRING'}; } elsif ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN,$in,$ENV{'CONTENT_LENGTH'}); } @in = split(/&/,$in); foreach $i (0 .. $#in) { # Convert plus's to spaces $in[$i] =~ s/\+/ /g; # Split into key and value. ($key, $val) = split(/=/,$in[$i],2); # splits on the first =. # Convert %XX from hex numbers to alphanumeric $key =~ s/%(..)/pack("c",hex($1))/ge; $val =~ s/%(..)/pack("c",hex($1))/ge; # Associate key and value $in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple se +parator $in{$key} .= $val; } return 1; # just for fun }
In reply to Re: passing parameters??
by Anonymous Monk
in thread passing parameters??
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |