note 19608 added to function.session-unregister
| From: | dankdoutz at hotmail dot com | Date: | Tue, 05 Mar 2002 22:40:27 +0000 |
| Subject: | note 19608 added to function.session-unregister | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27381@lists.php.net to get a copy of this message | ||
This is the function we are using for logout (thanks to all previous authors)
function session_clear()
{
// if session exists, unregister all variables that exist and destroy session
$exists = "no";
$session_array = explode(";",session_encode());
//echo ("sess array = $session_array <br>");
for ($x = 0; $x < count($session_array); $x++)
{
$name = substr($session_array[$x], 0, strpos($session_array[$x], "|"));
//echo ("sess var name = $name <br>");
if (session_is_registered($name))
{
session_unregister('$name');
$exists = "yes";
}
}
if ($exists != "no")
{
session_destroy();
}
--
http://www.php.net/manual/en/function.session-unregister.php
http://master.php.net/manage/user-notes.php?action=edit+19608
http://master.php.net/manage/user-notes.php?action=delete+19608
http://master.php.net/manage/user-notes.php?action=reject+19608