homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

PHP / MySQL Sessions for Multiple Logged In Users
having an issue with sessions being overwritten when multiple users log in

5+ Year Member

Msg#: 3982736 posted 4:02 pm on Sep 2, 2009 (gmt 0)


Currently, I have a class that tells PHP to use MySQL to manage the session data. Users who wish to log in enter their username and password, and if there is a match the class encrypts the user's email and puts it into the session table (the data row) along with an ID that it generates (in the ID row).

The problem is that, if I log in with one user, and then go to a different browser or computer and log in with another user, the first user's session is overwritten by that of the second user.

I've run into this issue before, but I can't for the life of me find any code saved, or anything in search results, that can help me create a new row for the additional users, rather than only holding one row in the database.

Any ideas would be most appreciated.




5+ Year Member

Msg#: 3982736 posted 6:19 pm on Sep 2, 2009 (gmt 0)

Hi Jonathan,

Look for session_set_save_handler function in your code. This is the function that decides which function to use to write the session information. PEAR package has a nice session handler. PEAR website > documentation > English > HTTP > HTTP_Session2 > api documentation on right side of the page > HTTP_Session2_container on left > scroll down to method "set".

Hope this will send you in right direction.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved