File size: 613B
<?php
session_start();
$ch = rand(1111, 9999);
$_SESSION['cap'] = $ch;
// ??????? ???????
$img = imagecreate('40', '20');
// ???? ???? - ?????
$back = imagecolorallocate($img, rand(100, 255), rand(100, 255), rand(100, 255));
// ???? ??????
$black = imagecolorallocate($img, rand(0, 255), rand(0, 255), rand(0, 255));
// ?????? ?????
// $img - ????????????? ????????
// 3 - ????? ??????
// 5 - ?????????? X
// 4 - ?????????? Y
// $number - ???? ?????
// $black - ???? ??????
imagestring($img, rand(3, 9), rand(0, 6), rand(0, 6), $ch, $black);
// ??????? ??????? ? ???????
imagepng($img);
?>