PHP код:
<?
header ("Content-type: image/PNG");
$anticapcha=rand(10000,99999);
$anticapcha33=$anticapcha;
$antiss=rand(1,4);
$antis1=substr($anticapcha33,0,$antiss);
$antis1.=' ';
$antis2=strlen($antis1); $antis2--;
$antis3=substr($anticapcha33,$antis2,5);
$anticapcha44=$antis1; $anticapcha44.=$antis3;
$immm1=rand(1,240);
$immm2=rand(1,220);
$immm3=rand(1,240);
$immm4='#'; $immm4.=$immm1; $immm4.=$immm2; $immm4.=$immm3;
$im = @imagecreate (70, 70)
or die ("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate ($im, $immm1, $immm2, $immm3);
//$imaggg=imageline ($im, 12, 12, 221, 221, $text_color1);
$text_color = imagecolorallocate ($im, rand(222,255), rand(222,255), rand(222,255));
$text_color1 = imagecolorallocate ($im, 0, 0, 0);
$text_color2 = imagecolorallocate ($im, 110, 32, 56);
$dddaa=rand(1,53);
$dddaa1=$dddaa+15;
$dddaa21=rand(1,18); $dddaa2=$dddaa21+53;
$dddaa3=rand(-3,45); $dddaa33=$dddaa3+15;
//imagesetthickness($im,11);
$ffs=rand(1,2);
imagestring ($im, 12, 1, 56,'Logotext', $text_color1);
if($ffs == '1') {
imageline ($im, $dddaa1, 2, $dddaa1, 56, $text_color);
imagestringup($im,5,$dddaa,55,$anticapcha44,$text_color); } else {
imageline ($im, $dddaa21, $dddaa33, $dddaa2, $dddaa33, $text_color);
imagestring ($im, 12, $dddaa21, $dddaa3,$anticapcha44, $text_color); }
imagepng ($im,'pp.png');
$ip=getenv("REMOTE_ADDR");
$ff1='users\check\anticapcha\ '; $ff1.=$ip; $ff1.='.txt';
$fffas=fopen($ff1,'w');
fwrite($fffas,$anticapcha);
fclose($fffas);
?>
вот мой когда-то писанный кусок кода, как всегда сам черт голову сломит, но работает =)
выводиться pp.png
|