Login and session variables

Hi,

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:

if(!isset($_SESSION['userid'])){
    // session not logged
}else{
    // 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.

Thanks

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.

Brilliant - thanks

If I was testing 2 applications in sub folders of the same domain name:

www.website.com/applicationA
www.website.com/applicationB

Am I correct in thinking that this would cause a conflict?

Cheers

No, as long as the session is set within a different URL they won’t conflict.