Problem with $ _SESSION

I have one web server (IIS) and I have two folders: website1and website2, with two separate copies of the same webapp. After I enter one of them, let's say mylocalip/website1I start the session pretty standard:

$_SESSION["user_id"] = x;

This works great on my website. However, if I go to mylocalip/website2, I will still be logged in. Oddly enough, if I go to mypublicip/website2, I have not logged in.

My question is: why am I observing this behavior?

Thanks and best regards.

+3
source share
3 answers

Session . IP-, . , Session.

, IP-, cookie IP- , .

+2

PHP . .

, , . IP-, , .

+2

Try using session_set_cookie () and set the parameter pathto /website1.

+1
source

All Articles