I have a problem with the session_id(). When I call the session_destroy(), by going specifically to the logout page and then I go back to my start page the session_id is still the same. What to do? But when I close the browser window the session_id is a new one, but what if a person not closes his/her browser window?
+4
A:
session_destroy() destroys the session data on the server, not the session id in the cookie. Either use setcookie() to unset the cookie or use session_regenerate_id() to get a new ID.
johannes
2010-01-19 13:18:32
session_regenerate_id() is the correct function name (http://de.php.net/manual/en/function.session-regenerate-id.php)
Thomas
2010-01-19 15:06:22
A:
The order of regeneration and destroying variables is important:
function _session_destroy() {
session_regenerate_id();
session_destroy();
}
cballou
2010-01-19 13:22:50
A:
use these function as in order shown below
session_start();
session_unset();
/* Kill all session variables */
unset($_SESSION['variable1']);
unset($_SESSION['variable2']);
.
.
.
.
.
unset($_SESSION['variableN']);
$_SESSION = array(); // reset session array
/* now generate session id */
session_regenerate_id();
session_destroy(); // destroy session.
diEcho
2010-01-19 15:04:35