Page 1 of 1
Sessions mixing up?
Posted: Mon Dec 10, 2007 12:13 am
by xterra
My site requires user to login. Say you log in as "John". Then you open up another window, and login as "Sarah". If you switch over to "John", now it's got Sarah's information! You can't gaurentee "John" will log out before Sarah uses it, so how do I keep them seperate?
Thanks very much.
Posted: Mon Dec 10, 2007 1:07 am
by jmut
I guess you're using sessions. By default cookies are used to store session identifier...Put in other way per one domain a single identifier...
1. I suggest you don't allow people login with different user/pass and working simultanuously (if they want to....just will run two separate browsers)
2. If you still want to make it using different names at same tim...well you should change logic into storing user specific stuff in session, if you use $_SESSION['user_id'] That will perhaps be changed to $_SESSION['users']['id_1'] $_SESSION['users']['id_2'] etc etc...and have logic to trace per user basis ...but it is highly unlikely you want this behaviour.
Posted: Mon Dec 10, 2007 1:46 am
by xterra
Thanks. I think I may have found a way around this. What do you think?
I made it so when you go to the site, if it detects session, it will go straight to user's control panel. If you want to go to another username, you must log out.
Posted: Mon Dec 10, 2007 4:18 am
by jmut
See where you mixed it up

Basically this
Then you open up another window, and login as "Sarah"
should not happen...you should make simple check if user is already logged...this should be just redirect to control panel or whatever. Not showing the user/pass login form again.
Posted: Mon Dec 10, 2007 3:30 pm
by xterra
Thanks brother.