Good evening everyone!
There is such a problem: A person can log in to the site using an e-mail and password, if the password and e-mail is correct, then a session is created:
session_start(); $_SESSION['email'] = $email; There is a button to exit, when you click on it, the following function works:
function getLogout(){ session_start(); $_SESSION = array(); if (ini_get("session.use_cookies")) { $params = session_get_cookie_params(); setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"] ); } unset($_SESSION['email']); session_destroy(); } Checked through echo $_SESSION['email'] , gives out emptiness after pressing the exit button. Ie session is deleted.
But for some reason, the redirect (code below) does not work, that is, as if the session is still there! Why is that?
if( !isset($_SESSION['email']) ) { header('http://site.ru'); }