I am trying to redirect the user to my login page if the user is not logged in.
This variable is created when the user enters a successful login
$_SESSION['loggedin'] == true;
header("location:mainpage.php");
on my 'mainpage' this is my code:
if($_SESSION['loggedin'] == false)
header("location:login.php");
I have added 'Session_start();' to the top of both pages also My current problem is that everytime I login I am automatically redirected back to my login page so this is clearly not working