if not logged in redirect index php code example
Example: php redirect if not logged in
if(!isset($_SESSION['login'])){ //if login in session is not set
header("Location: http://www.example.com/login.php");
}
if(!isset($_SESSION['login'])){ //if login in session is not set
header("Location: http://www.example.com/login.php");
}