But if the script is www.mysite.com/script.pl, after I sign in if I click in the location/address bar and click ENTER, it logs me back out. The other problem is, I have links on this script that connect to url_params like www.mysite.com/script.pl?who=someone's name and even after you log in and click on a link which connects back to the same script (with just a url param), it jumps back to a 'WRONG PASSWORD' error.
Can anyone see why? I've worked with cookies literally on dozens of occassions and not once did they ever work. I had +1h for the original expiration but someone said it could be a server/computer time error and to set it to a higher interval (1 year), which I did but it didn't solve anything.
Any help would be very much appreciated.
my $adminpassword = "test"; my %cookie; require SDBM_File; my %mail; my $person = url_param('lookup'); if ( !exists $cookie{'pass'} ) { if ( param() ) { my $adminpass = param('admin'); if ( $adminpass eq $adminpassword ) { my $cookiename = cookie( -name => 'cookie', -value => 'loggedin', -path => '/', -expires => '+3y' ); print header, start_html(); # print rest of page here print "you are logged in"; ##### database value lookup if ($person) { if (exists $mail{$person}) { my $lookup_data = $mail{$person}; print "$lookup_data"; } else { print "<h3><font color=red>Error:</font></h3> This user doesn't exist" +; } } else{ foreach (keys %snailmail) { print <<"END"; <a href="www.myscript.com/login.pl?lookup=$_" target="_new">$_</a><br> END } } } 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(); } }
In reply to Cookie not getting stores by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |