示例#1
0
 public function missionsAction()
 {
     $this->users->needLogin();
     $this->template->setView("missions");
     $this->template->loadLanguage("board");
     $user = $this->users->get($_SESSION['user']['user_id']);
     $this->template->missions = $this->missions->get($user);
     $generate = captchme_generate_html(CAPTCHME_PUBLIC);
     $this->template->captchme_generate = $this->template->language['captchme_already_voted'];
     $time = $this->users->getValueConfig($user, 'vote_captchme');
     $this->template->diff = $time - time();
     $this->template->diff_p = 100 - ($time - time()) * 100 / (2 * HOUR);
     if (!$time || $time - time() <= 0) {
         $this->template->captchme_generate = $generate;
     }
     if (isset($_POST["captchme_response_field"])) {
         $remoteIp = $_SERVER['REMOTE_ADDR'];
         $resp = captchme_verify(CAPTCHME_PRIVATE, $_POST["captchme_challenge_field"], $_POST["captchme_response_field"], $remoteIp, CAPTCHME_AUTH);
         if (!$resp->is_valid) {
             $this->template->redirect($this->template->language['check_captcha_fail'], TRUE, "SELF");
         }
         if ($resp->is_valid && ($time === FALSE || $time - time() <= 0)) {
             $this->users->addDBGolds($user, 1);
             $this->users->setValueConfig($user, "vote_captchme", time() + 2 * HOUR);
         }
     }
 }
示例#2
0
 public function lostpasswordAction()
 {
     $this->template->loadLanguage("index");
     $this->template->setView("lostPassword");
     $this->template->generate = captchme_generate_html(CAPTCHME_PUBLIC);
     if (isset($_POST['email'])) {
         $email = $_POST['email'];
         if (isset($_POST["captchme_response_field"])) {
             $remoteIp = $_SERVER['REMOTE_ADDR'];
             $resp = captchme_verify(CAPTCHME_PRIVATE, $_POST["captchme_challenge_field"], $_POST["captchme_response_field"], $remoteIp, CAPTCHME_AUTH);
             if (!$resp->is_valid) {
                 $this->template->redirect($this->template->language['check_captcha_fail'], TRUE, "SELF");
             }
             if ($resp->is_valid && ($time === FALSE || $time - time() <= 0)) {
                 if ($this->users->lostPassword($email)) {
                     $this->template->redirect($this->template->language['lostpassword_successfull'], FALSE, "/index/index");
                 }
                 $this->template->redirect($this->template->language['email_unknown'], TRUE, "SELF");
             }
         }
     }
 }
示例#3
0
 protected function _captchme($get_api = false)
 {
     require_once $this->fw->get('ROOT') . '/captcha_lib/captchme-lib.php';
     if (!$get_api) {
         $captcha = captchme_generate_html($this->site_settings['faucet_captchme_public_key'], null, $ssl = $this->is_ssl());
         return $captcha;
         //bail early
     }
     $this->resp = captchme_verify($this->site_settings['faucet_captchme_private_key'], $this->fw->get('POST.captchme_challenge_field'), $this->fw->get('POST.captchme_response_field'), $this->fw->get('IP'), $this->site_settings['faucet_captchme_authentication_key']);
     return $this->resp->is_valid;
 }