in reply to Re^2: Cookie and Session
in thread Cookie and Session
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Cookie and Session
by devarishi (Initiate) on Nov 03, 2011 at 18:44 UTC | |
by aaron_baugher (Curate) on Nov 03, 2011 at 22:48 UTC | |
by Anonymous Monk on Nov 04, 2011 at 02:31 UTC | |
by devarishi (Initiate) on Nov 04, 2011 at 05:23 UTC | |
by aaron_baugher (Curate) on Nov 04, 2011 at 14:53 UTC | |
by Anonymous Monk on Nov 04, 2011 at 06:39 UTC |