简体   繁体   English

是否存在唯一浏览器$ _SESSION id这样的东西?

[英]Is there such a thing as a unique browser $_SESSION id?

I am working on add to favorites add-on (where posts will be added to favorites by signed in users), but then I saw that craigslist lets anyone add favorites without them being signed in. How do they do that? 我正在研究“添加到收藏夹”加载项(通过登录用户将帖子添加到收藏夹),但是随后我看到craigslist允许任何人添加收藏夹而无需登录。他们如何做到这一点? Is there a unique $_SESSION id for a browser? 浏览器是否有唯一的$ _SESSION ID? Sorry if it's a silly question. 抱歉,这是一个愚蠢的问题。

As an example: http://orlando.craigslist.org/search/jjj (Click on any star to add to favorites. May not be available in IE 11). 例如: http : //orlando.craigslist.org/search/jjj (单击任何星号以添加到收藏夹。在IE 11中可能不可用)。

他们只是在使用一个会话,您应该可以通过查看它们存储在计算机上的cookie来进行检查。

Everything in $_SESSION persist only for the current session. $ _SESSION中的所有内容仅在当前会话中持续存在。 If the users closes the browser and reopen it a new session is generated. 如果用户关闭浏览器并重新打开,则会生成一个新会话。 So $_SESSION is not the right place for your answer. 因此,$ _ SESSION不是您答案的正确位置。

There is $_ENV where you can get the clients ip address and general browser data from. 在$ _ENV中,您可以从中获取客户端的IP地址和常规浏览器数据。 In most cases this is enough to identify a single user. 在大多数情况下,这足以标识一个用户。 If you keep track of these data you can prevent users from giving multiple votes. 如果您跟踪这些数据,则可以防止用户投票。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM