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


PHP Captcha::isGD方法代码示例

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


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

示例1: verify

/**
 * This is a modification of the freecap_wrap.php file that comes with
 * Howard Yeend's freecap CAPTCHA zip. You can get more information at
 * http://www.puremango.co.uk/
 * Thank you, Mr. Yeend, for sharing your work.
 *
 * @version $Id$
 * @author Howard Yeend
 * @modified Matthew McNaney <mcnaney at gmail dot com>
 */
function verify($return_value = false)
{
    if (!Captcha::isGD()) {
        return false;
    }
    $answer = trim($_POST['captcha']);
    if (!empty($_SESSION['freecap_word_hash'])) {
        // all freeCap words are lowercase.
        // font #4 looks uppercase, but trust me, it's not...
        if ($_SESSION['hash_func'](strtolower($answer)) == $_SESSION['freecap_word_hash']) {
            // reset freeCap session vars
            // cannot stress enough how important it is to do this
            // defeats re-use of known image with spoofed session id
            $_SESSION['freecap_attempts'] = 0;
            $_SESSION['freecap_word_hash'] = false;
            // now process form
            // now go somewhere else
            // header("Location: somewhere.php");
            if ($return_value) {
                return $_POST['captcha'];
            } else {
                return true;
            }
        } else {
            return false;
        }
    } else {
        return false;
    }
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:40,代码来源:verify.php

示例2:

<?php

/**
 * @version $Id$
 * @author Matthew McNaney <mcnaney at gmail dot com>
 */
if (!Captcha::isGD()) {
    $data['warning'] = _('Your GD graphic library is not loaded. Captcha will not function.');
}
$data['question'] = _('Please copy the word in the above image.');
$data['sid'] = md5(SITE_HASH . $_SERVER['REMOTE_ADDR']);
$_SESSION['ld'] = PHPWS_HOME_DIR;
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:12,代码来源:default.php


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