<?php
require_once('../functions_general.php');
#if(is_bot($_SERVER['HTTP_USER_AGENT'])||empty($_SERVER['HTTP_USER_AGENT']))exit();
if(rand(1, 100)>98)
{
if(current_load($num=1)<10)@exec("find ./captcha/ -maxdepth 1 -type f -mtime +1 -exec rm -f {} \;");
}
$code = rand_string(6);
file_put_contents('./captcha/'.$code, $code);
/* YOU CAN MODIFY THE IMAGE CODE FROM HERE TO CREATE MORE COOL CAPTCHA IMAGES, eg. with different backgrounds */
header("Content-type: image/gif");
$im = @imagecreate(50, 18)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$info_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($im, 7, 0, 1, 6, $info_color, './gumtcha_fonts/pzim3x5.ttf', "code below");
$hex = 'ff8822';
$color['r'] = hexdec(substr($hex, 0, 2));
$color['g'] = hexdec(substr($hex, 2, 2));
$color['b'] = hexdec(substr($hex, 4, 2));
$text_color = imagecolorallocate($im, $color['r'], $color['g'], $color['b']);
$font = './gumtcha_fonts/hachicro.TTF';
#imagettftext($im, 6, 0, 1, 17, $text_color, $font, strtoupper($code));
imagestring($im, 3, 5, 5, $code, $text_color);
imagegif($im);
imagedestroy($im);
?>