Welcome to WebmasterWorld Guest from 23.20.179.211

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP / MySQL Sessions for Multiple Logged In Users

having an issue with sessions being overwritten when multiple users log in

     
4:02 pm on Sep 2, 2009 (gmt 0)

New User

10+ Year Member

joined:Dec 9, 2006
posts: 6
votes: 0


Hello,

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.

Thanks,
Jonathan

6:19 pm on Sept 2, 2009 (gmt 0)

New User

5+ Year Member

joined:Mar 17, 2009
posts:27
votes: 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.

Cheers
Su

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members