in reply to Empty Cookie
Update: here's my working code at http://www.bob-n.com/cgi-bin/test4.pl. Click once to get the cookie sent, reload within 10 seconds to see results of sending it back.($submitted_user, $submitted_pass) = $q->cookie("sessionID");
#!/usr/bin/perl -wT use CGI; my $q = CGI->new(); use Data::Dumper; use strict; my ( $submitted_user, $submitted_pass, @rc, @sessionID); @sessionID = qw( PASS USR); if ( @rc = $q->cookie('sessionID') ) { print $q->header(), $q->start_html, $q->pre(['recv cookie', Dumper +(\@rc)]); if ($q->cookie("sessionID")) { ($submitted_user, $submitted_pass) = $q->cookie("sessionID"); print $q->pre([ '$submitted_user, $submitted_pass: ', "$submitted_user, $submitted_pass\n"]); } else { print ("Invalid user/pass. Please login again."); } } else { my $cookie = $q->cookie( -name => 'sessionID', -value => \@sessionID, -expires => '+10s', -path => '/cgi-bin/', -domain => '.bob-n.com', -secure => 0 ); print $q->header(-cookie=>$cookie), $q->start_html; print "<pre>sent cookie:\n", Dumper($cookie), '</pre>'; } print $q->end_html;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Empty Cookie
by Anonymous Monk on Jun 27, 2003 at 19:47 UTC |