require_once('../class.user.php');
$user_logout = new USER();
if($user_logout->is_loggedin()!="")
{
$user_logout->redirect('login.html');
}
if(isset($_GET['logout']) && $_GET['logout']=="true")
{
$user_logout->doLogout();
$user_logout->redirect('login.html');
}
?>
this is my logout script logout.php,its not working,can somebody assist me please. its redirecting to a blank logout.php page with no php errors.I have a class user file with all my functions and a login.html as well as login.php for backend
If not mistaken,
if($user_logout->is_loggedin()!="") { $user_logout->redirect('login.html'); }
- is wrong.
It should be
if(empty($user_logout->is_loggedin())) { $user_logout->redirect('login.html'); }
instead.
The purpose of the if statement:
if($user_logout->is_loggedin()!="")
Should be to logout the user if he is not logged in. It would make more sense if the if statement was:
if(!$user_logout->is_loggedin())
If you want the user who is already logged in to be logged out, then you need to access logout.php from the browser as logout.php?logout=true. This will cause the code within the second if statement to run