TO Create a simple Captcha form, then here is a small guide:
===== 1 STEP ======
in your FTP folder (where you need), put a font file (for example, this: http://www.webpagepublicity.com/free-fonts/a/Anklepants.ttf )
then create a file (called captcha.php) and paste the below code inside it (then put that captcha.php in the same ftp folder):
<?php
session_start();
// generate random number and store in session
$randomnr = rand(1000, 9999);
$_SESSION['randomnr2'] = md5($randomnr);
//generate image
$im = imagecreatetruecolor(100, 38);
//colors:
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 200, 35, $black);
// ------------- your fontname -------------
$font = 'Anklepants.ttf';
//draw text:
imagettftext($im, 35, 0, 22, 24, $grey, $font, $randomnr);
imagettftext($im, 35, 0, 15, 26, $white, $font, $randomnr);
// prevent client side caching
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-revаlidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
//send image to browser
header ("Content-type: image/gif");
imagegif($im);
imagedestroy($im);
?>
===== 2 STEP ======
then in any page (where you want to implement the captcha) put this code somewhere inside that page (but of course, in the last part of this code, there is a sample php fucntion to make an sample action if code is entered correctly. So you should know a more php programming to execute your desired fucntions when Captcha is correct):
<form method="post" action=""> <img src="captcha.php" />
<input class="input" type="text" name="codee" />
<input type="submit" value="Submit" />
</form>
<?php
session_start();
if (md5($_POST['codee']) == $_SESSION['randomnr2']) {
// here you place code to be executed if the captcha test passes
echo "YES. Do Something function1";
}
else {
// here you place code to be executed if the captcha test fails
echo "No. Do Something function2";
}
?>