Tagged: How to Create CAPTCHA Protection using PHP and AJAX

Simple PHP Create Custom Captcha Generator 0

Simple PHP Create Custom Captcha Generator

Simple PHP Create Custom Captcha Generator

Today, We want to share with you Simple PHP Create Custom Captcha Generator.
In this post we will show you Captcha Code in PHP, hear for PHP – Simple Captcha Generator we will give you demo and example for implement.
In this post, we will learn about Create CAPTCHA Script in PHP with an example.

Creating The Interface

This(simple PHP CAPTCHA) is where we will make a simple HTML form for simple web application and this file Main HTML interface view name as a index.php file

<!DOCTYPE html>
<?php session_start()?>
<html lang="en">
	<title>how to add captcha in php registration form</title>
		<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" />
		<link rel="stylesheet" type="text/css" href="pakainfo/css/bootstrap.css"/>
	<nav class="pakainfo navbar navbar-default">
		<div class="pakainfo container-fluid">
			<a class="navbar-brand" href="https://pakainfo.com">pakainfo.com</a>
</a>		</div>
	<div class="col-md-3"></div>
	<div class="col-md-6 well">
		<h3 class="text-success">Create PHP - Simple Captcha Generator</h3>
		<hr style="border-top:1px dotted #ccc;"/>
		<form action="" method="POST">
			<img src="do_custom_captcha.php" />
			<hr />
			<hr />
			<input type="text" name="captcha" />
						if($_SESSION['captcha'] == $_POST['captcha']){
							echo "<label class='text-success'>captcha Validated</label>";
							echo "<label class='text-danger'>captcha Invalid captcha!</label>";
						echo "<label class='text-warning'>Please fill up the All required field!</label>";
			<hr /><hr />
			<button name="verify" class="btn btn-success">Good Verify</button>

Makeing the Main Function

This source codes inside the any text editor Like as a Notepad++ or any editor and simple copy and paste this scripts save it as do_custom_captcha.php file

//Create CAPTCHA Script in PHP
	$fun_random = rand(1, 9).rand(1, 9).rand(1, 9);
	$_SESSION['captcha'] = $fun_random;
	$live_captcha = imagecreatefromjpeg("upload/live_captcha.jpg");
	$all_color = imagecolorallocate($live_captcha, 0, 0, 0);
	$my_font = 'code.otf'; 
	imagettftext($live_captcha, 20, 0, rand(30, 200), rand(20, 70), $all_color, $my_font, $fun_random );

There you have it we good and very easy way to successfully source code made a Simple PHP Captcha Generator. We hope that this simple Post help and copy paste to run this source code you to what you are looking for.

We hope you get an idea about Create CAPTCHA Script in PHP
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.