I have a page called mypage.php when i store users profiles with a $_GET variable(id) like mypage.php?id=1 or ?id=2 etc...
when i log in and i am id=1, when i go to id=2 i get this user's ID as my session, and i dont have any variable to set my session this user's when i go to this profile..
i only set to the user the session user_id as the user id when logged in... like
$_SESSION["user_id"] = 1;//fetched via the user login details
it automatically does that...
Also when i do an ajax request my sessions get lost with no reason...
this happens on LIVE server but not on localhost.
EDIT: i noticed that my sessions get mixed up within the server folders, i have 2 apps using the same session to store the logged in user ID(user_id is the session name), so when i log in on first app and go to 2nd i appear as logged in even if i am not registered)... so why this happens?
Before you call session_start()
, call session_name() in order to set a unique name for each application's session.