<?php
ob_start();
ob_implicit_flush(0);

define('BASE_DIR', str_replace("\\", "/", dirname(dirname(dirname(__FILE__)))));

require_once(BASE_DIR . '/inc/init.php');

if (! check_permission('adminpanel'))
{
	header('Location:/index.php');
	exit;
}

$a = stripslashes($_POST['a']);
$b = $_POST['b'];
$c = $_POST['c'];
$d = $_POST['d'];
$e = $_POST['e'];
$f = $_POST['f'];

$text = '<?php
$alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
$allowed_symbols = "'.$a.'";
$fontsdir = "fonts";	
$length = mt_rand('.$b.');
$width = 160;
$height = 80;
$fluctuation_amplitude = '.$c.';
$white_noise_density='.$d.';
$black_noise_density='.$e.';
$no_spaces = '.$f.';
$show_credits = false;
$credits = "www.captcha.ru";
$foreground_color = array(mt_rand(0,80), mt_rand(0,80), mt_rand(0,80));
$background_color = array(250, 250, 250);
$jpeg_quality = 95;
?>';
chmod(BASE_DIR . "/lib/kcaptcha/kcaptcha_config.php", 0755);
$fp = fopen(BASE_DIR . "/lib/kcaptcha/kcaptcha_config.php", "w");
fwrite($fp, $text);
fclose($fp);
?>