I have a facebook login system that seems to work fine, but I want to redirect to the home page if the user is logged in. SO this is the top of my page
<?php
session_start();
if(!empty($_SESSION)){
header("Location: home.php");
}
But that gets ignored and it runs the login script as if $_SESSION is empty, even tho I print the Session array on the home page and it always shows it has values, plus the rest of the script assigns session values anyway. Even if I change it to if (empty($_SESSION))
or add a else { die()}
after it, it just completely ignores it.
Now if I add anything to print the session either using print_r($_SESSION) or echo'ing a particular value, even if I place this out side of the if statement, it seems to realise that the $_SESSION has a value and does the redirect. I could just put that there permanently as it would never appear...but I would rather figure out why it isn't working now.