本文整理汇总了PHP中Captcha::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Captcha::render方法的具体用法?PHP Captcha::render怎么用?PHP Captcha::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Captcha
的用法示例。
在下文中一共展示了Captcha::render方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_default
/**
* 输出缩略图
*/
public function action_default($type = '')
{
$width = 80;
$height = 30;
if ($type && preg_match('#^([0-9]+)x([0-9]+)$#i', $type, $m)) {
if ($m[1] > 0) {
$width = $m[1];
}
if ($m[1] > 0) {
$height = $m[2];
}
}
Captcha::render(array('width' => $width, 'height' => $height));
}
示例2: captcha
/**
* Demontrates how to use the Captcha library.
*/
public function captcha()
{
// Look at the counters for valid and invalid
// responses in the Session Profiler.
new Profiler();
// Load Captcha library, you can supply the name
// of the config group you would like to use.
$captcha = new Captcha();
// Ban bots (that accept session cookies) after 50 invalid responses.
// Be careful not to ban real people though! Set the threshold high enough.
if ($captcha->invalid_count() > 49) {
exit('Bye! Stupid bot.');
}
// Form submitted
if ($_POST) {
// Captcha::valid() is a static method that can be used as a Validation rule also.
if (Captcha::valid($this->input->post('captcha_response'))) {
echo '<p style="color:green">Good answer!</p>';
} else {
echo '<p style="color:red">Wrong answer!</p>';
}
// Validate other fields here
}
// Show form
echo form::open();
echo '<p>Other form fields here...</p>';
// Don't show Captcha anymore after the user has given enough valid
// responses. The "enough" count is set in the captcha config.
if (!$captcha->promoted()) {
echo '<p>';
echo $captcha->render();
// Shows the Captcha challenge (image/riddle/etc)
echo '</p>';
echo form::input('captcha_response');
} else {
echo '<p>You have been promoted to human.</p>';
}
// Close form
echo form::submit(array('value' => 'Check'));
echo form::close();
}
示例3: testRender
/**
* @covers Xoops\Form\Captcha::render
* @covers Xoops\Form\Captcha::__construct
*/
public function testRender()
{
$value = $this->object->render();
$this->assertTrue(is_string($value));
}
示例4: Captcha
<?php
/**
* This script generates an image containing an asymmetric key used by login.
*
* @author Richard K. Szabó <richard@9eb.se>
* @file verify.php
* @copyright MIT
*/
$auto_login = false;
require "../../include/iq.php";
$captcha = new Captcha(10);
$session->set(Captcha::KEY_LOGIN, $captcha->getCode(), Captcha::LIFETIME_LOGIN);
$captcha->render();
示例5: array
echo $this->Form->Input('PasswordMatch', 'password', array('Wrap' => TRUE));
echo '<span id="PasswordsDontMatch" class="Incorrect" style="display: none;">' . t("Passwords don't match") . '</span>';
?>
</li>
<?php
$this->fireEvent('ExtendedRegistrationFields');
?>
<li>
<?php
echo $this->Form->label('Why do you want to join?', 'DiscoveryText');
echo $this->Form->textBox('DiscoveryText', array('MultiLine' => true, 'Wrap' => TRUE));
?>
</li>
<?php
Captcha::render($this);
?>
<?php
$this->fireEvent('RegisterFormBeforeTerms');
?>
<li>
<?php
echo $this->Form->CheckBox('TermsOfService', $TermsOfServiceText, array('value' => '1'));
?>
</li>
<li class="Buttons">
<?php
echo $this->Form->button('Apply for Membership', array('class' => 'Button Primary'));
?>
示例6: action_index
public function action_index()
{
Captcha::render();
}