Jump to content

Is there a difference between killing and destroying sessions?


webmaster1

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.