Файл: ewar/includes/antispam_captcha.php
Строк: 37
<?php
session_start();
if(empty($_SESSION['kodas'])) {
$_SESSION['kodas'] = mt_rand(100,999);
}
$font = "../img/font.ttf";
$pkod = @ereg_replace("[^0-9]","",$_SESSION['kodas']);
$img = imagecreate(50,22);
$bgcolor = imagecolorallocate($img,65,65,65);
$line_color = imagecolorallocate($img,000,000,000);
$color1 = imagecolorallocate($img,mt_rand(0,204),mt_rand(0,204),mt_rand(0,204));
$color2 = imagecolorallocate($img,mt_rand(0,204),mt_rand(0,204),mt_rand(0,204));
$color3 = imagecolorallocate($img,mt_rand(0,204),mt_rand(0,204),mt_rand(0,204));
imagettftext($img,16,mt_rand(1,10),mt_rand(7,10),mt_rand(19,21),$color1,$font,$pkod[0]);
imagettftext($img,16,mt_rand(1,10),mt_rand(20,22),mt_rand(19,21),$color2,$font,$pkod[1]);
imagettftext($img,16,mt_rand(1,10),mt_rand(31,34),mt_rand(19,21),$color3,$font,$pkod[2]);
imageline($img,0,0,52,0,$line_color);
imageline($img,0,0,0,22,$line_color);
imageline($img,49,0,49,21,$line_color);
imageline($img,0,21,52,21,$line_color);
header("Content-type: image/gif");
imagegif($img);
imagedestroy($img);
?>