>All Tutorials 
Ajax and .NET Ajax and .NET RSS XML
Ajax and ColdFusion Ajax and ColdFusion RSS XML
Ajax and Java Ajax and Java RSS XML
Ajax and PHP Ajax and PHP RSS XML
Ajax and SOA Ajax and SOA RSS XML
Ajax Goodies Ajax Goodies RSS XML
Ajax Tool Ajax Tool RSS XML
Facebook MockAjax Facebook MockAjax RSS XML
Google Web Toolkit Google Web Toolkit RSS XML
JavaScript Framework JavaScript Framework RSS XML
Ruby on Rails Ruby on Rails RSS XML
Technique Introduction Technique Introduction RSS XML
Without XMLHttpRequest Without XMLHttpRequest RSS XML
Yahoo! UI Yahoo! UI RSS XML

How to Create CAPTCHA Protection using PHP and AJAX - php image ajax captcha function text add request

 
Registered tutorials: 501
Registered Users: 33128



Rating: 0 out of 0 votes cast


  
Category: Ajax and PHP

How to Create CAPTCHA Protection using PHP and AJAX

Digg this   Post to del.icio.us

Abstract: This tutorial is very simple, but if you are unfamiliar with PHP and AJAX this is a great place to start. The tutorial consists of a HTML page for presenting a simple form that will send the data, a JavaScript file for handling the Ajax functionality

CAPTCHA is a simple test to determine if a user is a computer or a human. It is used to prevent spam abuse on the websites. So if you use CAPTCHA on your web site forms, this can help in stopping some bots and making life harder for other bots in accessing or using your forms.

In brief the CAPTCHA protection works by generating a random string, writing it to an image, then storing the string inside of a session or by some other method. This is then checked when the form is submitted.

The goal of this tutorial is to demonstrate how to make your own simple CAPTCHA protection using PHP and AJAX technologies.

This tutorial is very simple, but if you are unfamiliar with PHP and AJAX this is a great place to start. The tutorial consists of a HTML page for presenting a simple form that will send the data, a JavaScript file for handling the Ajax functionality, and a simple PHP page that makes the actual comparison of the what is in the text box compared to what phrase was stored in the image.

  • The AJAX HTML Page (the Front-end)
  • The JavaScript
  • The PHP Server Page (the Backend)
  • The Ways to Make It More Secure

The AJAX HTML Page (the Front-end)

The front-end of this tutorial is straight forward. We are going to create a simple HTML form with a textbox for entering the security code, dynamically generated image holding this code, a button for submitting, and a DIV that we will display the CAPTCHA test result. The following example shows how you can do that. Create a new file named captcha_test.htm, and add this code to it.

<form id="frmCaptcha" name="frmCaptcha">
<table>
  <tr>
    <td align="left">
      <label for="captcha">Captcha</label>
    </td>
    <td>
      <input id="txtCaptcha" type="text" name="txtCaptcha" value="" maxlength="10" size="32" />
    </td>
    <td>
      <img id="imgCaptcha" src="create_image.php" />
    </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>
      <input id="btnCaptcha" type="button" value="Captcha Test" name="btnCaptcha"
          onclick="getParam(document.frmCaptcha)" />
    </td>
  </tr>
</table> 

<div id="result">&nbsp;</div>
</form>

Read Full Tutorial...



Reviews:

Rate and Review This Site

No reviews yet


Statistic Information About this Resource:


Total Hits: 262
Unique Hits: 221


  Daily Weekly Monthly
  Unique Total Unique Total Unique Total
Average 0.3 0.3 1.1 1.2 5 6.1
Current 0 0 0 0 0 0
Previous 0 0 3 3 9 10
Nov 29 0 0 0 0 7 8
Nov 28 0 0 0 0 2 2
Nov 27 0 0 4 4 8 10
Nov 26 1 1 0 0 2 2
Nov 25 1 1 2 3 6 6
Nov 24 0 0 0 0 0 0
Nov 23 1 1 2 2 8 11
Nov 22 0 0 0 0 8 12
Highest 3 5 6 10 19 22


Script Execution Time: 2.5235 | SQL Queries: 10 | Members: 501
Ajax Tutorial Top List - Powered by Aardvark Topsites PHP 5.1.2