<?php

include("inc.top.php");

$t->set_file('captcha_file','captcha.html');
//die('ce poola');


require_once("lib/hn_captcha.class.x1.php");
	// ConfigArray

//	echo $_SERVER['DOCUMENT_ROOT'];

//echo $_SERVER['HTTP_HOST'];

	$folders=get_setting("site_full_url");
	if (strpos($_SERVER['HTTP_HOST'], 'www.')===false)
	{
		if (strpos(get_setting('site_full_url'), 'www.')){
			$folders=str_replace('www.','',$folders);
		}
	}else{
		if (strpos(get_setting('site_full_url'), 'www.')===false){
			$folders=str_replace('http://','http://www.',$folders);
		}
	}
	$folders=preg_replace('/http\:\/\/'.$_SERVER['HTTP_HOST'].'/',"",$folders);

	$CAPTCHA_INIT = array(

            'tempfolder'     => $_SERVER['DOCUMENT_ROOT'].$folders."_tmp/",      // string: absolute path (with trailing slash!) to a writeable tempfolder which is also accessible via HTTP!
			'TTF_folder'     => $_SERVER['DOCUMENT_ROOT'].$folders."fonts/", // string: absolute path (with trailing slash!) to folder which contains your TrueType-Fontfiles.
            // mixed (array or string): basename(s) of TrueType-Fontfiles
			'TTF_RANGE'      => array('comic.ttf','impact.ttf'),
            'chars'          => 5,       // 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'   => 'A very, very secret string which is used to generate a md5-key!',
            'secretposition' => 24,      // integer: [1-32]
            'debug'          => FALSE,
	);

	$captcha =& new hn_captcha_X1($CAPTCHA_INIT);

	$t->set_var("captcha",$captcha->display_form());

	
$t->pparse("out","captcha_file");

//echo "$('captcha').innerHTML = ''";


?>