On my index.php
page I have this:
session_start();
if($_SESSION['logged_in']==true) {
header("Location:home.php");
} else {
header("Location:login.php");
}
On my login page, whenever the user correctly inputs the username and password I wrote this:
$_SESSION['username']=$username;
I used this as a reference to the future pages. But on my home.php
, no matter what I do it keeps giving me this error:
Undefined variable: _SESSION in C:\xampp\htdocs\website\home.php on line 8
The line 8 is:
$user= $_SESSION['username'];