captcha bar1 captcha help captcha bar1

Captcha php

Home
About Us
reCaptcha
Download
FAQ's
Demo
Blog
Contact Us
Email Protection
Challenge Response Test Captcha Image
 
How to implement Captcha with php
 

the advantage of this solution: It is easy to read symbols by human and automated captcha processor software, but hard to process the image by computer because common CAPTCHA processors can't understand which one of the outputted symbols it must ignore!

Obviously you need a PHP engine enabled for your Web server to execute PHP scripts, and GD (PHP graphics library) to generate the image. The solution below is tested for Apache (Windows and Unix), IIS (Windows), PHP-4, PHP-5, GD and GD2.

1.Make a PHP script (separate file captcha.php) which will generate the image:

var $font = 'monofont.ttf';
If you have want to change font file name you will change
$possible = '23456789bcdfghjkmnpqrstvwxyz';
If you have only numbers you will remove alphabets
2.Add the following line at the top of the page where you need to implement CAPTCHA:
[?php session_start() ?]
3.Add the following line to check whether the CAPTCHA string entered by the visitor is valid, before the line where you will proceed with a submitted message:
[?php if($_SESSION["captcha"]==$_POST["captcha"]) { //CAPTHCA is valid; proceed the message: save to database, send by e-mail ... } ?]
4.Finaly add the CAPTCHA to the form: