hedera-web/web/forms/cms/contact/captcha.php

48 lines
888 B
PHP
Raw Normal View History

<?php
require_once ('Text/CAPTCHA.php');
session_start ();
$options = array
(
'width' => 200
,'height' => 60
,'output' => 'png'
,'imageOptions' => array
(
'font_size' => 20
,'font_path' => './'
,'font_file' => 'IndieFlower.ttf'
,'text_color' => '#559955'
,'lines_color' => '#559955'
,'background_color' => '#DDDDDD'
,'antialias' => true
)
);
$captcha = Text_CAPTCHA::factory ('Image');
$retval = $captcha->init ($options);
if (PEAR::isError ($retval))
{
printf ('Error initializing CAPTCHA: %s!', $retval->getMessage());
exit;
}
$png = $captcha->getCAPTCHA ();
if (PEAR::isError ($png))
{
printf ('Error generating CAPTCHA: %s!', $png->getMessage ());
exit;
}
// Get secret passphrase
$_SESSION['captcha'] = $captcha->getPhrase ();
header ('Content-Type: image/png');
echo $png;
?>