This could be the sequel of this question: PHP Sessions across sub domains
I have a successful multi-domain session simply using this:
session_set_cookie_params(0, '/', '.domain.com');
session_start();
The problem is when I try to logout from domain.com
. I have tried everything for logout, even all this, as suggested in PHP session_destroy()
manual:
// Unset all of the session variables.
$_SESSION = array();
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}
But it's not working. The session is still alive when I visit subdomain.domain.com
.
How can i do it?
Thank you!