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


PHP Captcha::getCaptchaCalc方法代码示例

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


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

示例1: addCaptcha

 /**
  * Add a captcha with an input field to the form. The captcha could be a picture with a character code
  * or a simple mathematical calculation that must be solved.
  * @param string $id    Id of the captcha field. This will also be the name of the captcha field.
  * @param string $type  The of captcha that should be shown. This can be characters in a image or
  *                      simple mathematical calculation. Possible values are @b pic or @b calc.
  * @param string $class (optional) An additional css classname. The class @b admTextInput
  *                      is set as default and need not set with this parameter.
  */
 public function addCaptcha($id, $type, $class = '')
 {
     global $gL10n, $g_root_path;
     $attributes = array('class' => 'captcha');
     ++$this->countElements;
     // set specific css class for this field
     if ($class !== '') {
         $attributes['class'] .= ' ' . $class;
     }
     // add a row with the captcha puzzle
     $this->openControlStructure('captcha_puzzle', '');
     $captchaLabel = '';
     $captchaDescription = '';
     if ($type === 'pic') {
         $this->addHtml('<img src="' . $g_root_path . '/adm_program/system/show_captcha.php?id=' . time() . '" alt="' . $gL10n->get('SYS_CAPTCHA') . '" />');
         $captchaLabel = $gL10n->get('SYS_CAPTCHA_CONFIRMATION_CODE');
         $captchaDescription = 'SYS_CAPTCHA_DESCRIPTION';
     } elseif ($type === 'calc') {
         $captcha = new Captcha();
         $this->addHtml($captcha->getCaptchaCalc($gL10n->get('SYS_CAPTCHA_CALC_PART1'), $gL10n->get('SYS_CAPTCHA_CALC_PART2'), $gL10n->get('SYS_CAPTCHA_CALC_PART3_THIRD'), $gL10n->get('SYS_CAPTCHA_CALC_PART3_HALF'), $gL10n->get('SYS_CAPTCHA_CALC_PART4')));
         $captchaLabel = $gL10n->get('SYS_CAPTCHA_CALC');
         $captchaDescription = 'SYS_CAPTCHA_CALC_DESCRIPTION';
     }
     $this->closeControlStructure();
     // now add a row with a text field where the user can write the solution for the puzzle
     $this->addInput($id, $captchaLabel, '', array('property' => FIELD_REQUIRED, 'helpTextIdLabel' => $captchaDescription, 'class' => 'form-control-small'));
 }
开发者ID:sistlind,项目名称:admidio,代码行数:36,代码来源:htmlform.php

示例2: time

<?php

/**
 ***********************************************************************************************
 * Ausgabe einer Captcha Vorschau
 *
 * @copyright 2004-2015 The Admidio Team
 * @see http://www.admidio.org/
 * @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2.0 only
 ***********************************************************************************************
 */
require_once '../../system/common.php';
echo '
<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    <h4 class="modal-title">' . $gL10n->get('ORG_CAPTCHA_PREVIEW') . '</h4>
</div>
<div class="modal-body">';
if ($gPreferences['captcha_type'] === 'pic') {
    $height = $gPreferences['captcha_height'] + 25;
    $width = $gPreferences['captcha_width'] + 25;
    echo '<img src="' . $g_root_path . '/adm_program/system/show_captcha.php?id=' . time() . '" alt="' . $gL10n->get('SYS_CAPTCHA') . '" />';
} elseif ($gPreferences['captcha_type'] === 'calc') {
    $captcha = new Captcha();
    echo $captcha->getCaptchaCalc($gL10n->get('SYS_CAPTCHA_CALC_PART1'), $gL10n->get('SYS_CAPTCHA_CALC_PART2'), $gL10n->get('SYS_CAPTCHA_CALC_PART3_THIRD'), $gL10n->get('SYS_CAPTCHA_CALC_PART3_HALF'), $gL10n->get('SYS_CAPTCHA_CALC_PART4'));
    echo '<br><i>(' . $gL10n->get('SYS_CAPTCHA_CALC') . ': ' . $_SESSION['captchacode'] . ')</i>';
}
echo '</div>';
开发者ID:sistlind,项目名称:admidio,代码行数:28,代码来源:captcha_preview.php


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