• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Captcha类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: captcha

 function captcha()
 {
     $this->load->library('captcha');
     $captcha = new Captcha();
     $captcha->size = 4;
     $captcha->chars = '0123456789';
     $captcha->session = "captcha";
     $captcha->display();
 }
开发者ID:unisexx,项目名称:adf16,代码行数:9,代码来源:Master_Controller.php


示例17: execute

 public function execute(&$value, &$error)
 {
     $g = new Captcha(sfContext::getInstance()->getUser()->getAttribute('captcha'));
     if ($g->verify($value)) {
         return true;
     }
     $error = $this->getParameter('error', sfConfig::get('app_captcha_error', 'You should specify valid Turing number'));
     return false;
 }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:9,代码来源:captchaValidator.class.php


示例18: perform

 function perform()
 {
     // if all data is correct, then we can proceed and use it
     $tf = new Textfilter();
     $this->userName = $tf->filterAllHTML($this->_request->getValue("userName"));
     $this->userPassword = $tf->filterAllHTML($this->_request->getValue("userPassword"));
     $this->confirmPassword = $tf->filterAllHTML($this->_request->getValue("userPasswordCheck"));
     $this->userEmail = $tf->filterAllHTML($this->_request->getValue("userEmail"));
     $this->userFullName = $tf->filterAllHTML($this->_request->getValue("userFullName"));
     $this->captcha = $this->_request->getValue("userAuth");
     // check if there is already a user with the same username and quit if so
     $users = new Users();
     if ($users->userExists($this->userName)) {
         $this->_view = new SummaryUserCreationView();
         //$this->_form->hasRun( true );
         $this->_form->setFieldValidationStatus("userName", false);
         $this->setCommonData(true);
         return false;
     }
     // check if this email account has registered and quit if so, but only if the configuration
     // says that we should only allow one blog per email account
     if ($this->_config->getValue("force_one_blog_per_email_account")) {
         if ($users->emailExists($this->userEmail)) {
             $this->_view = new SummaryUserCreationView();
             //$this->_form->hasRun( true );
             $this->_form->setFieldValidationStatus("userEmail", false);
             $this->setCommonData(true);
             return false;
         }
     }
     // check if the passwords match, and stop processing if so too
     if ($this->userPassword != $this->confirmPassword) {
         $this->_view = new SummaryUserCreationView();
         $this->_view->setErrorMessage($this->_locale->tr("error_passwords_dont_match"));
         $this->_form->setFieldValidationStatus("userPasswordCheck", false);
         $this->setCommonData(true);
         return false;
     }
     // check if the captcha matches
     if ($this->_config->getValue("use_captcha_auth")) {
         include_once PLOG_CLASS_PATH . "class/data/captcha/captcha.class.php";
         $captcha = new Captcha();
         if (!$captcha->validate($this->captcha)) {
             $this->_view = new SummaryUserCreationView();
             $this->_view->setErrorMessage($this->_locale->tr("error_invalid_auth_code"));
             $this->_form->setFieldValidationStatus("userAuth", false);
             $this->setCommonData(true);
             return false;
         }
     }
     // if everything went fine, then proceed
     $this->_view = new doBlogRegistrationView();
     $this->setValues();
     $this->setCommonData();
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:56,代码来源:dousercreation.class.php


示例19: Captcha

 /**
  * Creates and returns a captcha object from a row
  * @param $row array
  * @return Captcha object
  */
 function &_returnCaptchaFromRow($row)
 {
     $captcha = new Captcha();
     $captcha->setId($row['captcha_id']);
     $captcha->setSessionId($row['session_id']);
     $captcha->setValue($row['value']);
     $captcha->setDateCreated($this->datetimeFromDB($row['date_created']));
     HookRegistry::call('CaptchaDAO::_returnCaptchaFromRow', array(&$captcha, &$row));
     return $captcha;
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:15,代码来源:CaptchaDAO.inc.php


示例20: __construct

 public function __construct(Captcha $c)
 {
     $this->captcha = $c;
     // TODO: random lines
     $this->lines = [['x1' => 0, 'y1' => $c->getWidth() / 2, 'x2' => $c->getWidth(), 'y2' => $c->getHeight() / 2, 'color' => '#00ff00', 'width' => 1], ['x1' => 0, 'y1' => 10, 'x2' => $c->getWidth(), 'y2' => $c->getHeight() / 1.3, 'color' => '#cccccc', 'width' => 2], ['x1' => 0, 'y1' => $c->getHeight() / 2, 'x2' => $c->getWidth(), 'y2' => $c->getHeight() / 3, 'color' => '#cccccc', 'width' => 2]];
     $this->fontSize = 12;
     $this->borderColor = '#666666';
     $this->backgroundColor = '#f1f1f1';
     $this->textColor = '#333333';
     $this->text = $c->getGenerateValue();
 }
开发者ID:rogeriolino,项目名称:php-captcha,代码行数:11,代码来源:ImageCaptcha.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Car类代码示例发布时间:2022-05-20
下一篇:
PHP CanvasGraph类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap