<?php
//header("Pragma: no-cache");
// Set the content-type
header("Content-type: image/png");
// Create the image
$im = imagecreate(100, 26);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
// The text to draw
$n = rand (100000, 999999);
$n1 = floor ($n/100000);
$n2 = floor ($n/10000) - $n1*10;
$n3 = floor ($n/1000) - $n1*100 - $n2*10;
$n4 = floor ($n/100) - $n1*1000 - $n2*100 - $n3*10;
$n5 = floor ($n/10) - $n1*10000 - $n2*1000 - $n3*100 - $n4*10;
$n6 = floor ($n) - $n1*100000 - $n2*10000 - $n3*1000 - $n4*100 - $n5*10;
setcookie("reghash",md5($n));
// Replace path by your own font path
$font = 'arial.ttf';
// Add some shadow to the text
//imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
// Add the text
imagettftext($im, 12 + rand(0,8), -15 + rand(0,30), 0 + rand(0,5), 17 + rand(0,5), $black, $font, $n1);
imagettftext($im, 12 + rand(0,8), -15 + rand(0,30), 15 + rand(0,5), 17 + rand(0,5), $black, $font, $n2);
imagettftext($im, 12 + rand(0,8), -15 + rand(0,30), 30 + rand(0,5), 17 + rand(0,5), $black, $font, $n3);
imagettftext($im, 12 + rand(0,8), -15 + rand(0,30), 45 + rand(0,5), 17 + rand(0,5), $black, $font, $n4);
imagettftext($im, 12 + rand(0,8), -15 + rand(0,30), 60 + rand(0,5), 17 + rand(0,5), $black, $font, $n5);
imagettftext($im, 12 + rand(0,8), -15 + rand(0,30), 75 + rand(0,5), 17 + rand(0,5), $black, $font, $n6);
for ($i=1;$i<=200;$i++)
{
imagesetpixel($im, rand(0,100), rand(0,26), $black);
}
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>