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


PHP PhpCaptcha类代码示例

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


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

示例1: getReCaptchaImage

 public function getReCaptchaImage()
 {
     $fontsDirectory = __DIR__ . '/../../../../include/captcha/';
     $aFonts = array($fontsDirectory . 'fonts/VeraBd.ttf', $fontsDirectory . 'fonts/VeraIt.ttf', $fontsDirectory . 'fonts/Vera.ttf');
     $oVisualCaptcha = new \PhpCaptcha($aFonts, 200, 60);
     $oVisualCaptcha->Create(__DIR__ . '/../../../../images/cache/recaptcha.png');
     return '/images/cache/recaptcha.png';
 }
开发者ID:alvsgithub,项目名称:Newscoop,代码行数:8,代码来源:NewscoopExtension.php

示例2: image

 function image()
 {
     $imagesPath = ROOT . DS . APP_DIR . DS . 'Vendor' . DS . 'PhpCaptcha' . DS . 'fonts' . DS;
     $aFonts = array($imagesPath . 'VeraBd.ttf', $imagesPath . 'VeraIt.ttf', $imagesPath . 'Vera.ttf');
     $oVisualCaptcha = new PhpCaptcha($aFonts, 200, 60);
     $oVisualCaptcha->UseColour(true);
     //$oVisualCaptcha->SetOwnerText('Source: '.FULL_BASE_URL);
     $oVisualCaptcha->SetNumChars(6);
     $oVisualCaptcha->Create();
 }
开发者ID:ghlnv,项目名称:etalentos,代码行数:10,代码来源:CaptchaComponent.php

示例3: image

 function image()
 {
     $imagesPath = realpath(VENDORS . 'phpcaptcha') . '/fonts/';
     $aFonts = array($imagesPath . 'VeraBd.ttf', $imagesPath . 'VeraIt.ttf', $imagesPath . 'Vera.ttf');
     $oVisualCaptcha = new PhpCaptcha($aFonts, 200, 60);
     $oVisualCaptcha->UseColour(true);
     //$oVisualCaptcha->SetOwnerText('Source: '.FULL_BASE_URL);
     $oVisualCaptcha->SetNumChars(6);
     $oVisualCaptcha->Create();
 }
开发者ID:ralaxraja,项目名称:phlypheonix,代码行数:10,代码来源:captcha.php

示例4: executeImage

 public function executeImage()
 {
     $theme = sfConfig::get("app_phpcaptcha_theme", "Small");
     if (class_exists("PHPCaptcha" . $theme . "Theme")) {
         eval("\$theme = new PHPCaptcha" . $theme . "Theme();");
     } else {
         $theme = new PHPCaptchaSmallTheme();
     }
     $oVisualCaptcha = new PhpCaptcha($theme);
     $oVisualCaptcha->setOwnerText(sfConfig::get("app_phpcaptcha_ownertext", ""));
     $oVisualCaptcha->setHeight(sfConfig::get("app_phpcaptcha_height", $theme->getOption('height')));
     $oVisualCaptcha->setWidth(sfConfig::get("app_phpcaptcha_width", $theme->getOption('width')));
     $oVisualCaptcha->Create();
     return sfView::NONE;
 }
开发者ID:altralize,项目名称:Paid4Catcher,代码行数:15,代码来源:actions.class.php

示例5: isFlooding

 public function isFlooding()
 {
     $uid = GWF_Session::getUserID();
     $uname = GWF_Shoutbox::generateUsername();
     $euname = GDO::escape($uname);
     $table = GDO::table('GWF_Shoutbox');
     $max = $uid === 0 ? $this->module->cfgMaxPerDayGuest() : $this->module->cfgMaxPerDayUser();
     //		$cut = GWF_Time::getDate(GWF_Time::LEN_SECOND, time()-$this->module->cfgTimeout());
     //		$cnt = $table->countRows("shout_uname='$euname' AND shout_date>'$cut'");
     # Check captcha
     if ($this->module->cfgCaptcha()) {
         require_once GWF_CORE_PATH . 'inc/3p/Class_Captcha.php';
         if (!PhpCaptcha::Validate(Common::getPostString('captcha'), true)) {
             return GWF_HTML::err('ERR_WRONG_CAPTCHA');
         }
     }
     # Check date
     $timeout = $this->module->cfgTimeout();
     $last_date = $table->selectVar('MAX(shout_date)', "shout_uid={$uid} AND shout_uname='{$euname}'");
     $last_time = $last_date === NULL ? 0 : GWF_Time::getTimestamp($last_date);
     $next_time = $last_time + $timeout;
     if ($last_time + $timeout > time()) {
         return $this->module->error('err_flood_time', array(GWF_Time::humanDuration($next_time - time())));
     }
     # Check amount
     $today = GWF_Time::getDate(GWF_Date::LEN_SECOND, time() - $timeout);
     $count = $table->countRows("shout_uid={$uid} AND shout_date>='{$today}'");
     if ($count >= $max) {
         return $this->module->error('err_flood_limit', array($max));
     }
     # All fine
     return false;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:33,代码来源:Shout.php

示例6: _processCaptcha

 /**
  * @return void
  */
 private function _processCaptcha()
 {
     @session_start();
     $captchaHandler = CampRequest::GetVar('f_captcha_handler', '', 'POST');
     if (!empty($captchaHandler)) {
         $captcha = Captcha::factory($captchaHandler);
         if (!$captcha->validate()) {
             $this->m_error = new PEAR_Error('The code you entered is not the same as the one shown.',
             ACTION_SUBMIT_COMMENT_ERR_INVALID_CAPTCHA_CODE);
             return FALSE;
         }
     } else {
         $f_captcha_code = CampRequest::GetVar('f_captcha_code');
         if (is_null($f_captcha_code) || empty($f_captcha_code)) {
             $this->m_error = new PEAR_Error('Please enter the code shown in the image.',
             ACTION_SUBMIT_COMMENT_ERR_NO_CAPTCHA_CODE);
             return FALSE;
         }
         if (!PhpCaptcha::Validate($f_captcha_code, true)) {
             $this->m_error = new PEAR_Error('The code you entered is not the same with the one shown in the image.',
             ACTION_SUBMIT_COMMENT_ERR_INVALID_CAPTCHA_CODE);
             return FALSE;
         }
     }
     return TRUE;
 }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:29,代码来源:MetaActionSubmit_Comment.php

示例7: doClean

 protected function doClean($value)
 {
     $clean = (string) $value;
     if (!PhpCaptcha::Validate($clean)) {
         throw new sfValidatorError($this, 'invalid', array('value' => $value));
     }
     return $clean;
 }
开发者ID:altralize,项目名称:Paid4Catcher,代码行数:8,代码来源:sfValidatorPHPCaptcha.class.php

示例8: execute

 public function execute()
 {
     # Don't store this url.
     GWF3::setConfig('store_last_url', false);
     # Load the Captcha class
     require GWF_CORE_PATH . 'inc/3p/Class_Captcha.php';
     # disable Logging
     GWF3::setConfig('log_request', false);
     # disable HTTP Caching
     GWF_HTTP::noCache();
     # Setup Font, Color, Size
     $aFonts = $this->module->cfgCaptchaFont();
     $rgbcolor = $this->module->cfgCaptchaBG();
     $width = $this->module->cfgCaptchaWidth();
     $height = $this->module->cfgCaptchaHeight();
     $oVisualCaptcha = new PhpCaptcha($aFonts, $width, $height, $rgbcolor);
     # Output the captcha
     die($oVisualCaptcha->Create('', Common::getGetString('chars', true)));
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:19,代码来源:Captcha.php

示例9: crackcha_next

function crackcha_next(WC_Challenge $chall)
{
    if (crackcha_round_over()) {
        header('Content-Type: text/plain');
        if (false === crackcha_insert_high($chall)) {
            echo GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
            return;
        } else {
            echo $chall->lang('msg_insert_high') . PHP_EOL;
            echo crackcha_reset($chall);
            return;
        }
    }
    require_once GWF_CORE_PATH . 'inc/3p/Class_Captcha.php';
    $chars = GWF_Random::randomKey(5, GWF_Random::ALPHAUP);
    crackcha_increase_count();
    GWF_Session::set('WCC_CRACKCHA_CHARS', $chars);
    $aFonts = array(GWF_PATH . 'extra/font/teen.ttf');
    $rgbcolor = GWF_CAPTCHA_COLOR_BG;
    $oVisualCaptcha = new PhpCaptcha($aFonts, 210, 42, $rgbcolor);
    $oVisualCaptcha->Create('', $chars);
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:22,代码来源:crackcha.php

示例10: image

 function image()
 {
     $imagesPath = APP . 'vendors' . DS . 'phpcaptcha' . '/fonts/';
     $aFonts = array($imagesPath . 'VeraBd.ttf', $imagesPath . 'VeraIt.ttf', $imagesPath . 'Vera.ttf');
     $oVisualCaptcha = new PhpCaptcha($aFonts, 220, 60);
     $oVisualCaptcha->UseColour(true);
     $oVisualCaptcha->SetNumLines(false);
     $oVisualCaptcha->DisplayShadow(false);
     //$oVisualCaptcha->SetOwnerText('Source: '.FULL_BASE_URL);
     $oVisualCaptcha->SetNumChars(5);
     $oVisualCaptcha->Create();
 }
开发者ID:vsanth,项目名称:propertykon,代码行数:12,代码来源:captcha.php

示例11: __construct

    /**
     * Reads the input parameters and sets up the blogcomment action.
     *
     * @param array $p_input
     */
    public function __construct(array $p_input)
    {
        $this->m_name = 'submit_blogcomment';
        $this->m_defined = true;


        $this->m_properties['blogentry_id'] = $p_input['f_blogentry_id'];
        $BlogEntry = new BlogEntry($this->m_properties['blogentry_id']);

        if (!$BlogEntry->exists()) {
            $this->m_error = new PEAR_Error('None or invalid blogentry was given.', ACTION_BLOGCOMMENT_ERR_INVALID_ENTRY);
            return;
        }
        /*
        if (!isset($p_input['f_blogcomment_title']) || empty($p_input['f_blogcomment_title'])) {
            $this->m_error = new PEAR_Error('The comment subject was not filled in.', ACTION_BLOGCOMMENT_ERR_NO_TITLE);
            return;
        }
        */
        if (!isset($p_input['f_blogcomment_content']) || empty($p_input['f_blogcomment_content'])) {
            $this->m_error = new PEAR_Error('The comment content was not filled in.', ACTION_BLOGCOMMENT_ERR_NO_CONTENT);
            return;
        }
        if (SystemPref::Get('PLUGIN_BLOGCOMMENT_USE_CAPTCHA') == 'Y') {
            @session_start();
            $f_captcha_code = $p_input['f_captcha_code'];
            if (is_null($f_captcha_code) || empty($f_captcha_code)) {
                $this->m_error = new PEAR_Error('Please enter the code shown in the image.', ACTION_BLOGCOMMENT_ERR_NO_CAPTCHA_CODE);
                return false;
            }
            if (!PhpCaptcha::Validate($f_captcha_code, true)) {
                $this->m_error = new PEAR_Error('The code you entered is not the same with the one shown in the image.', ACTION_BLOGCOMMENT_ERR_INVALID_CAPTCHA_CODE);
                return false;
            }
        }

        $this->m_properties['title'] = $p_input['f_blogcomment_title'];
        $this->m_properties['content'] = $p_input['f_blogcomment_content'];
        $this->m_properties['mood_id'] = $p_input['f_blogcomment_mood_id'];
        $this->m_properties['user_name'] = $p_input['f_blogcomment_user_name'];
        $this->m_properties['user_email'] = $p_input['f_blogcomment_user_email'];

        $this->m_blogcomment = new BlogComment($p_input['f_blogcomment_id']);
    }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:49,代码来源:MetaActionSubmit_Blogcomment.php

示例12: validate

 public static function validate($checkType, $value)
 {
     $blnReturn = FALSE;
     if (array_key_exists($checkType, self::$checks)) {
         if (empty(self::$checks[$checkType])) {
             $blnReturn = TRUE;
         } else {
             switch ($checkType) {
                 case VFORM_CAPTCHA:
                     $blnReturn = PhpCaptcha::Validate(ValidForm::get($value));
                     break;
                 default:
                     $blnReturn = preg_match(self::$checks[$checkType], $value);
             }
         }
     } else {
         $blnReturn = preg_match($checkType, $value);
     }
     return $blnReturn;
 }
开发者ID:Jonathonbyrd,项目名称:better-user-management,代码行数:20,代码来源:class.vf_validator.php

示例13: checkCommentWithCaptcha

/**
 * Check posted comment with CAPTCHA
 */
function checkCommentWithCaptcha()
{
    global $config, $pathToIndex, $userName, $sessionState, $app;
    require $pathToIndex . '/plugins/captcha/php-captcha.inc.php';
    switch ($config['language']) {
        case 'japanese':
            $textParts = array('コメント認証', 'コメント内容が認証出来ません。');
            break;
        default:
            $textParts = array('Not Allowed', 'Request Not Allowed.');
            break;
    }
    if (PhpCaptcha::Validate($_POST['captcha_phrase'])) {
        return true;
    } else {
        $additionalTitle = $textParts[0];
        $content = '<h2>' . $textParts[0] . '</h2>' . "\n" . '<div class="important warning">' . "\n" . '<p>' . $textParts[1] . '</p>' . "\n" . '</div>' . "\n";
        $item = array('title' => $app->setTitle($additionalTitle), 'contents' => $content, 'result' => '', 'pager' => '');
        $app->display($item, $sessionState);
        exit;
    }
}
开发者ID:kaz6120,项目名称:Loggix,代码行数:25,代码来源:captcha.php

示例14: CaptchaCheck

 static function CaptchaCheck($text)
 {
     return PhpCaptcha::Validate($text);
 }
开发者ID:hhdem,项目名称:tuangala_v2,代码行数:4,代码来源:Utility.class.php

示例15: PhpCaptchaColour

 function PhpCaptchaColour($aFonts, $iWidth = CAPTCHA_WIDTH, $iHeight = CAPTCHA_HEIGHT)
 {
     // call parent constructor
     parent::PhpCaptcha($aFonts, $iWidth, $iHeight);
     // set options
     $this->UseColour(true);
 }
开发者ID:yunsite,项目名称:hhzuitu,代码行数:7,代码来源:Captcha.inc.php


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