当前位置: 首页>>代码示例>>PHP>>正文


PHP Captcha类代码示例

本文整理汇总了PHP中Captcha的典型用法代码示例。如果您正苦于以下问题:PHP Captcha类的具体用法?PHP Captcha怎么用?PHP Captcha使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Captcha类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send

 /**
  * Check if the Captcha result is good
  * @return Mixed
  */
 public function send()
 {
     $session = new SessionCaptcha();
     $captcha = new Captcha($session);
     $frontendData = $captcha->getFrontendData();
     if (!$frontendData) {
         return Lang::get('error.captcha.none');
     } else {
         // If an image field name was submitted, try to validate it
         if ($imageAnswer = Input::get($frontendData['imageFieldName'])) {
             if ($captcha->validateImage($imageAnswer)) {
                 // Return false if the result is correct
                 return false;
             } else {
                 return Lang::get('error.captcha.image');
             }
         } else {
             if ($audioAnswer = Input::get($frontendData['audioFieldName'])) {
                 if ($captcha->validateAudio($audioAnswer)) {
                     // Return false if the result is correct
                     return false;
                 } else {
                     return Lang::get('error.captcha.audio');
                 }
             } else {
                 return Lang::get('error.captcha.incomplete');
             }
         }
     }
 }
开发者ID:metrakit,项目名称:visualcaptcha-laravel,代码行数:34,代码来源:CaptchaController.php

示例2: check

 /**
  * Vérifie un email
  * @return object 2 attributs, bool success et array string msg
  */
 private function check()
 {
     $std = (object) array('success' => false, 'msg' => array());
     if (!$_SESSION['user']) {
         if (($res = Membre::checkPseudo($this->pseudo)) !== true) {
             $std->msg[] = $res;
         }
         if (($res = Membre::checkEmail($this->email)) !== true) {
             $std->msg[] = $res;
         }
         $captcha = new Captcha();
         if (($res = $captcha->check($this->captcha)) !== true) {
             $std->msg[] = $res;
         }
     }
     if (($res = $this->checkSujet($this->sujet)) !== true) {
         $std->msg[] = $res;
     }
     if (($res = $this->checkMessage($this->message)) !== true) {
         $std->msg[] = $res;
     }
     if (empty($std->msg)) {
         $std->success = true;
     }
     return $std;
 }
开发者ID:alexdu98,项目名称:technote,代码行数:30,代码来源:Contact.php

示例3: generate_overview

function generate_overview($filecats = '', $offset = '', $subcatID = 0)
{
    global $_language;
    $rubrics = safe_query("SELECT * FROM " . PREFIX . "files_categorys WHERE subcatID = '" . $subcatID . "' ORDER BY name");
    $i = 1;
    $CAPCLASS = new Captcha();
    $CAPCLASS->create_transaction();
    $hash = $CAPCLASS->get_hash();
    while ($ds = mysql_fetch_array($rubrics)) {
        if ($i % 2) {
            $td = 'td1';
        } else {
            $td = 'td2';
        }
        $filecats .= '<tr>
        <td class="' . $td . '">' . $offset . getinput($ds['name']) . '</td>
        <td class="' . $td . '" align="center"><input type="button" onclick="MM_goToURL(\'parent\',\'admincenter.php?site=filecategorys&amp;action=edit&amp;filecatID=' . $ds['filecatID'] . '\');return document.MM_returnValue" value="' . $_language->module['edit'] . '" />
        <input type="button" onclick="MM_confirm(\'' . $_language->module['really_delete'] . '\', \'admincenter.php?site=filecategorys&amp;delete=true&amp;filecatID=' . $ds['filecatID'] . '&amp;captcha_hash=' . $hash . '\')" value="' . $_language->module['delete'] . '" /></td>
    	</tr>';
        $i++;
        if (mysql_num_rows(safe_query("SELECT * FROM " . PREFIX . "files_categorys WHERE subcatID = '" . $ds['filecatID'] . "'"))) {
            $filecats .= generate_overview("", $offset . getinput($ds['name']) . " &raquo; ", $ds['filecatID']);
        }
    }
    return $filecats;
}
开发者ID:hellagent75,项目名称:ign_live,代码行数:26,代码来源:filecategorys.php

示例4: image

 /**
  * @param $session
  */
 function image($session)
 {
     App::import('Vendor', 'Captcha', array('file' => 'captcha' . DS . 'captcha.php'));
     $captcha = new Captcha();
     $captcha->session_var = $this->sessionName . $session;
     $captcha->CreateImage();
 }
开发者ID:roae,项目名称:hello-world,代码行数:10,代码来源:captcha.php

示例5: auth

 function auth()
 {
     if (!valid('janitor_board')) {
         // Admin.php login
         $temp = "" . "<div align='center' vertical-align='middle'>" . ($temp = '<form action="' . PHP_ASELF . '" method="post"><table>' . '<tr><td>Username</td><td><input type="text" name="usernm"  style="width:100%" /></td></tr>' . '<tr><td>Password</td><td><input type="password" name="passwd" style="width:100%" /></td></tr>');
         if (SECURE_LOGIN) {
             if (RECAPTCHA) {
                 $temp .= "<tr><td colspan='2'><script src='//www.google.com/recaptcha/api.js'></script><div class='g-recaptcha' data-sitekey='" . RECAPTCHA_SITEKEY . "'></td></tr>";
             } else {
                 $temp .= "<tr><td><img src='" . CORE_DIR_PUBLIC . "/general/captcha.php' /></td><td><input type='text' name='num' size='20' placeholder='Captcha'></td></tr>";
             }
         }
         $temp .= "<tr><td colspan='2'><input type='submit' value='" . S_MANASUB . "'></td></tr></table>" . "<br></form></div>";
         echo $temp;
         if (isset($_POST['usernm']) && isset($_POST['passwd'])) {
             if (SECURE_LOGIN) {
                 require_once CORE_DIR . '/general/captcha.php';
                 $captcha = new Captcha();
                 if ($captcha->isValid() !== true) {
                     $this->error(S_CAPFAIL);
                 }
             }
             $this->doLogin($_POST['usernm'], $_POST['passwd']);
             echo "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=" . PHP_ASELF_ABS . "\">";
         }
         die("</body></html>");
     }
     return $temp;
 }
开发者ID:ru4chan,项目名称:yotsubato,代码行数:29,代码来源:login.php

示例6: captcha

 public function captcha()
 {
     $this->load->library('captcha');
     $captcha = new Captcha();
     $this->session->data['captcha'] = $captcha->getCode();
     $captcha->showImage();
 }
开发者ID:artlabsdesign,项目名称:missbloom,代码行数:7,代码来源:ULTIMATUMcontactform.php

示例7: captcha

		public function captcha(){
			//获取验证码
			$captcha = new Captcha();
			//修改响应头
			header('Content-type:image/png');
			$captcha->generate();
		}
开发者ID:uhgy,项目名称:phppractice,代码行数:7,代码来源:PrivilegeAction.class.php

示例8: captcha

 /**
  * Genera Img Captcha
  *
  */
 public function captcha()
 {
     Load::lib('captcha/captcha');
     View::select(NULL, NULL);
     $captcha = new Captcha();
     $captcha->run();
 }
开发者ID:KumbiaPHP,项目名称:KuBlog,代码行数:11,代码来源:pages_controller.php

示例9: index

 public function index()
 {
     $c = new Captcha();
     $c->doimg();
     $code = $c->getCode();
     session("myf_code", $code);
 }
开发者ID:Honvid,项目名称:HCMS,代码行数:7,代码来源:CaptchaController.php

示例10: captcha

 public function captcha()
 {
     $this->load->library("captcha");
     $captcha = new Captcha();
     $captcha->size = 6;
     $captcha->session = "captcha";
     $captcha->display();
 }
开发者ID:ultraauchz,项目名称:asean_cultural_mapping,代码行数:8,代码来源:MY_Controller.php

示例11: generateCaptcha

 public function generateCaptcha()
 {
     require_once '../core/Captcha.php';
     $cap = new Captcha();
     $src = $cap->draw_captcha();
     $time = $cap->time;
     print $time . '#' . $src;
 }
开发者ID:olehpitsun,项目名称:duplom.comv2.2.1,代码行数:8,代码来源:ajaxBiaResearchController.php

示例12: checkRegistrationAndActualCountryAfterFailedLogin

 public function checkRegistrationAndActualCountryAfterFailedLogin(Captcha $captcha, User $user, $loginCountry)
 {
     $registrationCountry = $user->getRegistrationCountry();
     if ($registrationCountry != $loginCountry) {
         $captcha->setCaptchaStatus(true);
     }
     return $captcha->getCaptchaStatus();
 }
开发者ID:juhaszjt,项目名称:tdd-training,代码行数:8,代码来源:Login.php

示例13: captcha

function captcha($pattern, $left, $operator, $right)
{
    if ($pattern < 1 or $pattern > 2 or ($operator < 1 or $operator > 3)) {
        return "You shouldn't do this to me :(" . "\n";
    }
    $captcha = new Captcha($pattern, $left, $operator, $right);
    return $captcha->toString();
}
开发者ID:kintawamaiyo,项目名称:PhpSkeleton,代码行数:8,代码来源:captcha.php

示例14: buildCaptcha

 function buildCaptcha()
 {
     $pattern = $this->randomizer->pattern();
     $left = $this->randomizer->operand();
     $operator = $this->randomizer->operator();
     $right = $this->randomizer->operand();
     $captcha = new Captcha($pattern, $left, $operator, $right);
     return $captcha->toString();
 }
开发者ID:kintawamaiyo,项目名称:PhpSkeleton,代码行数:9,代码来源:CaptchaController.php

示例15: getCaptcha

 public function getCaptcha()
 {
     $width = Input::get('w', 100);
     $height = Input::get('h', 25);
     $letters = Input::get('letters', 4);
     $cpa = new Captcha($width, $height, $letters);
     header("Content-Type: image/png");
     return $cpa->createImage();
 }
开发者ID:kettanyam,项目名称:20141001done,代码行数:9,代码来源:CaptchaController.php


注:本文中的Captcha类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。