Cookies must go in the HTTP header. If you print HTML first, you've given up your chance to print any HTTP headers. Print the header with any cookies first.
if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $request,$ENV{'CONTENT_LENGTH'}) or die "Could not get + query\n"; } @parameters = split(/&/,$request); foreach $p (@parameters){ $p =~ s/\+/ /g; ($para,$value) = split(/=/,$p); $para =~ s/%([0-9A-F][0-9A-F])/pack("c",hex($1))/ge; $value =~ s/%([0-9A-F][0-9A-F])/pack("c",hex($1))/ge; $PAIRS{$para} = $value; }
Get rid of this code; it's buggy (I count at least three bugs and one denial of service attack) and you're already using CGI. Use its param() functions and save yourself the headache.
Improve your skills with Modern Perl: the free book.
In reply to Re^3: Cookie and Session
by chromatic
in thread Cookie and Session
by devarishi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |