Jump to content

Destroy One Session, But Keep Other One


Recommended Posts

I use sessions for a shopping cart and for a dedicated user area on same website. On logout page of dedicated user area I have:

$_SESSION = array(); // destroy the variables	session_destroy(); // destroy the session itself	setcookie (session_name(), '', time()-300, '/', '', 0); // destroy the cookie

As this destroys all session data this is not what I want. I want only to destroy the session data relevant to dedicated user area. I use $_SESSION['first_name'] for login/logout status of user area and $_SESSION['cart'] for shopping basket. How do I only destroy first_name?Son

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...