note 43327 deleted from function.session-is-registered by philip

From: Date: Sun, 04 Mar 2007 00:22:13 +0000
Subject: note 43327 deleted from function.session-is-registered by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-124055@lists.php.net to get a copy of this message
Note Submitter: Tuukka from Finland ---- 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(); ?>

« previous php.notes (#124055) next »