Source for file CAPTCHA_test.php
Documentation is available at CAPTCHA_test.php
if (!($file = fopen($filename, 'w'))) {
// Start PHP session support
$msg = 'Please enter the text in the image in the field below!';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset ($_POST['phrase']) && isset ($_SESSION['phrase']) &&
strlen($_POST['phrase']) > 0 && strlen($_SESSION['phrase']) > 0 &&
$_POST['phrase'] == $_SESSION['phrase']) {
unset ($_SESSION['phrase']);
$msg = 'Please try again!';
require_once 'Text/CAPTCHA.php';
// Set CAPTCHA image options (font must exist!)
'font_file' => 'COUR.TTF',
'text_color' => '#DDFF99',
'lines_color' => '#CCEEDD',
'background_color' => '#555555'
'imageOptions' => $imageOptions
// Generate a new Text_CAPTCHA object, Image driver
$retval = $c->init ($options);
if (PEAR ::isError ($retval)) {
echo 'Error initializing CAPTCHA!';
// Get CAPTCHA secret passphrase
$_SESSION['phrase'] = $c->getPhrase ();
// Get CAPTCHA image (as PNG)
if (PEAR ::isError ($png)) {
echo 'Error generating CAPTCHA (maybe font missing?)!';
echo '<form method="post">' .
'<input type="text" name="phrase" />' .
'<input type="submit" /></form>';
Documentation generated on Mon, 11 Mar 2019 14:44:40 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|