<?
// Please type in all needed values before run the script!
require_once("captcha/hn_captcha.class.x1.php");
// ConfigArray
$CAPTCHA_INIT = array(
'tempfolder' => $_SERVER['DOCUMENT_ROOT'].'/captcha/', // string: absolute path (with trailing slash!) to a writeable tempfolder which is also accessible via HTTP!
'TTF_folder' => $_SERVER['DOCUMENT_ROOT'].'/captcha/', // string: absolute path (with trailing slash!) to folder which contains your TrueType-Fontfiles.
// mixed (array or string): basename(s) of TrueType-Fontfiles
// 'TTF_RANGE' => 'COMIC.TTF',
'chars' => 3, // integer: number of chars to use for ID
'minsize' => 20, // integer: minimal size of chars
'maxsize' => 30, // integer: maximal size of chars
'maxrotation' => 25, // integer: define the maximal angle for char-rotation, good results are between 0 and 30
'noise' => TRUE, // boolean: TRUE = noisy chars | FALSE = grid
'websafecolors' => FALSE, // boolean
'refreshlink' => TRUE, // boolean
'lang' => 'en', // string: ['en'|'de']
'maxtry' => 3, // integer: [1-9]
'badguys_url' => '/', // string: URL
'secretstring' => 'myownspace!',
'secretposition' => 24, // integer: [1-32]
'debug' => FALSE,
'counter_filename' => '', // string: absolute filename for textfile which stores current counter-value. Needs read- & write-access!
'prefix' => 'hn_captcha_', // string: prefix for the captcha-images, is needed to identify the files in shared tempfolders
'collect_garbage_after' => 20, // integer: the garbage-collector run once after this number of script-calls
'maxlifetime' => 60 // integer: only imagefiles which are older than this amount of seconds will be deleted
);
include "config.php";
$captcha =& new hn_captcha_X1($CAPTCHA_INIT);
if($captcha->garbage_collector_error)
{
// Error! (Counter-file or deleting lost images)
echo "<p><br><b>An ERROR has occured!</b><br>Here you might send email-notification to webmaster or something like that.</p>";
}
switch($captcha->validate_submit())
{
// was submitted and has valid keys
case 1:
// PUT IN ALL YOUR STUFF HERE //
if(isset($_GET['go']))
{
$go=$_GET['go'];
if(isset($_GET['id'])){
$id=$_GET['id'];
$url="/".$go.'?id='.$id;
header("Location: ".$url."");
$url="/".$go;
}
else{
}
}
else ECHO 'ERREUR:APPEL INCORRECT';
break;
// was submitted with no matching keys, but has not reached the maximum try's
case 2:
//echo '<br><br><center><strong>Service temporaly unavailable due to spam abuse.</center></strong>';
include "header.php";
echo $captcha->display_form();
break;
// was submitted, has bad keys and also reached the maximum try's
case 3:
//if(!headers_sent() && isset($captcha->badguys_url)) header('location: '.$captcha->badguys_url);
echo "<p><br>Reached the maximum try's of ".$captcha->maxtry." without success!";
echo "<br><br><a href=\"".$_SERVER['PHP_SELF']."?download=yes&id=1234\">New DEMO</a></p>";
break;
// was not submitted, first entry
default:
echo $captcha->display_form();
break;
}
include "footer.php";
?>