Location: PHPKode > projects > GBoook > gbook_v.3.3/imgsec/image.php
<?php
session_start();

function strrand($length)
{
	$str = "";
	
	while(strlen($str)<$length){
		mt_srand((double)microtime()*1000000);
		$random=mt_rand(48,122);
		$random=md5($random);
		$str.=substr($random, 17, 1);
	}
	return $str;
}

$text = $_SESSION['string'] = strrand(5);
header("Content-type: image/png");
$im = imagecreatefrompng("black.png");

$white = imagecolorallocate($im, 255, 255, 255);

$font = 'WALSHESO.TTF';
$fontsize=25;

imagettftext($im,  $fontsize, 25, 10, 29, $white, $font, substr($text, 0, 1));
imagettftext($im,  $fontsize, 2, 20, 24, $white, $font, substr($text, 1, 1));
imagettftext($im,  $fontsize, 15, 40, 29, $white, $font, substr($text, 2, 1));
imagettftext($im,  $fontsize, 45, 70, 24, $white, $font, substr($text, 3, 1));
imagettftext($im,  $fontsize, 3, 80, 29, $white, $font, substr($text, 4, 1));

imagepng($im);
imagedestroy($im);
?>
Return current item: GBoook