微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

判断用户是否已经登录跳转到不同页面或者执行不同动作

1.

2.

<fig.VIP_URL}/Member/user_pwd/"找回登录密码 <找回登录密码

3.后台设置全局变量查询用户信息

'System','Token'=>'wap','PostDetails'=>json_encode(array( ))); //通过curl的post方式发送接口请求 $curl=new CurlController(); $strs=$curl->SendCurl($system); $GLOBALS['system']=$strs['AcctDetails']; if(empty($user_id)){ return false; } setcookie("login_uid",$user_id,time() + 3600,"/",C('cookie_url')); setcookie("rdun",$this->authcode($user_id . "," . time(),"ENCODE"),C('cookie_url'));; $data=array( 'CmdId'=>'Individual','Token'=>session('token'),'PostDetails'=>json_encode(array( 'user_id'=>$user_id,))); //通过curl的post方式发送接口请求 $curl=new CurlController(); $str=$curl->SendCurl($data);
    $GLOBALS['userinfo']=$str['AcctDetails'];
    $newtoken=unserialize($str['AcctDetails']['token']);
    $oldtoken=unserialize(session('token'));
    if(!empty(session('token')) &amp;&amp; !empty($str['AcctDetails']['token'])){
        //<a href="https://www.jb51.cc/tag/yonghu/" target="_blank" class="keywords">用户</a>不对
        if($newtoken['user_id'] !== $newtoken['user_id']){
            session('token',null);
            session('user_id',null);
            header('Location:/Login/Login');
            return false;
        }
        //token不对
        if($newtoken['time'] !== $oldtoken['time']){
            session('token',null);
            header('Location:/Login/Login');
            return false;
        }
        //超时的不能<a href="https://www.jb51.cc/tag/zaizhe/" target="_blank" class="keywords">在这</a>做,原因是存入session的值不变,如果<a href="https://www.jb51.cc/tag/yonghu/" target="_blank" class="keywords">用户</a>一直操作的话,而且只登陆一次,那么就会出现问题
    }
    return true;
}</span></pre>

4.后台调用方法

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐