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


PHP captcha::getCaptchaString方法代码示例

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


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

示例1: captcha

/******************************************************************

Projectname:   CAPTCHA class
Version:       2.0
Author:        Pascal Rehfeldt <Pascal@Pascal-Rehfeldt.com>

modified for Sphider-plus by Tec 2009.11.26

******************************************************************/
//Start the session
session_start();
//Create a CAPTCHA
$captcha = new captcha();
//Store the String in a session
$_SESSION['CAPTCHAString'] = $captcha->getCaptchaString();
class captcha
{
    var $Length;
    var $CaptchaString;
    var $fontpath;
    var $fonts;
    function captcha($length = 6)
    {
        header('Content-type: image/png');
        $this->Length = $length;
        $this->fontpath = 'images/';
        $this->fonts = $this->getFonts();
        $errormgr = new error();
        if ($this->fonts == FALSE) {
            //$errormgr = new error;
开发者ID:hackersforcharity,项目名称:rachelpiOS,代码行数:30,代码来源:make_captcha.php

示例2: getCaptchaHtml

function getCaptchaHtml()
{
    global $uploadFolder, $sourceFolder, $moduleFolder, $cmsFolder, $urlRequestRoot;
    $captcha_query = "SELECT * FROM `" . MYSQL_DATABASE_PREFIX . "global` WHERE `attribute` = 'recaptcha'";
    $captcha_res = mysql_fetch_assoc(mysql_query($captcha_query));
    $recaptcha = 0;
    if ($captcha_res['value']) {
        if (!fsockopen("www.google.com", 80)) {
            $recaptcha = 0;
        } else {
            $recaptcha = 1;
            $query = "SELECT `value` FROM `" . MYSQL_DATABASE_PREFIX . "global` WHERE `attribute`='recaptcha_public'";
            $res = mysql_fetch_assoc(mysql_query($query));
            $public_key = $res['value'];
            $query = "SELECT `value` FROM `" . MYSQL_DATABASE_PREFIX . "global` WHERE `attribute`='recaptcha_private'";
            $res = mysql_fetch_assoc(mysql_query($query));
            $private_key = $res['value'];
            if ($public_key == NULL || $private_key == NULL) {
                $recaptcha = 0;
            }
        }
        if (isset($_GET['recaptcha']) && $_GET['recaptcha'] == "off") {
            $recaptcha = 0;
        }
    }
    if ($recaptcha) {
        require_once "{$sourceFolder}/{$moduleFolder}/form/captcha/recaptcha/recaptchalib.php";
        $body = "<tr><td colspan=2><center>" . recaptcha_get_html($public_key) . "</center></td></tr>";
        $body .= "<tr><td colspan=2>Click <a href='" . selfURI() . "&recaptcha=off'>here</a> if you can't see the ReCAPTCHA</td></tr>";
        $body .= "<input type='hidden' name='captcha' value='1'>";
    } else {
        require_once "{$sourceFolder}/{$moduleFolder}/form/captcha/class/captcha.class.php";
        $captcha = new captcha($sourceFolder, $moduleFolder, $uploadFolder, $urlRequestRoot, $cmsFolder, 6);
        $_SESSION['CAPTCHAString'] = $captcha->getCaptchaString();
        $body = '<tr><td>Enter the text as shown in the image :</td><td>' . '<img style="border:1px solid;padding:0px" src="' . $captcha->getCaptchaUrl() . '" alt="CAPTCHA" border="1"/><br/>' . '<input type="text" class="required" name="txtCaptcha" /><td></tr>';
        $body .= "<input type='hidden' name='captcha' value='0'>";
    }
    return $body;
}
开发者ID:ksb1712,项目名称:pragyan,代码行数:39,代码来源:registrationformgenerate.php


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