<?php //检测是否登录,若没登录则转向登录界面 if (isset($_COOKIE['PHPSESSID']) || $_COOKIE['PHPSESSID'] != '') { // 查询session login数据 $PHPSESSID = $_COOKIE['PHPSESSID']; $sessionLogin = new \Ss\User\SessionLogin($PHPSESSID); $loginSessionData = $sessionLogin->GetSessArray(); $uid = $loginSessionData['uid']; $user_email = $loginSessionData['user_email']; $user_pwd = $loginSessionData['user_pwd']; //co // $uid = $_COOKIE['uid']; // $user_email = $_COOKIE['user_email']; // $user_pwd = $_COOKIE['user_pwd']; $U = new \Ss\User\UserInfo($uid); //验证cookie $pwd = $U->GetPasswd(); $pw = \Ss\User\Comm::CoPW($pwd); if ($pw != $user_pwd) { header("Location:login.php"); } if (!$U->isAdmin()) { header("Location:../user/index.php"); } } else { header("Location:login.php"); exit; } $oo = new Ss\User\Ss($uid);
} elseif (strlen($name) < 7) { $a['msg'] = "用户名太短"; } elseif ($c->IsUsernameUsed($name)) { $a['msg'] = "用户名已经被使用"; } else { // get value $ref_by = $code->GetCodeUser(); $passwd = \Ss\User\Comm::SsPW($passwd); $plan = "A"; $transfer = $a_transfer; $invite_num = rand($user_invite_min, $user_invite_max); //do reg $reg = new \Ss\User\Reg(); $reg->Reg($name, $email, $passwd, $plan, $transfer, $invite_num, $ref_by); $code->Del(); //实现注册成功自动跳转的逻辑 add by chenjinlong 20150721 //获取用户id $q = new \Ss\User\Query(); $id = $q->GetUidByEmail($email); //处理密码 $pw = \Ss\User\Comm::CoPW($passwd); // 新增session login逻辑 $PHPSESSID = $_COOKIE['PHPSESSID']; $sessionLogin = new \Ss\User\SessionLogin($PHPSESSID); $sessionLogin->AddSessionArray($id, $email, $pw); $a['ok'] = '2'; $a['msg'] = "注册成功,自动跳转到用户中心"; // $a['ok'] = '1'; // $a['msg'] = "注册成功"; } echo json_encode($a);
<?php require_once '../lib/config.php'; session_start(); //setcookie("user_name", "", time()-3600); //setcookie("user_pwd", "", time()-3600); //setcookie("uid", "", time()-3600); //setcookie("user_email", "", time()-3600); //删除登录session login信息 $PHPSESSID = $_COOKIE['PHPSESSID']; $sessionLogin = new \Ss\User\SessionLogin($PHPSESSID); $sessionLogin->DelSessionArray(); header("Location:../index.php"); exit;