From 242342d03ac5665d149af59dd450b7257e140964 Mon Sep 17 00:00:00 2001 From: kink Date: Mon, 21 Oct 2002 11:27:58 +0000 Subject: [PATCH 1/1] You must start a session to be able to destroy it. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3922 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/global.php | 48 +++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/functions/global.php b/functions/global.php index 1bac6286..6b7e39e6 100644 --- a/functions/global.php +++ b/functions/global.php @@ -7,10 +7,10 @@ * Licensed under the GNU GPL. For full terms see the file COPYING. * * This includes code to update < 4.1.0 globals to the newer format - * It also has two session register functions that work across various + * It also has some session register functions that work across various * php versions. * - * $Id $ + * $Id$ */ @@ -115,27 +115,29 @@ function sqextractGlobalVar ($name) { } function sqsession_destroy() { - global $base_uri; - - if ( (float)substr(PHP_VERSION , 0 , 3) < 4.1) { - global $HTTP_SESSION_VARS; - $HTTP_SESSION_VARS = array(); - } - else { - $_SESSION = array(); - } - - /* - * now reset cookies to 5 seconds ago to delete from browser - */ - - @session_destroy(); - $cookie_params = session_get_cookie_params(); - setcookie(session_name(), '', time() - 5, $cookie_params['path'], - $cookie_params['domain']); - setcookie('username', '', time() - 5, $base_uri); - setcookie('key', '', time() - 5 , $base_uri); - + global $base_uri; + + /* start session to be able to destroy it later */ + session_start(); + + if ( (float)substr(PHP_VERSION , 0 , 3) < 4.1) { + global $HTTP_SESSION_VARS; + $HTTP_SESSION_VARS = array(); + } + else { + $_SESSION = array(); + } + + /* + * now reset cookies to 5 seconds ago to delete from browser + */ + + @session_destroy(); + $cookie_params = session_get_cookie_params(); + setcookie(session_name(), '', time() - 5, $cookie_params['path'], + $cookie_params['domain']); + setcookie('username', '', time() - 5, $base_uri); + setcookie('key', '', time() - 5 , $base_uri); } ?> -- 2.25.1