G<big></big>
<?php
error_reporting(E_ALL);
header("Content-type: image/png");
captcha();<pre><pre lang="HTML">
function ran_string($length=10){
$string="";
$pattern = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
for($i=0; $i<$length; $i++){
$string .= $pattern[rand(0,61)];
}
return $string;
}
function captcha()
{
$string=ran_string();
$im = imagecreate(100, 50);
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color =array( imagecolorallocate($im, 255, 0, 0),imagecolorallocate($im, 0, 255, 0),imagecolorallocate($im, 0, 0, 255),imagecolorallocate($im, 255, 255, 255));
for($i=0;$i<count($<code>string);$i++)
{
$x=($i+1)*10;
imagestring($im, 10, $x, 5, $string[$i], $text_color[rand(0,3)]);
}/*
imagestring($im, 10, 10, 5, $string[0], $text_color[rand(0,3)]);
imagestring($im, 10, 20, 5, $string[1], $text_color[rand(0,3)]);
imagestring($im, 10, 30, 5, $string[2], $text_color[rand(0,3)]);
imagestring($im, 10, 40, 5, $string[3], $text_color[rand(0,3)]);
imagestring($im, 10, 50, 5, $string[4], $text_color[rand(0,3)]);
imagestring($im, 10, 60, 5, $string[5], $text_color[rand(0,3)]);*/
imagepng($im);
imagedestroy($im);
}
?>