会话,Cookies或两者兼而有之? [英] Sessions, Cookies or both?

查看:78
本文介绍了会话,Cookies或两者兼而有之?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我差不多完成了一个脚本,目前所有用户都在使用预设用户并通过。目前我正在使用会话,但我希望访客能够在不使用用户的情况下访问该网站并传递一般公共页面。


最佳推荐是什么?


该软件适用于露营地和B和B预订。

I am almost finished with a script and currently all users are using a preset user and pass. Currently I am using sessions but I want guests to be able to come to the site without using a user and pass for the general public pages.

What is the best recommendation?

The software is for campground and B and B reservations.

推荐答案


我差不多完成了一个脚本,目前所有用户都在使用预设用户并通过。目前我正在使用会话,但我希望访客能够在不使用用户的情况下访问该网站并传递一般公共页面。


什么是最佳推荐?


该软件适用于露营地和B和B预订。
I am almost finished with a script and currently all users are using a preset user and pass. Currently I am using sessions but I want guests to be able to come to the site without using a user and pass for the general public pages.

What is the best recommendation?

The software is for campground and B and B reservations.



为自己省去一些麻烦并构建一个每个页面都继承的抽象类。将安全性构建为抽象,每个页面自动检查安全性,除非继承类重写。这样可以避免让您不小心让人们​​进入页面,因为您忘记申请安全性。

Save yourself some hassle and build an abstract class that every page inherits. Build your security into the abstract that way every page automatically checks security UNLESS the inheriting class overrides. This will save you from accidentally letting people get into pages here and there because you forgot to apply to the security.


Cookies - 存储在您的系统中。


session - 一旦关闭浏览器会话值过期就将值设为全局
Cookies - stored in your system permenently .

session - stord the value global once close the browser session value expired


我同意b1randon:最好这样做更多结构化的方式,然后只是在饼干和会话变量之间跳跃。

b1randon :你能否建议一个解决方案的方法?


Ronald:很酷:
I agree with b1randon: it is better to do this in a more structured way then just ''hopping'' between cookies and session variables.

b1randon: can you also suggest an approach towards a solution?

Ronald :cool:


这篇关于会话,Cookies或两者兼而有之?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆