Exemplo n.º 1
0
 /**
  * 登录验证
  *
  * @param string $username
  * @param string $password
  * @param string $code_location
  * @param string $code_value
  * @return array|string
  */
 function checkAdmin($username, $password, $code_location = '', $code_value = '')
 {
     $SEC = new SecurityModule();
     try {
         $user_info = $this->link->get($this->t_admin, '*', array('name' => $username));
     } catch (Exception $e) {
         return $this->result(100006);
     }
     if ($user_info['t'] != 1) {
         return $this->result(100001);
     }
     if ($user_info && !empty($user_info["password"])) {
         $user_password = sha1(md5($password));
         $is_bind = $SEC->checkbind($username);
         if ($is_bind) {
             if (empty($code_location) || empty($code_value)) {
                 return $this->result(100004);
             }
             $verify_right = $SEC->verifyCode($username, $code_location, $code_value);
             if (!$verify_right) {
                 return $this->result(100005);
             }
         }
         if ($user_password === $user_info["password"]) {
             return $this->result(1);
         }
         return $this->result(100003);
     }
     return $this->result(100002);
 }
Exemplo n.º 2
0
 /**
  * 登录入口
  */
 function login()
 {
     $data['status'] = 1;
     if ($this->is_post()) {
         if (isset($_POST['user']) && isset($_POST['pwd']) && isset($_POST['v']) && isset($_POST['vv'])) {
             $check_ret = $this->ADMIN->checkAdmin($_POST['user'], $_POST['pwd'], $_POST['v'], $_POST['vv']);
             if ($check_ret['status'] == 1) {
                 $_SESSION['u'] = $_POST['user'];
                 $this->to("panel");
             } else {
                 $data['status'] = $check_ret['status'];
             }
         } else {
             $data['status'] = 10001;
         }
     }
     //生成安全码
     $data['v'] = $this->SEC->shuffleLocation();
     $this->display($data);
 }
Exemplo n.º 3
0
 /**
  * 创建用户存储密保卡的表
  */
 function create()
 {
     $data = $this->SEC->createTable();
     $this->display($data);
 }