webmaster1 Posted April 17, 2010 Share Posted April 17, 2010 While the manual provides an example on how to destroy a session it also provides a block of code that kills the session: // If it's desired to kill the session, also delete the session cookie. // Note: This will destroy the session, and not just the session data! if (ini_get("session.use_cookies")) { $params = session_get_cookie_params(); setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"] ); } If I want to log out and stop the session completely, should I kill, destroy or both? Quote Link to comment https://forums.phpfreaks.com/topic/198836-is-there-a-difference-between-killing-and-destroying-sessions/ Share on other sites More sharing options...
oni-kun Posted April 17, 2010 Share Posted April 17, 2010 The definitions of killing and destroying fortunately relate to your question. Quote Link to comment https://forums.phpfreaks.com/topic/198836-is-there-a-difference-between-killing-and-destroying-sessions/#findComment-1043639 Share on other sites More sharing options...
webmaster1 Posted April 17, 2010 Author Share Posted April 17, 2010 The manual explains that killing destroys the session data and the session whereas destroying destroys the session. Would I be correct to assume that I only need to destroy the session for my log out page? Quote Link to comment https://forums.phpfreaks.com/topic/198836-is-there-a-difference-between-killing-and-destroying-sessions/#findComment-1043643 Share on other sites More sharing options...
oni-kun Posted April 17, 2010 Share Posted April 17, 2010 Where do I see "killing" in the manual? Destroying the session will remove the data from memory (To some extent), Killing the session or deleting the client's cookie/and or your server's /tmp entry of the data is another subject, that should not in any practise need to be used on a logout such as you mentioned. Quote Link to comment https://forums.phpfreaks.com/topic/198836-is-there-a-difference-between-killing-and-destroying-sessions/#findComment-1043650 Share on other sites More sharing options...
webmaster1 Posted April 17, 2010 Author Share Posted April 17, 2010 Where do I see "killing" in the manual? // If it's desired to kill the session, also delete the session cookie. Destroying the session will remove the data from memory (To some extent), Killing the session or deleting the client's cookie/and or your server's /tmp entry of the data is another subject, that should not in any practise need to be used on a logout such as you mentioned. Cheers for that explanation. Quote Link to comment https://forums.phpfreaks.com/topic/198836-is-there-a-difference-between-killing-and-destroying-sessions/#findComment-1043653 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.