通过设置cookie记住密码
在我的页面中,我有一个“记住我”复选框。当我检查这个时,我想在浏览器 cookie 中设置我的密码。是否可以? 我提供的声明如下:
if ($remember=='yes') {
$this->load->helper('cookie');
$cookie =array(
'name' => 'username',
'value' => $username,
'expire' => '1209600'
);
$this->input->set_cookie($cookie);
}
In my page I have one Remember Me checkbox. When I check this, I want to se my password in browser cookie. Is it possible?
I have provided the statement as:
if ($remember=='yes') {
$this->load->helper('cookie');
$cookie =array(
'name' => 'username',
'value' => $username,
'expire' => '1209600'
);
$this->input->set_cookie($cookie);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
永远不要在 cookie 中存储未加密的密码的原因是,在这种情况下,cookie 盗窃将提供永久访问权限。如果您存储散列版本,那么只要 cookie 有效,就有可能冒充用户,但一旦 cookie 失效,攻击者将无法再次登录。
简而言之:永远不要在客户端浏览器中存储纯文本信息,始终对密码和用户名使用(可能是加盐和/或签名的)哈希值。
The reason why you should never store an unencrypted password in a cookie is that cookie theft in that case will provide permanent access. If you store hashed version, then it might be possible to impersonate a user as long as the cookie is valid, but the attacker won't have any way to log back in again once that cookie is invalidated.
In short: never store plain text informations in the client's browser, always use (possibly salted and/or signed) hashes both for passwords and usernames.
是的,
请查看此网站,在 PHP 中使用 Cookie - 用户登录
Yes,
check out this site, Using Cookies in PHP - User Logon
是的,这是可能的..您可以通过设置
cookie
来记住您的密码观看此视频
ya it is posible .. u can remember your password by setting
cookie
See this videos