示例#1
0
 /**
  *  验证码验证
  * @param $code  验证码字符
  * @param string $id 唯一标识
  * @return bool
  */
 public function check($code, $id = 'captcha')
 {
     $key = $this->authcode($this->keySet) . $id;
     $secode = Session::get($key);
     $now_time = time();
     # 验证码不能为空
     if (empty($code) || empty($secode)) {
         return false;
     }
     # session 过期
     if ($now_time - $secode['verify_time'] > $this->expire) {
         Session::delete($key);
         return false;
     }
     # 验证码是否相同
     if ($this->authcode($code) == $secode['verify_code']) {
         $this->reset && Session::delete($key);
         return true;
     }
     return false;
 }
示例#2
0
 /**
  *清空认证信息
  */
 public function clear()
 {
     \session\Session::delete($this->namesapce);
 }
示例#3
0
 public function getError()
 {
     $errors = Session::get('errors');
     Session::delete('errors');
     return $errors ? $errors : array();
 }