PHP将密码存储在Cookie中 [英] PHP storing password in cookie

查看:134
本文介绍了PHP将密码存储在Cookie中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种相对安全的方式将密码存储在cookie中的浏览器cookie(用于记住登录信息)中,而无需为数据库中的哈希创建额外的列? 谢谢.

Is there a relatively secure way to store the password in the browser cookie (for remembering the login information) in the cookie without creating an extra column for hash in database? Thanks.

推荐答案

在cookie中存储密码的哈希值

Store a salted hash of the password in the cookie

$salt = 'snfcikkfbnvekrew';
$cookie_value = md5($salt . $password);

这篇关于PHP将密码存储在Cookie中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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