除了IP之外,还有其他方法可以确定网站用户吗?
在我的网站中,我需要记住输入的用户,以便下次输入时我会向他们显示他们之前检查过的内容。 最简单的方法是检查IP,但是如果有代理就会出现问题。我不想在客户端运行任何java脚本来获取他们的IP。 有什么办法可以确定用户吗? 我知道配置文件 - 登录也可以,但我不想这样做。
提前致谢, 马雷克。
In my website i need to remember users that entered so next time thay enter i will show them content they were checking before.
Simplest way is IP check, but problem appears if there is a proxy. I dont want to run any java scripts on client side to get their ip.
Is there any way to determine user?
I know that also profiles - login would do, but i dont want to do so.
Thanks in advance,
Marek.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您可以设置一个持久性 cookie,但这只会保留给特定的浏览器。 (他们可以清除他们的cookie)
最可靠的方法是让您的用户使用用户名和密码登录 - 然后您可以将特定于他们的详细信息保留在数据库中并修改网站的行为,就像您下次登录时提到的那样。但是,此选项不适用于匿名访问者。
You could set a persistent cookie, but that will just remain for that specific browser. (and they could clear their cookies)
The most reliable way is to have your users log in with a username and password - then you can keep details specific to them in a database and modify the site's behaviour like you mention next time they log in. However, this option doesn't work for anonymous visitors.
考虑设置一个 Cookie,您随后可以读取它并定制内容。
Consider setting a Cookie, which you can subsequently read and tailor content.
Cookie 是您想要使用的。
Cookies are what you want to use.
记住用户的标准方法是设置 cookie。 IP完全无效,因为很多客户都有动态IP地址,更不用说NAT了。设置 cookie 的方式取决于您所使用的服务器语言。
The standard way to remember users is setting a cookie. IP is totally ineffective, because many customery have dynamic IP addresses, let alone NAT. The way to set a cookie depends on the server language you are using.
使用 cookie 可以识别每台计算机的每个浏览器的用户。
Using a cookie could identify the user per browser per computer.
Marek,默认情况下我的建议是使用 cookie。也许在用户登录后在cookie中记录一些ID并用它来显示自定义内容。
当然,用户始终可以删除 cookie(或将它们全部禁用),但对于这种需求来说,这是一个很好的解决方案。
Marek, by default my recomendation would be to use cookies. Maybe record some ID in the cookie after the user loged in and use it to display custom content.
Of course the user can always delete the cookie (or disable them all together), but it is a good solution for this kind of requirement.