File: D:/HostingSpaces/RClaassen/stay-on-track.nl/wwwroot/captcha.php
<?php
session_start();
$Characters = '23456789abcdefghjklmnpqrstuvwxyz';
$chars = 8;
$Width = 150;
$Height = 50;
$i = 0;
while ($i < $chars) {
$randomnr .= substr($Characters, mt_rand(0, strlen($Characters)-1), 1);
$i++;
}
$_SESSION['randomnr2'] = md5($randomnr);
$im = imagecreatetruecolor($Width, $Height);
$front = imagecolorallocate($im, 255, 255, 255);
$shadow = imagecolorallocate($im, 128, 128, 128);
$background = imagecolorallocate($im, 83, 83, 83);
imagefilledrectangle($im, 0, 0, $Width, $Height, $background);
$font = './Artbrush.ttf';
$angle1 = rand(-12, 12);
$angle2 = rand(-12, 12);
imagettftext($im, 25, $angle1, 20, 28, $shadow, $font, $randomnr);
imagettftext($im, 20, $angle2, 30, 32, $front, $font, $randomnr);
header("Expires: Wed, 1 Jan 1997 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header ("Content-type: image/gif");
imagegif($im);
imagedestroy($im);
?>