龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

PHP 对用户登录信息 Cookie 进行验证

时间:2014-07-22 14:52来源: 作者: 点击:
分享到:
<无详细内容>
<?php
unset($username);
if ($_COOKIE['login']) {
    list($c_username,$cookie_hash) = split(',',$_COOKIE['login']);
    if (md5($c_username.$secret_word) == $cookie_hash) {
        $username = $c_username;
    } else {
        print "You have sent a bad cookie.";
    }
}

if ($username) {
    print "欢迎, $username.";
} else {
    print "欢迎, 游客.";
}
?>
精彩图集

赞助商链接