Asean Jazz
Asean Jazz

Reputation: 125

PHP Session In 2 Web Application

I have 2 web application in my Notebook, now every I want to logout from one application, another application that still logged in will logout too.

In my App1, I using session :

session_start();
$session = $_SESSION['username_a'];

and in App2 :

session_start();
$session = $_SESSION['username_packing'];

Finally the logout PHP code like this :

session_destroy();

The condition : If I was logged in with 2 Application and then I logout 1 application, another 1 application will logout too.

My question is : Is there anyway to prevent that (If log out 1 application, then another application will stay logged in)?

Upvotes: 0

Views: 51

Answers (1)

wpsidi
wpsidi

Reputation: 119

Session_destroy will destroy all session. You should unset specific session. Like this:

unset($_SESSION['username_a']); // on App 1

and

unset($_SESSION['username_packing']); // on App2 

Upvotes: 1

Related Questions