How to Create CAPTCHA image verification using PHP and jQuery

How to Create CAPTCHA image verification using PHP and jQuery

In this Post We Will Explain About is How to Create CAPTCHA image verification using PHP and jQuery With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to How to Create CAPTCHA Protection using PHP and AJAX Example

In this post we will show you Best way to implement captcha code in php with javascript validation, hear for How to create CAPTCHA image verification in PHP and jQuery with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

How to Create CAPTCHA Protection using PHP and AJAX

Simple CAPTCHA meaning is a simple test to know or determine if a user is a computer robot’s or a human.This is simple source code and powerful plugin CAPTCHA script, using this simple script We are going to Make a random simple number and then some creates an image.

If the simple user Data submits the HTML form with All the image number correct captcha value, And then We can proceed with next simple PHP statements like all the inserting data into the MYSQL database or simple sending an email.

Google No CAPTCHA reCAPTCHA PHP Example

1. Create HTML Page with Basic HTML Markup

This is Basic SIMPLE HTML Markup with simple HTML form inside body PHP section with USER name, AND email & captcha fields also a click submit button. Save Data this file Like as index.php




    Simple CAPTCHA Script using PHP

  
   
    

captcha.php (CAPTCHA Script in PHP)

session_start();
$live_captcha_num = rand(1000, 9999);
$_SESSION['code'] = $live_captcha_num;

Above simple source code generates only Numeric four digits number, if We want to generate randomly captcha source code with numbers as well as also combined with some strings then use this below source code.

session_start();
$live_captcha_num = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
$live_captcha_num = substr(str_shuffle($live_captcha_num), 0, 6);
$_SESSION["code"] = $live_captcha_num;

We can use any above source code to simple PHP Based generate captcha as per your some requirement.

//sizes of captcha image As well as font size of captcha
$live_font_size = 30;
$live_img_width = 70;
$live_img_width = 40;

//content type of cpatcha.php file to image/jpeg
header('Content-type: image/jpeg');

//make captcha image with defined sizes and set background color
$image = imagecreate($live_img_width, $live_img_width); // Make background image with dimensions
imagecolorallocate($image, 255, 255, 255); // set background color


// set captcha text color
$live_text_color = imagecolorallocate($image, 0, 0, 0); 


// image from generated captcha string
imagettftext($image, $live_font_size, 0, 15, 30, $live_text_color, 'font.ttf', $live_captcha_num);
imagejpeg($image);

3. Display captcha code in HTML Form



    Live - Simple CAPTCHA Script in PHP

  
  

    
How to Create CAPTCHA image verification using PHP and jQuery

Live24u is the most popular Programming & Web Development blog. Our mission is to provide the best online resources on programming and web development. We deliver the useful and best tutorials for web professionals — developers, programmers, freelancers and site owners. Any visitors of this site are free to browse our tutorials, live demos and download scripts.

4. PHP Check the captcha source code after form submission


You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is simple captcha code in php free download And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

Leave a Comment