smf论坛用户登录整合cookie机制分析

smf论坛用户登录会生成这样的cookie
SMFCookie232值为a:4:{i:0;s:4:”4719″;i:1;s:40:”7b40480a80bd7c0bbbcd199bf7eea51eefedda35″;i:2;i:1336374691;i:3;i:0;}
对比其他用户
SMFCookie123值为a:4:{i:0;s:4:”4708″;i:1;s:40:”ec5438dc912b96b9266119f338d6b9f2c0adfb9c”;i:2;i:1336379167;i:3;i:0;}
测试代码
$id = "4708";   //用户ID
$f = "d593d21b1c9c4e8f12b3ecb696764accc60dec39" . "9958";  //前面的字符串是sha1($user.$passwd),后面的是用户表中password_salt字段
$password = sha1($f); //再进行一次sha1处理
$cookie_length = "";
$cookie_state = 0;
$data = serialize(empty($id) ? array(0, '', 0) : array($id, $password, time() + $cookie_length, $cookie_state)); //用 serialize函数生成序列化的字符串
echo $data;
echo "<br>";
echo 'a:4:{i:0;s:4:"4708";i:1;s:40:"ec5438dc912b96b9266119f338d6b9f2c0adfb9c";i:2;i:1525577109;i:3;i:0;}';
© 版权声明
THE END
喜欢就支持以下吧
点赞0 分享