Location: PHPKode > projects > Apartment Classfieds > apartment_classifieds_script/image_verify.php
<?php

$key = null;
$x = null;
$y = null;
$image = null;
$text_color = null;
$character = null;

session_start();
header('Content-type: image/png');
$image = imagecreate(150, 88);
imagecolorallocate($image, 255, 255, 255);
$text_color = imagecolorallocate($image, 0, 0, 0);
$x = 10;
$y = rand(20, 50);

// image numbers
for ($i = 0; $i < rand(4,7); $i++)
{
	$character = rand(0,9);
	imagestring($image, 15, $x, $y, $character, $text_color);
	$x += rand(8, 10);
	$y = rand(40, 50);
	
	$key .= $character;
}

// image lines
for ($i = 0; $i < rand(1,5); $i++)
{
	imageline($image, rand(0, 88), rand(0, 150), rand(0, 88), rand(0, 150), $text_color);
}

$_SESSION['key'] = $key;
imagepng($image);
imagedestroy($image)

?>
Return current item: Apartment Classfieds