當前位置: 首頁>>代碼示例>>PHP>>正文


PHP securimage類代碼示例

本文整理匯總了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');
 }
開發者ID:sulicz,項目名稱:JINC_J30,代碼行數:28,代碼來源:captcha.raw.php

示例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');
 }
開發者ID:Gninety,項目名稱:Microweber,代碼行數:26,代碼來源:ajax_helpers.php

示例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;
 }
開發者ID:JoseTfg,項目名稱:Booked,代碼行數:8,代碼來源:CaptchaService.php

示例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('');
 }
開發者ID:sdgdsffdsfff,項目名稱:Typecho-Captcha,代碼行數:48,代碼來源:Action.php

示例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;
 }
開發者ID:vazahat,項目名稱:dudex,代碼行數:21,代碼來源:captcha.php

示例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');
}
開發者ID:jcmwc,項目名稱:fleet,代碼行數:23,代碼來源:function_captcha.php

示例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);
開發者ID:haitao-wang,項目名稱:TSpider,代碼行數:31,代碼來源:securimage_show.php

示例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;
開發者ID:innova-market,項目名稱:JobExpert,代碼行數:31,代碼來源:si.php

示例9: securimage

<?php

include 'securimage.php';
$img = new securimage();
//$img->show();
$img->show('./background.gif');
開發者ID:vanboingy,項目名稱:OFS_trunk,代碼行數:6,代碼來源:securimage_show.php

示例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');
開發者ID:FormHandler,項目名稱:FormHandler,代碼行數:10,代碼來源:securimage_show.php

示例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();
開發者ID:innova-market,項目名稱:JobExpert,代碼行數:31,代碼來源:ajax.php

示例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'));
}
開發者ID:srikanthash09,項目名稱:codetestdatld,代碼行數:31,代碼來源:securimage_show.php

示例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;
 }
開發者ID:sdgdsffdsfff,項目名稱:Typecho-Captcha,代碼行數:23,代碼來源:Plugin.php

示例14: securimage_ex

 function securimage_ex()
 {
     parent::securimage();
     // get the control's name from querystring
     $this->captcha_num = intval($_GET['c']);
 }
開發者ID:bayurianoputra,項目名稱:forum-ff,代碼行數:6,代碼來源:captcha.php

示例15: _show_captcha

 function _show_captcha()
 {
     $img = new securimage();
     $img->show();
 }
開發者ID:sajad1441,項目名稱:TomatoShop-v1,代碼行數:5,代碼來源:contact.php


注:本文中的securimage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。