assign([ 'allow_symbols' => $allowed_symbols, 'count_symbols' => $length, 'fluct_amplit' => $fluctuation_amplitude, 'white_noise' => $white_noise_density, 'black_noise' => $black_noise_density, 'no_spaces' => ($no_spaces == true) ? 'true' : 'false', 'bg_color' => $bg_hex ]); $AVE_Template->assign('content', $AVE_Template->fetch($this->tpl_dir . 'editcaptcha.tpl')); } public function saveCaptcha() { if (!$this->checkAccess()) exit("Access Denied"); $a = preg_replace('/[^a-z0-9]/i', '', $_POST['a'] ?? ''); $b = preg_replace('/[^0-9,]/', '', $_POST['b'] ?? '4,6'); $c = (int)($_POST['c'] ?? 8); $d = strip_tags($_POST['d'] ?? '0'); $e = strip_tags($_POST['e'] ?? '0'); $f = ($_POST['f'] === 'true') ? 'true' : 'false'; // Обработка цвета фона (из #ffffff в array(255,255,255)) $hex = $_POST['g'] ?? '#ffffff'; list($r, $g, $b_rgb) = sscanf($hex, "#%02x%02x%02x"); $length_val = (strpos($b, ',') !== false) ? "mt_rand({$b})" : (int)$b; $text = ""; $file_path = BASE_DIR . "/lib/kcaptcha/kcaptcha_config.php"; if (is_writable($file_path) || @chmod($file_path, 0666)) { file_put_contents($file_path, $text); echo "success"; } else { echo "Ошибка прав доступа к файлу конфига!"; } exit; } }