* @version 3.0 (October 2011) * @package Securimage * */ define('PHPWG_ROOT_PATH','../../../'); include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); // randomize colors function randomColor() { mt_srand((double)microtime()*1000000); $c = null; while(strlen($c)<6) { $c .= sprintf("%02X", mt_rand(0, 255)); } return $c; } foreach (array('image_bg_color','text_color','line_color','noise_color') as $color) { if ($conf['cryptographp'][$color] == 'random') $conf['cryptographp'][$color] = randomColor(); } require_once dirname(__FILE__) . '/securimage.php'; $img = new securimage(); $img->ttf_file = './fonts/'.$conf['cryptographp']['ttf_file'].'.ttf'; $img->captcha_type = ($conf['cryptographp']['captcha_type'] == 'string') ? Securimage::SI_CAPTCHA_STRING : Securimage::SI_CAPTCHA_MATHEMATIC; // $img->case_sensitive = get_boolean($conf['cryptographp']['case_sensitive']); $img->image_width = $conf['cryptographp']['width']; $img->image_height = $conf['cryptographp']['height']; $img->perturbation = $conf['cryptographp']['perturbation']; $img->image_bg_color = new Securimage_Color('#'.$conf['cryptographp']['image_bg_color']); $img->text_color = new Securimage_Color('#'.$conf['cryptographp']['text_color']); $img->num_lines = $conf['cryptographp']['num_lines']; $img->line_color = new Securimage_Color('#'.$conf['cryptographp']['line_color']); $img->noise_level = $conf['cryptographp']['noise_level']; $img->noise_color = new Securimage_Color('#'.$conf['cryptographp']['noise_color']); $img->code_length = $conf['cryptographp']['code_length']; $img->show(); ?>