Google
Edit File: captcha.php
<?php session_start(); // generate captcha $chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789'; $captcha = substr(str_shuffle($chars),0,6); $_SESSION['captcha'] = $captcha; // image size $width = 160; $height = 50; $image = imagecreatetruecolor($width, $height); // colors $bg = imagecolorallocate($image, 255,255,255); $text = imagecolorallocate($image, 0,128,0); $border = imagecolorallocate($image, 200,200,200); imagefilledrectangle($image,0,0,$width,$height,$bg); imagerectangle($image,0,0,$width-1,$height-1,$border); // VERY LIGHT noise (not messy) for($i=0;$i<3;$i++){ imageline($image, rand(0,$width), rand(0,$height), rand(0,$width), rand(0,$height), $border); } // font $font = realpath('arial.ttf'); // text imagettftext($image,22,rand(-5,5),20,35,$text,$font,$captcha); header("Content-Type:image/png"); imagepng($image); imagedestroy($image); ?>