View file modules/captcha/captcha.php

File size: 606B
<?php
session_start();
	$string = "";
	for ($i = 0; $i < 4; $i++)
		$string .= chr(rand(97, 122));
	
	$_SESSION['code'] = $string;

	$dir = $_SERVER['DOCUMENT_ROOT']."/modules/captcha/fonts/";

	$image = imagecreatetruecolor(110, 50);
	$black = imagecolorallocate($image, 00, 00, 00);
	$color = imagecolorallocate($image, 000, 000, 200);
	$white = imagecolorallocate($image, 255, 255, 255);

	imagefilledrectangle($image,0,0,399,99,$white);
	imagettftext ($image, 20, 11, 23, 40, $color, $dir."verdana.ttf", $_SESSION['code']);

	header("Content-type: image/png");
	imagepng($image);
?>