PHP CAPTCHA code - php 5 -


PHP Summer Training/Internship with 2 Live Projects in Noida Fee is only 5500/-Click here to Book Your Seat.


Create CAPTCHA image PHP

A CAPTCHA is a type of challenge-response test used in computing as an attempt to ensure that the response is generated by a human being.

It is an acronym based on the word “capture” and standing for “Completely Automated Public Turing test to tell Computers and Humans Apart.

Create Arithmetic CAPTCHA

Welcome user
30 + 42=

In the above example
First create a variable $arr with multiple values i.e created by range function(using array range( ) function ).
second variable $brr also hold multiple values between “9” to “99”.
Now pass $arr inside array_rand( ) function, it returns a random array index which stores in $randa and $randb variable.
Now call the value of array $arr[$randa] and store it in $a and $b variable.
In next line create a variable $cap which holds a string ($a.”+”.$b)
print the $cap variable it shows two arithmetic numbers seperated by “+”.
Now calculate the value, enter the calculated value in text-box, to check the addition of two numbers is correct or not.
if addition of two numbers entered by user is right it shows a message “Welcome user” otherwise show error message “Please fill the correct answer”.

PHP Create CAPTCHA Security Images


Keep Updating yourself