本文整理汇总了PHP中securimage类的典型用法代码示例。如果您正苦于以下问题:PHP securimage类的具体用法?PHP securimage怎么用?PHP securimage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了securimage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showCaptcha
public function showCaptcha()
{
include JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'securimage' . DIRECTORY_SEPARATOR . 'securimage.php';
$img = new securimage();
$mod_jinc = JRequest::getString('mod_jinc', 'false');
$mod_jinc = trim($mod_jinc);
if ($mod_jinc == 'true') {
$img->image_width = 125;
$img->image_height = 30;
$img->code_length = rand(4, 4);
$img->setSessionPrefix('mod_jinc');
} else {
$img->image_width = 250;
$img->image_height = 40;
$img->code_length = rand(5, 6);
}
$img->perturbation = 0.7;
$img->image_bg_color = new Securimage_Color("#ffffff");
$img->use_transparent_text = true;
$img->text_transparency_percentage = 45;
// 100 = completely transparent
$img->num_lines = 2;
$img->image_signature = '';
$img->text_color = new Securimage_Color("#333366");
$img->line_color = new Securimage_Color("#FFFFCC");
$img->show('');
// alternate use: $img->show('/path/to/background_image.jpg');
}
示例2: security_captcha
function security_captcha()
{
@ob_clean();
include 'captcha/securimage.php';
$img = new securimage();
$img->image_type = SI_IMAGE_PNG;
$img->text_color = new Securimage_Color(rand(0, 64), rand(64, 128), rand(128, 255));
$img->num_lines = 5;
$img->line_color = new Securimage_Color(rand(0, 64), rand(64, 128), rand(128, 255));
$img->text_transparency_percentage = 30;
$img->perturbation = 0.3;
//Change some settings
/*
$img->image_width = 275;
$img->image_height = 90;
$img->perturbation = 0.9; // 1.0 = high distortion, higher numbers = more distortion
$img->image_bg_color = new Securimage_Color(0x0, 0x99, 0xcc);
$img->text_color = new Securimage_Color(0xea, 0xea, 0xea);
$img->text_transparency_percentage = 65; // 100 = completely transparent
$img->num_lines = 8;
$img->line_color = new Securimage_Color(0x0, 0xa0, 0xcc);
$img->signature_color = new Securimage_Color(rand(0, 64), rand(64, 128), rand(128, 255));
*/
$img->show('');
// alternate use: $img->show('/path/to/background_image.jpg');
}
示例3: IsCorrect
public function IsCorrect($captchaValue)
{
require_once ROOT_DIR . 'lib/external/securimage/securimage.php';
$img = new securimage();
$isValid = $img->check($captchaValue);
Log::Debug('Checking captcha value. Value entered: %s. IsValid: %s', $captchaValue, $isValid);
return $isValid;
}
示例4: action
public function action()
{
/** 防止跨站 */
$referer = $this->request->getReferer();
if (empty($referer)) {
exit;
}
$refererPart = parse_url($referer);
$currentPart = parse_url(Helper::options()->siteUrl);
if ($refererPart['host'] != $currentPart['host'] || 0 !== strpos($refererPart['path'], $currentPart['path'])) {
exit;
}
require_once 'Captcha/securimage/securimage.php';
$img = new securimage();
$dir = dirname(__FILE__) . '/securimage/';
$options = Typecho_Widget::widget('Widget_Options');
$fontsArray = array('04b03.ttf', 'AHGBold.ttf', 'atkinsoutlinemedium-regular.ttf', 'decorative-stylisticblackout-regular.ttf', 'okrienhmk.ttf', 'ttstepha.ttf', 'vtckomixationhand.ttf');
$fontsKey = array_rand($fontsArray);
$fontsFile = $dir . 'fonts/' . $fontsArray[$fontsKey];
//验证码字体
$fontsFile = $dir . 'fonts/' . $options->plugin('Captcha')->ttf_file;
$img->ttf_file = $fontsFile;
//验证码背景
if ($options->plugin('Captcha')->is_background) {
$img->background_directory = $dir . '/backgrounds/';
}
//背景颜色
$img->image_bg_color = new Securimage_Color($options->plugin('Captcha')->image_bg_color);
//验证码颜色
$img->text_color = new Securimage_Color($options->plugin('Captcha')->text_color);
//自定义验证码
$img->use_wordlist = $options->plugin('Captcha')->use_wordlist;
$img->wordlist = explode("\n", $options->plugin('Captcha')->wordlist);
$img->wordlist_file = $dir . 'words/words.txt';
//干扰线颜色
$img->line_color = new Securimage_Color($options->plugin('Captcha')->line_color);
//干扰线、扭曲度
$img->num_lines = $options->plugin('Captcha')->num_lines;
$img->perturbation = $options->plugin('Captcha')->perturbation;
//签名内容、颜色、字体
$img->signature_color = new Securimage_Color($options->plugin('Captcha')->signature_color);
$img->image_signature = $options->plugin('Captcha')->image_signature;
$img->signature_font = $dir . 'fonts/' . $options->plugin('Captcha')->signature_font;
//高度宽度
$img->image_height = $options->plugin('Captcha')->image_height;
$img->image_width = $options->plugin('Captcha')->image_width;
$img->show('');
}
示例5: index
public function index($params)
{
$img = new securimage();
//Change some settings
$img->image_width = !empty($_GET['width']) ? (int) $_GET['width'] : self::CAPTCHA_WIDTH;
$img->image_height = !empty($_GET['height']) ? (int) $_GET['height'] : self::CAPTCHA_HEIGHT;
$img->perturbation = 0.45;
$img->image_bg_color = new Securimage_Color(0xf6, 0xf6, 0xf6);
$img->text_angle_minimum = -5;
$img->text_angle_maximum = 5;
$img->use_transparent_text = true;
$img->text_transparency_percentage = 30;
// 100 = completely transparent
$img->num_lines = 7;
$img->line_color = new Securimage_Color("#7B92AA");
$img->signature_color = new Securimage_Color("#7B92AA");
$img->text_color = new Securimage_Color("#7B92AA");
$img->use_wordlist = true;
$img->show();
exit;
}
示例6: captcha
function captcha($width = 280, $height = 100, $word = false)
{
$img = new securimage();
//Change some settings
$img->image_width = $width;
$img->image_height = $height;
$img->perturbation = 0.9;
$img->code_length = rand(5, 6);
$img->image_bg_color = new Securimage_Color("#000000");
$img->use_transparent_text = true;
$img->text_transparency_percentage = 25;
// 100 = completely transparent
$img->num_lines = 15;
$img->wordlist_file = $_SERVER["DOCUMENT_ROOT"] . __racineadminlib__ . "/securimage/words/words.txt";
$img->gd_font_file = $_SERVER["DOCUMENT_ROOT"] . __racineadminlib__ . "/securimage/gdfonts/automatic.gdf";
$img->ttf_file = $_SERVER["DOCUMENT_ROOT"] . __racineadminlib__ . "/securimage/AHGBold.ttf";
$img->use_wordlist = $word;
$img->image_signature = '';
$img->text_color = new Securimage_Color("#FFFFFF");
$img->line_color = new Securimage_Color("#FFFFFF");
$img->show('');
// alternate use: $img->show('/path/to/background_image.jpg');
}
示例7: securimage
$captcha_type = Securimage::SI_CAPTCHA_STRING;
$code_length = 5;
break;
case 6:
$bg = 'backgrounds/yxm_bg_120-3.gif';
$ttf_file = 'AHGBold.ttf';
$captcha_type = Securimage::SI_CAPTCHA_MATHEMATIC;
break;
default:
$bg = 'backgrounds/yxm_bg_120-1.gif';
$captcha_type = Securimage::SI_CAPTCHA_STRING;
$ttf_file = 'AHGBold.ttf';
$code_length = 5;
break;
}
$img = new securimage();
$img->switch_type = $switch_type;
$img->ttf_file = $ttf_file;
$img->captcha_type = $captcha_type;
// show a simple math problem instead of text
$img->image_height = 120;
// width in pixels of the image
$img->image_width = 300;
// a good formula for image size
$img->code_length = $code_length;
$img->perturbation = 0.2;
// 1.0 = high distortion, higher numbers = more distortion
$img->num_lines = 0;
$img->text_color = new Securimage_Color("#000");
// captcha text color
$img->show($bg);
示例8: Group
/********************************************************
JobExpert v1.0
powered by Script Developers Group (SD-Group)
email: info@sd-group.org.ua
url: http://sd-group.org.ua/
Copyright 2010-2015 (c) SD-Group
All rights reserved
=========================================================
Настройки капчи
********************************************************/
/**
* @package
* @todo
*/
include_once 'securimage.php';
$securimage = new securimage();
// Change some settings
$securimage->image_width = 80;
$securimage->image_height = 40;
$securimage->perturbation = 0.0;
// 1.0 = high distortion, higher numbers = more distortion
//$securimage -> image_bg_color = new Securimage_Color("#FFFFFF");//new Securimage_Color(rand(0, 128), rand(0, 128), rand(0, 128));
$securimage->text_color = new Securimage_Color(rand(0, 64), rand(0, 128), rand(0, 128));
//new Securimage_Color("#FF0000");
//$securimage -> text_transparency_percentage = 65; // 100 = completely transparent
$securimage->num_lines = 0;
//$securimage -> image_type = SI_IMAGE_PNG;
$securimage->code_length = 5;
$securimage->charset = '2345689';
//'2345689ABCDEFYZ';//'ABCDEFGHKLMNPRSTUVWYZabcdefghklmnprstuvwyz23456789';
$securimage->expiry_time = 3600;
示例9: securimage
<?php
include 'securimage.php';
$img = new securimage();
//$img->show();
$img->show('./background.gif');
示例10: isset
<?php
include 'securimage.php';
$session_id = isset($_GET['session_id']) ? $_GET['session_id'] : false;
$width = isset($_GET['width']) && (int) $_GET['width'] != 0 ? $_GET['width'] : null;
$height = isset($_GET['height']) && (int) $_GET['height'] != 0 ? $_GET['height'] : null;
$length = isset($_GET['length']) && (int) $_GET['length'] != 0 ? $_GET['length'] : null;
$img = new securimage($session_id);
$img->show($width, $height, $length);
// alternate use: $img->show('/path/to/background.jpg');
示例11: elseif
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_NOT_DELETE));
}
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_NOT_DELETE));
}
} elseif (isset($_POST['addCommentA']) && !empty($_POST['articleId'])) {
if (!empty($_POST['addCommentA'])) {
$articles = new articles();
$aComments = new articlesComments();
$_POST['addCommentA'] = strings::htmlEncode($_POST['addCommentA']);
// проверяем наличие новости
if (!$articles->getPublishedArticle("id=" . secure::escQuoteData($_POST['articleId']))) {
echo ajax::sdgJSONencode(array('error' => ERROR_COMMENT_ARTICLE_NOT_FOUND));
} else {
$securimage = new securimage();
// если добавление комментариев доступно только для зарегистрированных пользователей
// и пользователь не авторизован, выдаем ошибку
if (CONF_ARTICLES_COMMENTS_REGISTER && empty($_SESSION['sd_user']['data']['id'])) {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_REGISTER));
} else {
// проверяем капчу, если она включена
if (SECURE_CAPTCHA) {
if (empty($_POST['keystring']) || !$securimage->check($_POST['keystring'])) {
die(ajax::sdgJSONencode(array('error' => ERROR_CAPTCHA)));
}
}
// массив сервисных полей
$sFields = array('id_article' => $_POST['articleId'], 'id_user' => !empty($_SESSION['sd_user']['data']['id']) ? $_SESSION['sd_user']['data']['id'] : 0);
!empty($_POST['userName']) ? $_POST['userName'] = htmlspecialchars(htmlentities(trim($_POST['userName']), ENT_QUOTES, CONF_DEFAULT_CHARSET), ENT_QUOTES, CONF_DEFAULT_CHARSET) : null;
$user = new user();
示例12: dirname
* If you found this script useful, please take a quick moment to rate it.<br />
* http://www.hotscripts.com/rate/49400.html Thanks.
*
* @link http://www.phpcaptcha.org Securimage PHP CAPTCHA
* @link http://www.phpcaptcha.org/latest.zip Download Latest Version
* @link http://www.phpcaptcha.org/Securimage_Docs/ Online Documentation
* @copyright 2009 Drew Phillips
* @author drew010 <drew@drew-phillips.com>
* @version 2.0.1 BETA (December 6th, 2009)
* @package Securimage
*
*/
include 'securimage.php';
require_once dirname(__FILE__) . '/../../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../../init.php';
$img = new securimage();
// Change some settings
$img->image_width = (int) Configuration::get('ASK_SECURIMAGE_WIDTH');
$img->image_height = (int) Configuration::get('ASK_SECURIMAGE_HEIGHT');
$img->perturbation = Configuration::get('ASK_PERTURBATION');
// 1.0 = high distortion, higher numbers = more distortion
if ((int) Configuration::get('ASK_BACK_COLOR_RAND')) {
$img->image_bg_color = new Securimage_Color(rand(0, 255), rand(0, 255), rand(0, 255));
} else {
$img->image_bg_color = new Securimage_Color('#' . Configuration::get('ASK_BACKGROUND_COL'));
}
if ((int) Configuration::get('ASK_TEXT_COLOR_RAND')) {
$img->text_color = new Securimage_Color(rand(0, 255), rand(0, 255), rand(0, 255));
} else {
$img->text_color = new Securimage_Color('#' . Configuration::get('ASK_TEXT_COL'));
}
示例13: filter
/**
* 评论过滤器
*
* @access public
* @param array $comment 评论结构
* @param Typecho_Widget $post 被评论的文章
* @param array $result 返回的结果上下文
* @param string $api api地址
* @return void
*/
public static function filter($comment, $post, $result)
{
$captchaCode = Typecho_Request::getInstance()->captcha_code;
if (empty($captchaCode)) {
throw new Typecho_Widget_Exception(_t('请输入验证码'));
}
require_once 'Captcha/securimage/securimage.php';
$img = new securimage();
if (!$img->check($captchaCode)) {
throw new Typecho_Widget_Exception(_t('验证码错误, 请重新输入'));
}
return $comment;
}
示例14: securimage_ex
function securimage_ex()
{
parent::securimage();
// get the control's name from querystring
$this->captcha_num = intval($_GET['c']);
}
示例15: _show_captcha
function _show_captcha()
{
$img = new securimage();
$img->show();
}