Re: session_unset() and session_destroy()
| From: | Yasuo Ohgaki | Date: | Wed, 23 May 2001 18:24:28 +0000 |
| Subject: | Re: session_unset() and session_destroy() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-54107@lists.php.net to get a copy of this message | ||
Arcady Genkin wrote:
I don't think that I grasp the difference between session_unset() and session_destroy() functions. Would anyone explain?session_unset() frees session vars from memory. session_destroy() delete session from session storage. If you do session_unset(), it will results session with no session data. If you do session_destroy(), it will results session with currently registered data. (Unless you do session_unset()).
Also, suppose that I want to totally wipe out an existing session, and then start a new one. Can I still do session_register() after I do session_unset() or session_destroy() or both?I guess you can, but the session will have the session id. You must set new session id with session_id(). If you want to start new session, simplest way is to set new session id, since session data will be garbage collected eventually. If you care about session hijacking, call session_destroy() then call session_id(). Regards, -- Yasuo Ohgaki