本文整理汇总了PHP中PhpCaptcha类的典型用法代码示例。如果您正苦于以下问题:PHP PhpCaptcha类的具体用法?PHP PhpCaptcha怎么用?PHP PhpCaptcha使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PhpCaptcha类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: define
<?php
// ini_set('display_errors', 1);
define('MODX_API_MODE', true);
// initialize $modx
require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/index.php';
define('CAPTCHA_SESSION_ID', $modx->getOption('modcaptcha.session_id', null, 'php_captcha'));
// include captcha class
require MODX_CORE_PATH . 'components/modcaptcha/php-captcha.inc.php';
$fonts = array('fonts/VeraBd.ttf', 'fonts/VeraIt.ttf', 'fonts/Vera.ttf');
$width = $modx->getOption('modcaptcha.width', null, 150);
$height = $modx->getOption('modcaptcha.height', null, 38);
$chars = $modx->getOption('modcaptcha.chars', null, 'a-z,A-Z,1-9');
$captcha = new PhpCaptcha($fonts, $width, $height);
$captcha->SetCharSet($chars);
$captcha->SetNumChars($modx->getOption('modcaptcha.num_chars', null, 5));
$captcha->SetNumLines($modx->getOption('modcaptcha.num_lines', null, 2));
$captcha->Create();
开发者ID:Tramp1357,项目名称:atlasorg,代码行数:18,代码来源:captcha.php
示例17: captcha
/**
* This function returns true if the variable matches captcha image
*
* @param $val The value to test.
* @param $opts (not required)
* @param $formelement (not required)
*/
function captcha($val, $opts = '', $formelement = null)
{
include_once YD_DIR_HOME . '/3rdparty/captcha/php-captcha.inc.php';
return PhpCaptcha::Validate($val);
}
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:12,代码来源:YDValidateRules.php
示例18: fn_image_verification
function fn_image_verification($condition, $req)
{
if (fn_needs_image_verification($condition) == false) {
return true;
}
$verification_id = !empty($req['verification_id']) ? $req['verification_id'] : '';
$verification_answer = !empty($req['verification_answer']) ? $req['verification_answer'] : '';
if (PhpCaptcha::Validate($verification_id, $verification_answer) == false) {
fn_set_notification('E', __('error'), __('error_confirmation_code_invalid'));
return false;
}
// Do no use verification after first correct validation
if (Registry::get('settings.Image_verification.hide_after_validation') == 'Y') {
$_SESSION['image_verification_ok'] = true;
}
return true;
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:17,代码来源:fn.common.php
示例19: Copyright
<?php
/*************************
Coppermine Photo Gallery
************************
Copyright (c) 2003-2014 Coppermine Dev Team
v1.0 originally written by Gregory Demar
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3
as published by the Free Software Foundation.
********************************************
Coppermine version: 1.6.01
$HeadURL$
$Revision$
**********************************************/
define("IN_COPPERMINE", true);
require "include/init.inc.php";
require "include/captcha.inc.php";
/**
* Fonts to create the captcha image
*/
$aFonts = array('images/fonts/acidic.ttf', 'images/fonts/hurryup.ttf');
// create new image
$oPhpCaptcha = new PhpCaptcha($aFonts, 150, 30, 5, 20, false);
$oPhpCaptcha->Create();
开发者ID:CatBerg-TestOrg,项目名称:coppermine_1.6.x,代码行数:27,代码来源:captcha.php
示例20: verify
public function verify()
{
$response = PhpCaptcha::Validate($this->trellis->input['antispam']);
if (!$response) {
$this->error = 'antispam_phpcaptcha_fail';
}
return $response;
}
开发者ID:purna89,项目名称:TrellisDesk,代码行数:8,代码来源:class_phpcaptcha.php
注:本文中的PhpCaptcha类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论