<?php session_start(); $string = ""; for ($i = 0; $i < 5; $i++) $string .= chr(rand(97, 122)); $_SESSION['captcha'] = $string; $image = imagecreatetruecolor(80, 30); $black = imagecolorallocate($image, 0, 0, 0); $color = imagecolorallocate($image, 200, 100, 90); $white = imagecolorallocate($image, 255, 255, 255); imagefilledrectangle($image,0,0,399,99,$white); imagettftext ($image, 15, 0, 10, 20, $black, "imperialSTDBoldItalic.ttf", $_SESSION['captcha']); header("Content-type: image/png"); imagepng($image); ?>