Link to home
Start Free TrialLog in
Avatar of hibbsusan
hibbsusan

asked on

php session deletion

How come after I run this session and session cookie clearing script (from Murach's php/mysql)

<?php
session_start( );
session_destroy();
$_SESSION = array();
$name = session_name();
$expire = strtotime('-1 year');
$params = session_get_cookie_params();

$path = $params['path'];
$domain = $params['domain'];
$secure = $params['secure'];
$httponly = $params['httponly'];
setcookie($name, '', $expire, $path, $domain, $secure, $httponly);
?>

Open in new window


this code, run immediately afterward:

foreach ($_SESSION as $key=>$val)
{
	echo $key;
	echo '&nbsp; : &nbsp;';
	echo $val;
	echo '<br>';
}

Open in new window


still echos

a  :  asdf

Thank you!
Avatar of hibbsusan
hibbsusan

ASKER

where, of course, before i had set:

$_SESSION['a'] = "asdf";

Open in new window

do:

unset($_SESSION['a']);
and then destroy_session();
err... sorry, session_destroy(); but you already knew that :)
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial