Source for file demo-captcha.php
Documentation is available at demo-captcha.php
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<title>HTML_QuickForm2_Element_Captcha demo</title>
div.element.error input {
// Ignore E_STRICT errors coming from some modules
// You may not need to do this. For development purposes only
require_once 'PEAR/Config.php';
require_once 'HTML/QuickForm2.php';
//require_once 'HTML/QuickForm2/Element/Captcha/Equation.php';
require_once 'HTML/QuickForm2/Element/Captcha/Image.php';
require_once 'HTML/QuickForm2/Element/Captcha/Numeral.php';
require_once 'HTML/QuickForm2/Element/Captcha/ReCaptcha.php';
//require_once 'HTML/QuickForm2/Element/Captcha/Word.php';
$form = new HTML_QuickForm2 (
false // Change to true to use special ID in POST data
'id' => 'captcha_equation',
'captchaType' => 'Equation',
array ('id' => 'captcha_figlet'),
'captchaType' => 'Figlet',
'font_file' => 'makisupa.flf'
array ('id' => 'captcha_image'),
// Path where to store images
'imageDir' => __DIR__ . '/tmp/',
'font_path' => '/usr/share/fonts/truetype/ttf-dejavu/',
'font_file' => 'DejaVuSans.ttf',
'text_color' => '#000000',
'background_color' => '#ffffff',
'lines_color' => '#000000',
array ('id' => 'captcha_numeral'),
array ('id' => 'captcha_recaptcha'),
// Please get your own keys. This here is for demo purposes only.
'public-key' => '6LduXLoSAAAAAOH1LKWCyyqRsfE6SD6ZHOQg9kpr',
'private-key' => '6LduXLoSAAAAAH65fkp-xQHvekEBsNrt31SjBRZX'
array ('id' => 'captcha_word'),
array ('id' => 'submit', 'value' => 'Try it')
// Clear the session, otherwise the user can re-submit the form
foreach ($form->getElements () as $element) {
$element->clearCaptchaSession ();
echo '<h2>Form data</h2>';
Documentation generated on Mon, 11 Mar 2019 15:55:05 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|