I have 2 pages that both have the same code for checking whether if someone's logged in or not. In the index page it shows the username if the cookie for username is set. But and on the second page, the login page, it redirects back to index page if the username cookie is set. Here's the if statement that checks it:
login page:
if(isset($_COOKIE['username'])){
header("Location: ../index.php");
die();
}
index page:
if(isset($_COOKIE['username'])){
echo '<p style=""> '.$_COOKIE['username'].'</p>';
}else{...}
that's pretty much the code in a nutshell. in the login page the redirect works fine, I've checked it with different pages. But in the index page, even though it's the exact same if statement, it doesn't work.
Is there a problem with the code, or is it a folder/server related issue?
Thanks, O.N.