First test to see if the cookie has in fact been set by printing it:
echo $_COOKIE['loggedIn'];
somewhere on the admin.php page. if it prints "yes" then there is no problem with the cookie.
What could be the problem is how you are checking to see if the user is logged in or not.
So if admin.php is the protected page I am assuming you have some sort of check at the top of that page to see if the cookie "loggedIn" is set to the value "yes" and if not then redirect the user to the login page immediately instead of loading the rest of that page.
This can be done using something like this:
PHP Code:
if (!$_COOKIE['loggedIn'] == "yes") { echo "<script type='text/javascript'>window.location=\"login.php\"</script>"; die(); }
You still need to post the script that is on the protected page. The one that actually checks to see if the user is logged in or not.
|