'0123456789', 'lenght' => 5, 'width' => 100, 'height' => 32, 'font' => 'captcha', 'fontSize' => 19, 'text' => '' ); $captcha['image'] = imagecreatetruecolor($captcha['width'], $captcha['height']); $captcha['background'] = imagecolorallocatealpha($captcha['image'], 0, 0, 0, 127); imagefill($captcha['image'], 0, 0, $captcha['background']); imagesavealpha($captcha['image'], true); for ($i = 0; $i < $captcha['lenght']; $i++){ $captcha['text'] .= $captcha['symbols'][rand(0, strlen($captcha['symbols']) - 1)]; $captcha['color'] = rand(100, 180); $captcha['textColor'] = imagecolorallocate($captcha['image'], $captcha['color'], $captcha['color'], $captcha['color']); imagettftext($captcha['image'], $captcha['fontSize'], 0, ($i * 20), 27, $captcha['textColor'], $captcha['font'], $captcha['text'][$i]); } $fp = fopen('captcha.txt', 'w'); $test = fwrite($fp, md5($captcha['text'])); fclose($fp); imagepng($captcha['image']); imagedestroy($captcha['image']); ?>