Hi all. Could some one have a look at the following code and tell me my the 3rd script can't read the cookie and allow me to access the page? Basically I am sure I am not doing anything wrong. I can see the cookie set in my browser through the users windows explorer. It looks the same as this...
test test 'path' 0 1157283456 29448914 789082896 29448899 Is there a problem with the third script? It doesn't seem to be populating $user? Any suggestions or comments would be creatly appriciated. Kind regards, Daniel Falkenberg FIRST SCRIPT.cgi - LOGIN PAGE #Normal stuff here #!/usr/bin... my $username = "test"; my $password = "test"; my $user = param('username'); my $pass = param('password'); logout() if($action eq "logout"); login_page() unless($pass); my $valid = Check_Login($user, $pass); if($valid) { my $cookie = Create_Cookie("+30m", $user); print redirect(-uri=>"safilm", -cookie=>$cookie); exit; } else{ my $time = time(); print redirect(-uri=>"login?$time"); exit; } sub logout{ my $time = time(); my $cookie = Create_Cookie("-30m", ""); print redirect(-uri=>"login?$time", -cookie=>$cookie); exit; } sub Create_Cookie{ my $exp = shift; my $val = shift; my $cookie = cookie ( -name => 'test', -value => $val, -expires => $exp, -path => '' ); return($cookie); } sub Check_Login{ my $user = shift; my $pass = shift; ($password eq $pass) ? return 1 : return 0; } sub login { print header(); print<<HTML; #form here... HTML } SCRIPT 2.pl - SHARED FILE sub Check_Cookie{ my $user = cookie('test'); if ($user){ return($user); } else{ print redirect(-uri=>"login"); exit; } } 1; SCRIPT 3.cgi - MAIN PAGE #Normal stuff here #!/usr/bin... my $user = Check_Cookie(); my $action = param('action'); print header(); print<<HTML; #Html crud here HTML ============================== VINTEK CONSULTING PTY LTD (ACN 088 825 209) Email: [EMAIL PROTECTED] WWW: http://www.vintek.net Tel: (08) 8523 5035 Fax: (08) 8523 2104 Snail: P.O. Box 312 Gawler SA 5118 ============================== -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]