Файл: img/code.php
Строк: 16
<?php
session_name('SID') . session_start();
$code = random_int(11111, 99999);
$_SESSION['code'] = $code;
header('Content-type: image/png');
$img = imagecreate(70, 30);
imagecolorallocate($img, 255, 255, 255);
$x = 0;
for ($i = 0; $i < 5; $i++) {
$x += 10;
$y = mt_rand(4, 8);
$char = substr($code, $i, 1);
$color = imagecolorallocatealpha($img, mt_rand(50, 210), mt_rand(50, 210), mt_rand(50, 210), mt_rand(10, 30));
imagestring($img, 5, $x, $y, $char, $color);
}
imagepng($img);
imagedestroy($img);
?>