PHP

Captcha Image Verification

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 ia easiest way to protect web form from spammers.

View Demo

Captcha.php

This file create an image with random string displayed on it.

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 for submitting the form

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

View Demo

Download Source Code(Captcha Image Verification)
Size: 2.07 KB
Version: V 1.0

About the author

Anuj kumar

I'm Anuj kumar a web developer with 4+ year experience .I write blogs in my free time. I love to learn new technologies and share with others. I founded PHPGurukul in September 2015. The main aim of this website to is provide php , jquery , mysql , phpoops and other web development tutorials. I am trying best effort to make PHPGurukul useful for every single moment spend on this website. If you think this website is useful to visit please share with your friend and buddies.

Leave a Comment

17 Comments