$imgwidth) { $y += 1; $x = 1; } } $chr = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; for($i = 0; $i < 4; $i++) { $input .= substr($chr, mt_rand(0, (strlen($chr) - 1)), 1); } $x = mt_rand(10, 15); $y = mt_rand(35, $imgheight - 20); $j = strlen($input); $_SESSION['securitycode'] = $input; for($i = 0; $i < $j; $i++) { $color = imagecolorallocate($im, mt_rand(0, 155), mt_rand(0, 155), mt_rand(0, 155)); putenv('GDFONTPATH=' . realpath('.')); $font = "includes/fonts/".$fonts[mt_rand(0, (count($fonts) - 1))]; imagettftext($im, mt_rand(20, 25), mt_rand(-10, 10), $x, $y, $color, $font, substr($input, $i, 1)); $x += mt_rand(25, 40); $y += mt_rand(-5, 5); } $j = mt_rand(4, 6); for($i = 0; $i < $j; $i++) { $color = imagecolorallocate($im, mt_rand(0, 200), mt_rand(0, 200), mt_rand(0, 200)); if(mt_rand(0, 2) == 1) { imageellipse($im, mt_rand(50, 150), mt_rand(10, 50), mt_rand(10, 60), mt_rand(10, 60), $color); } else { imageline($im, mt_rand(0, 50), mt_rand(0, 60), mt_rand(100, $imgwidth), mt_rand(0, 60), $color); } } /*$j = mt_rand(($imgwidth * 60 / 10), ($imgwidth * 60 / 5)); for($i = 0; $i < $j; $i++) { $color = imagecolorallocate($im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255)); imagesetpixel($im, mt_rand(0, $imgwidth), mt_rand(0, $imgheight), $color); }*/ imagepng($im); ?>