开发者

php sessions appear in other directories

I have some folders in my server where i have several scripts which use sessions for several actions.

For example my admin panel on folder1 has a session called adm_sess which tells me if i am logged in or not.

Then when i go to folder2 which has nothing to do with the previous script, and i do

print_r($_SESSION);

i see that session(adm_sess) and that causes my server sessions to interact with other sessions created in other folders and change them dynamically.

Why does that happens a开发者_JAVA百科nd how can i make the sessions on each folder be active only within that directory?


use session_name();

before

session_start(); 

call

session_name("first");
session_start(); 

and for second

session_name("second");
session_start(); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜