Simple captcha verification using php – Captcha is a good way to avoid automatic form submission.In this tutorial i explains about captcha image verification. It create a image with a random string displayed on it. Then the user ask to fill the string in the form filed and once form submitted it checks if the string on image matches the input by the user. This is easiest way to protect web form from spammers.

Simple Captcha Verification using PHP

Simple Captcha Verification using PHP

This is one of the easiest CAPTCHA scripts you will ever use. While it doesn’t obscure the text, it will serve its purpose well for many people who need a low-level CAPTCHA solution.Then create captcha.php file

captcha.php

Demo

This script genrate a random number from 10000 to 99999 and assign it to a session variable $_SESSION[“vercode”]. then it generate a image 25*65 px with balck background and font size 14px. Now create a web form.

Now create php script

This code check the verification code input by user matches with sring given on image. if the code matches then the form data submit else error message shows.

Click to download
Click to download