Detecting cookie problem
Posted: Wed Nov 24, 2004 10:54 pm
Ok, I am using a script to detect a cookie set by the Login page. Here is the code:
The problem is that after I login and set the cookies and then close the window, the code will not pick up on the detected cookie after opening it again in a new window. The cookies still exist, but for some reason it won't do anything until I go back to the login page which DOES pick up on the cookies and redirects me saying that "I'm already logged in." Where is the error? After I am redirected, the above code DOES detect the cookies. Where is the problem?
Code: Select all
<?
IF($_COOKIE[username] == "" AND $_COOKIE[password] == "") {
$nav = "";
$welcome = "You are not logged in. <a href='http://www.***.com/login.php'>Click here to login.</a>";
}ELSEIF($_COOKIE[username] != "" AND $_COOKIE[password] != ""){
$nav = " | <a href='admin.php'>Admin</a>";
$welcome = "Welcome $_COOKIE[username]. <a href='logout.php'>Click here to logout.</a>";
}
?>