是否可以阻止来自不同文件夹的php会话

时间:2015-06-25 15:39:12

标签: php session

我有类似的文件结构,我使用$_SESSION['userID']来跟踪登录的人:

Main Index (a hub for all my websites)
|
|--/_lm/index.html (website 2)
|
|--/_da/index.html (website 3)
|
|--/_vm/index.html (website 4)

我发现,一旦有人登录,例如website 2 - 他们的$_SESSION['userID']将会转移到其他网站。

最好的办法是什么?有没有办法将限制会话数据到某个文件夹?

1 个答案:

答案 0 :(得分:0)

不要使用$ _SESSION ['userID']来验证每个会话。一旦你设置了它,它就可以在网站上运行。

所以试试这个

网站1会议

$_SESSION['userID1']

网站2会议

$_SESSION['userID2']

网站3会议

$_SESSION['userID3']

网站4会议

$_SESSION['userID4']