
sleuth
Enthusiast
Nov 30, 2000, 9:58 AM
Post #2 of 2
(1706 views)
|
If I understand what you mean, you are running your script from a CONSOLE, and not a BROWSER, right? and you want it to read input from the CONSOLE input in the same fasion as the browser will? True False? If your running this from the BROWSER, then use this code to read URI auruments. <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> sub parse_form { my (@pairs, %in); my ($buffer, $pair, $name, $value); 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 { &cgierr('You cant run this script from telnet/shell.'); } PAIR: foreach $pair (@pairs) { ($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 eq "---") and next PAIR; exists $in{$name} ? ($in{$name} .= "~~$value") : ($in{$name} = $value); } return %in; } %in =&parse_form; </pre><HR></BLOCKQUOTE> Then it will store the unique id in $in{'uniqueid'} Sleuth
|