in reply to Re: Cookies
in thread Cookies, how can you set one if it must be done before the header?
I have url_params that run off this script, but when I'm supposively logged in and I go to a url_param, it errors out saying I have the wrong password. Can you see a problem below with the cookie being sent? And if I reload the page after I log in, I stay logged in. But if I go back to the url using the location bar, it tells me to relog back in.
Thank you!
my $adminpassword = "test"; my %cookie; if ( !exists $cookie{'pass'} ) { if ( param() ) { my $adminpass = param('admin'); if ( $adminpass eq $adminpassword ) { my $cookiename = cookie( -name => 'cookie', -value => 'loggedin', -expires => '+1h' ); print header, start_html(); # print rest of page here print "you are logged in"; } } else { print header, start_html(); print "Incorrect password, please click back and try again +"; exit; } } else { print header, start_html(); print start_form(), table( Tr( td("Admin Password: "), td( textfield( -name => 'admin', -size => 10 ) ) ), Tr( td(), td(submit) ), ), end_form(), hr(); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Cookies
by inman (Curate) on Dec 24, 2003 at 10:44 UTC | |
|
Re: Re: Re: Cookies
by edoc (Chaplain) on Dec 24, 2003 at 12:22 UTC | |
by Anonymous Monk on Dec 24, 2003 at 22:57 UTC | |
by Cody Pendant (Prior) on Dec 26, 2003 at 00:43 UTC |