Home > Archive > PHP Language > June 2005 > Delete of cookies and of the session-id
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Delete of cookies and of the session-id
|
|
| Matthias Braun 2005-06-07, 8:55 pm |
| Help!
I try to delete at the end of the php-session either the cookies or the
sessionid (depending on cookies are allowed or not):
<?php
ini_set('session.use_trans_sid',1);
session_start();
unset($_SESSION['PHPSESSID']);
setcookie('PHPSESSID',FALSE,0);
?>
but it doesn't work. Who can help?
Thanks,
Matthias
| |
| Janwillem Borleffs 2005-06-08, 8:57 am |
| Matthias Braun wrote:
> I try to delete at the end of the php-session either the cookies or
> the sessionid (depending on cookies are allowed or not):
>
It doesn't work that way, because a new PHPSESSID is created each time you
call session_start().
When your goal is to logout a user or something like that, you should unset
an identifier, e.g. ``loggedin'':
session_start();
if ($logout) {
unset($_SESSION['loggedin']);
}
JW
|
|
|
|
|