Exemple #1
0
 private function jsChallenge()
 {
     $Js = new Challenge\JsChallenge($this->client);
     // 如果存在JS挑战验证码且验证通过则加入白名单
     $checkCode = $Js->checkCode();
     // 统计挑战结果
     $checkCodeCountResult = $this->checkCodeCount($checkCode);
     if ($checkCodeCountResult === true) {
         return true;
     } elseif ($checkCodeCountResult === false) {
         header("HTTP/1.0 403 Forbidden");
         exit('Unusual request');
     }
     // 生成验证码
     $verifyCode = $Js->makeVerifyCode();
     Common::Log()->info(__METHOD__, sprintf('Ip[%s] session[%s] start js challenge with code:%s', $this->client['ip'], $this->client['session'], $verifyCode));
     $Js->startChallenge($verifyCode);
     exit;
 }
Exemple #2
0
 private function jsChallenge()
 {
     $Js = new Challenge\JsChallenge($this->client);
     // 如果存在JS挑战验证码且验证通过则加入白名单
     $checkCode = $Js->checkCode();
     // 统计挑战结果
     if ($this->checkCodeCount($checkCode)) {
         return true;
     }
     // 生成验证码
     $verifyCode = $Js->makeVerifyCode();
     Common::Log()->info(__METHOD__, sprintf('Session[%s] start js challenge with code:%s', $this->client['session'], $verifyCode));
     $Js->startChallenge($verifyCode);
     exit;
 }