
1.
2.
如果条件=' $ GLOBALS['用户信息'][' user _ id ']gt 0 ' span class=' help _ wz ' a href=' { $ Think。配置。VIP _ URL }/Member/user _ pwd/' style=' color : # 404958;'找回登录密码/a/span else/span class=' help _ wz ' a href='/log in/find pwd ' style=' color : # 404958;'找回登录密码/a/span/if3 .后台设置全局变量并查询用户信息
公共函数UserInfo($user_id){//查询系统信息$system=array('CmdId'='System ',' Token'='wap ',' post details '=JSON _ encode(array())));//通过卷曲的邮政方式发送接口请求$ curl=新的curl控制器();$ strs=$ curl-SendCull($ 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 ')、time() 3600、'/'、C(' cookie _ URL ');$ data=array(' CmdId '=' Individual ',' Token'=session('token '),' PostDetails '=JSON _ encode(array(' user _ id '=$ user _ id,)));//通过卷曲的邮政方式发送接口请求$ curl=新的curl控制器();$ str=$ curl-SendCull($ data);$ GLOBALS['用户信息']=$ str[' AcctDetails '];$ newtonken=unserialize($ str[' AcctDetails '][' token ']);$ oldtoken=未序列化(会话(“token”));if(!空(会话('令牌'))!空($ str[' AcctDetails '][' token ']){//用户不对if($ Newton ken[' user _ id ']!==$ newtonken[' user _ id ']){ session(' token ',null);会话(“user_id”,null);标题(“位置:/登录/登录”);返回false}//令牌不对if($ Newton ken [' time ']!==$ old token[' time ']){ session(' token ',null);会话(“user_id”,null);标题(“位置:/登录/登录”);返回false}//超时的不能在这做,原因是存入会议的值不变,如果用户一直操作的话,而且只登陆一次,那么就会出现问题}返回真}以上所述是小编给大家介绍的服务器端编程语言(专业超文本预处理器的缩写)判断用户是否已经登录(跳转到不同页面或者执行不同动作),希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对我们网站的支持!