merge from stable: sqsession_destroy
[squirrelmail.git] / functions / global.php
index 699dec0..fcaceff 100644 (file)
@@ -101,4 +101,29 @@ function sqextractGlobalVar ($name) {
         $$name =  $_GET[$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);
+       
+}
+
 ?>