Page 1 of 1

Problems closing sessions

Posted: Tue Nov 25, 2003 11:51 am
by Perfidus
Is it possible to close a session wihout closing browser?
Should this close a session?
I have this to close a session in my web, but after this, when you are taken to acceso6.html it still recognise the session.
:(
<?php
session_start();
session_unset();
session_destroy();
header("Location: /acceso6.html");
?>

Posted: Tue Nov 25, 2003 1:19 pm
by mrvanjohnson
Try this.

Code: Select all

<?php
session_start(); 
$_SESSION = array(); 
session_destroy(); 
header("Location: /acceso6.html"); 
?>

Posted: Wed Nov 26, 2003 4:08 am
by malcolmboston
i had the same problem as this guy, cant remember how i fixed it tho :oops:

Posted: Wed Nov 26, 2003 4:09 am
by Luis Almeida
I used to have the same problem but i saw the following code somewhere and it works fine

Code: Select all

<?php
session_unset(); 
session_destroy(); 
$p = session_get_cookie_params(); 
setcookie( session_name(),  "",   0, $p ["path"], $p["domain"]); 
?>

Posted: Wed Nov 26, 2003 4:12 am
by malcolmboston
actually the code that perfidus had, i fuond on a tutorial and copied and pasted it, it didnt work :( , dont you hate it when tutorials tell you the wrong things! or maybe its works for an older version of PHP, not sure