bganonymous
Registered
Ползвам следната Captcha. Как да направя, освен букви да генерира и цифри?
Код:
<?php
session_start();
$string = '';
for($i = 0; $i < 4; $i++)
{
$string .= chr(rand(97,122));
}
$_SESSION['randcode'] = $string;
$dir = "fonts/";
$image = imagecreatetruecolor(70, 30);
$black = imagecolorallocate($image, 0, 0, 0);
$color = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 233, 233, 233);
imagefilledrectangle($image, 0, 0, 170, 60, $white);
imagettftext($image, 15, 5, 10, 23, $color, $dir."courbd.ttf", $_SESSION['randcode']);
header("Content-type: image/png");
imagepng($image);
?>