Ökii
09-08-2003, 07:19 PM
session_start();
if(is_array($_SESSION) && count($_SESSION) > 0)
{
foreach($_SESSION AS $var=>$val)
{
$_SESSION[$var] = '';
unset($_SESSION[$var]);
$GLOBALS[$var] = '';
unset($GLOBALS[$var]);
session_unregister($var);
global $$var;
$$var = '';
unset($$var);
}
}
session_unset();
setcookie (session_name(), '', (time () - 2592000), '/', '', 0);
session_destroy();
You might be able to guess from that, that I've been trying for a while to either set the value to '' or totally unset the particular session variable.
I have used the above in an auto-redirecting (session-killer) page and in a main page that doesn't redirect.
A page on the site with
if(isset($_SESSION['varname']) && $_SESSION['varname'] != '')
{
// this gets executed after all the unsetting
}
has the session var miraculously reappear.
The buglist has a few references, most of which are slammed down as 'bogus' without any of the php developers actually informing how to unset a session variable so that it isn't accessible on the next page.
buglist search (http://bugs.php.net/search.php?search_for=unset+session&boolean=0&limit=10&order_by=&direction=ASC&cmd=display&status=All&php_os=&phpver=&assign=&author_email=&bug_age=0)
4.3.2 bug notice (http://bugs.php.net/bug.php?id=24270)
Any ideas?
if(is_array($_SESSION) && count($_SESSION) > 0)
{
foreach($_SESSION AS $var=>$val)
{
$_SESSION[$var] = '';
unset($_SESSION[$var]);
$GLOBALS[$var] = '';
unset($GLOBALS[$var]);
session_unregister($var);
global $$var;
$$var = '';
unset($$var);
}
}
session_unset();
setcookie (session_name(), '', (time () - 2592000), '/', '', 0);
session_destroy();
You might be able to guess from that, that I've been trying for a while to either set the value to '' or totally unset the particular session variable.
I have used the above in an auto-redirecting (session-killer) page and in a main page that doesn't redirect.
A page on the site with
if(isset($_SESSION['varname']) && $_SESSION['varname'] != '')
{
// this gets executed after all the unsetting
}
has the session var miraculously reappear.
The buglist has a few references, most of which are slammed down as 'bogus' without any of the php developers actually informing how to unset a session variable so that it isn't accessible on the next page.
buglist search (http://bugs.php.net/search.php?search_for=unset+session&boolean=0&limit=10&order_by=&direction=ASC&cmd=display&status=All&php_os=&phpver=&assign=&author_email=&bug_age=0)
4.3.2 bug notice (http://bugs.php.net/bug.php?id=24270)
Any ideas?