Social Networks

In this post I explain how to create Google style CAPTCHA (Human verification code) script for PHP projects. I explained how to implement cool-php-captcha script for PHP project forms in Google style. Use it and add security to your web projects and protection for your website forms.

Download Source   Demo

 
PHP Code:

< ?php
session_start();
if (!empty($_REQUEST['captcha'])) 
{
    if (empty($_SESSION['captcha']) || trim(strtolower($_REQUEST['captcha'])) != $_SESSION['captcha']) 
	{
        $note= 'Please enter valid text';
    } 
	else 
	{
	if($_SERVER["REQUEST_METHOD"] == "POST")
    {
   $name=htmlentities($_POST['name']); 
   $message=htmlentities($_POST['message']);
   // Insert SQL Statement 
    $note= 'Values Inserted';
    }
}
unset($_SESSION['captcha']);
}
?>

HTML Code:

<form method="post"  action="reg.php">
<b>Name</b><br />
<input type="text" name="name" /><br />
<b>Message</b><br />
<textarea name="message"></textarea><br />
<img src="captcha.php" id="captcha" /><br />
<a rel="nofollow" href="#" onclick="
document.getElementById('captcha').src='captcha.php?'+Math.random();
document.getElementById('captcha-form').focus();"
id="change-image">Not readable? Change text.</a><br /><br />
<b>Human Test</b><br />
<input type="text" name="captcha" id="captcha-form" /><br /&gt;
<input type="submit" />
</form>

google-captcha-php

Source code taken from : Cool-php-captcha

Leave a Reply

Your email address will not be published. Required fields are marked *

Allowed Tags:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>