I have two totally different applications. They are all using session variables to authenticate users. When a user visit these two applications at the same time, if he logs out in one application, he will also be logged out automatically for the other one. Since the application's logout php script is:
session_start();
session_destroy();
$_SESSION=array();
So, logging out in one application will actually destory all the session variable. Also, if they both authenticate a user based on checking session variable session['username'], when you login in one application, you actually logged in both.
How can I make this work?
Two application using the same session variables
Moderator: General Moderators
-
yueliu_32214
- Forum Newbie
- Posts: 2
- Joined: Wed Apr 19, 2006 3:38 pm
-
yueliu_32214
- Forum Newbie
- Posts: 2
- Joined: Wed Apr 19, 2006 3:38 pm
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Just namespace the data in the session:
Code: Select all
$_SESSION['app1']['username']
$_SESSION['app2']['username'](#10850)