note 43327 added to function.session-is-registered

From: Date: Thu, 17 Jun 2004 16:16:21 +0000
Subject: note 43327 added to function.session-is-registered
Groups: php.notes 
Request: Send a blank email to php-notes+get-71235@lists.php.net to get a copy of this message
From the previous note: -------------------------------------------------- So, forget session_register(), session_unregister(), session_destroy() and al those stupid functions. The only thing you need is the super global $_SESSION. -------------------------------------------------- I do have to disagree about the session_destroy() function; if you want to remove the session file created in the server tmp or whatever folder, you must use session_destroy() function. The <?php $_SESSION = array(); ?> code only unsets the superglobal variables. For clearing the superglobals, the cookie and deleting the server session file, my advice would be using the code below. <?php //session_start(); // if your session wasn't started yet setcookie(session_name() ,"",0,"/"); unset($_COOKIE[session_name()]); $_SESSION = array(); session_unset(); session_destroy(); ?> ---- Manual Page -- http://www.php.net/manual/en/function.session-is-registered.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43327 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43327&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43327&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#71235) next »