For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > November 2004 > Re: [PHP-DB] session_destroy();









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 Re: [PHP-DB] session_destroy();
Ramil Sagum

2004-11-09, 3:55 am

On Tue, 9 Nov 2004 01:00:12 -0500, Chris Payne <cjp@planetoxygene.com> wrote:
> Hi there everyone,
>
> I need to destroy a session in the browser so when they log out it clears
> all the session data from the browser, I have tried:
>
> session_destroy();
>
> But it doesn't seem to do it as the browser keeps the same PHPSessionID.
>
> What is the best way to destroy a session and generate a new sessionid
> without having to close the browser and go back again?
>


Did you unset the session variables using:

// Unset all of the session variables.
$_SESSION = array();

If you are using a cookie for the session id, you might also want to
delete the cookies

if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}

Do these before calling session_destroy.

check it out here.

http://www.php.net/session_destroy

HTH
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com