peterjunsworth — 2011-04-05T19:38:45-04:00 — #1
I am slowly teaching myself the basics of PHP and have a quick question that I am sure will be obvious but would appreciate the feedback.
I am creating a test photo gallery application where a user has to log in to upload images.
I am using sessions to check whether the user is logged in or not. My question is:
If I have this code:
// session not logged
// session logged
What happens if I have 2 different applications open in my browser and both use $_SESSION['userid'] to check login status?
If I am logged in to 1 of the application won't that mean that it would register me as logged in in the other application.
Please excuse my ignorance.
chris_upjohn — 2011-04-06T00:02:08-04:00 — #2
Sessions are based on whatever page your visiting so for example if i visited both www.websitea.com and www.websiteb.com and they both used a session called userid they wouldn't conflict as the session only gets set for that specific URL.
Hope that clears it up.
peterjunsworth — 2011-04-06T00:07:26-04:00 — #3
Brilliant - thanks
If I was testing 2 applications in sub folders of the same domain name:
Am I correct in thinking that this would cause a conflict?
chris_upjohn — 2011-04-06T02:59:34-04:00 — #4
No, as long as the session is set within a different URL they won't conflict.