in reply to Re: yummm...cookies, anyone?
in thread yummm...cookies, anyone?
Now something weird is happening. When you click the login button it changes the url from http://sulfericacid.perlmonk.org/login to http://sulfericacid.perlmonk.org/%2Flogin, which of course can't be found. Why is the cookie changing the url?
You said I shouldn't store passwords inside the cookies, is this ALWAYS a rule or is it okay if you encrypt the password?
Thanks
if ( cookie('sessionID') ) { print header(-cookie=>'sessionID'), start_html; print "You're in!"; print cookie(); } else { print header, start_html; print "BAD COOKIE!<br>"; print start_form(), table( Tr( td("Username:"), td( textfield( -name => 'username', -size => '15' ) ) ), Tr( td("Password:"), td( textfield( -name => 'password', -size => '15' ) ) ), Tr( td( submit('send') ), ), end_form, ); if (param) { use Digest::MD5 qw(md5 md5_hex md5_base64); my $user = param('username'); my $passold = param('password'); my $pass = md5_hex($passold); #encrypt if ( exists $login{$user} ) { if ( $login{$user} == $pass ) { print "Good!<br>"; my $contents = join("::", $user, $pass); my $cookie= cookie( -name => 'sessionID', -value => "$contents", -expires => '+1h', -secure => 1 );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Re: Re: yummm...cookies, anyone?
by merlyn (Sage) on Aug 04, 2003 at 02:42 UTC | |
|
Re: Re: Re: yummm...cookies, anyone?
by antirice (Priest) on Aug 04, 2003 at 03:13 UTC |