in reply to Re^3: Cookie and Session
in thread Cookie and Session
I have removed that line and now I am printing nothing before the "header":
use CGI qw/:standard/; use CGI::Cookie; if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $request,$ENV{'CONTENT_LENGTH'}); } @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; } if($PAIRS{"login_id"} eq("admin") && $PAIRS{"login_password"} eq("go") +){ $login_cookie = new CGI::Cookie(-name=>'loginID',-value=>'a +dmin'); $password_cookie = new CGI::Cookie(-name=>'loginPassword',-valu +e=>'go'); print header(-cookie=>[$login_cookie,$password_cookie]); print "<script type='text/javascript'> window.location = 'work_with_cookies.pl'; </script>"; } else{ print "<script type='text/javascript'> <!-- window.location = 'admin_login.html'; //--> </script>"; }
Still it does not work. The "Set cookie" lines are displaying and the page is not being redirected as well. If I remove the "print" operator from the "header" statement then the page gets redirected but nothing appears thereon. I mean the cookies are not retrieved thereon.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Cookie and Session
by aaron_baugher (Curate) on Nov 03, 2011 at 22:48 UTC | |
|
Re^5: Cookie and Session
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 |