Jump to content

something about sessions


MarioApprentice

Recommended Posts

Hello everybody.

 

I have a website where users can login and register. When a existing user logs in, his data (name, surname, age etc...) is saved in an object that is then saved in a session called $_SESSION['user']. I've tested it with one user logged in at a time, but not with multiple users logged in, in the same moment.

 

What will happen if 5 people gets logged in the same moment? Will the $_SESSION['user'] be overwritten with the data from the last user logged in or does php keeps track of the concurent sessions and can distinguish one from another?

 

I think that it can beacuse of unique session id that is stored in a cookie but google searches were somewhat vague and i couldn't find a clear answer.

 

Thank you for your answers.

Link to comment
Share on other sites

I do believe that $_SESSION actually saves to the users browser session, so they will only ever have their own user data. 

 

I could be wrong, but that's what I've always assumed..

 

Edit: Just saw your reply. It's not stupid to ask a question if you're unsure. How else will you ever be certain about the answer? :)

Edited by denno020
Link to comment
Share on other sites

my knowledge about php sessions is at not at proffesional level, but php sessions have a unique id from which php can distinguish them from other concurent sessions. i didn't even need google for this beacuse it makes sense on its on. that is why i'm stupid. but hey, if you think i'm not stupid, call me a genius :tease-01:

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.