checks whether the session is set or not, if not it will redirect the user to login page.
session_start(); if(!isset($_SESSION['username'])){ header("Location:Login.php"); }
Here is what the above code is Doing:
1. It’s checking if the session variable ‘username’ is set.
2. If it is, then it’s doing nothing.
3. If it isn’t, then it’s redirecting the user to the login page.