public function sigOut()
 {
     Log::signInOut(2, session('userID'));
     //记录退出日志
     Qita::dropSessionCookie();
     $this->ajaxReturn(["zhuangtai" => 1, "tishi" => "退出成功"]);
 }
Exemple #2
0
 public static function signUp($userMail, $userPass)
 {
     $array['userMail'] = $userMail;
     $array['userPass'] = $userPass;
     $array = Verif::trimArray($array);
     //检测mail
     if (!Verif::mail($array['userMail'])) {
         return array('zhuangtai' => false, 'tishi' => 'Email格式不对');
     } else {
         if (!Verif::pass($array['userPass'])) {
             return array('zhuangtai' => false, 'tishi' => '密码不能小于6位大于16位');
         }
     }
     //验证改email是否已经注册过
     $rs = Db::dbfindOne('User', array('email' => $array['userMail']));
     if ($rs) {
         //echo "email已存在\n";
         return array('zhuangtai' => false, 'tishi' => 'email已存在');
     } else {
         //在 user 表里 写入 mail
         $findUserID = Db::dbSave('User', array('email' => $array['userMail'], 'pass' => md5($array['userPass']), 'time_int' => time()));
         Qita::setSessionCookie($findUserID);
         Log::signInOut(1, $findUserID);
         //获取用户信息
         $userData = Qita::findUser($findUserID);
         cookie('userData', json_encode($userData), 604800);
         return array('zhuangtai' => true, 'tishi' => '注册完成', 'data' => $userData);
     }
 }