Knowledge Base

How to add CAPTCHA protection to your web site

This article describes what CAPTCHA protection is, when you might use it, and some implementations for various programming languages that you can add to your own web site.

What is a CAPTCHA?

A CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) is a test that tries to determine if a user is a human or a computer. The most common type of CAPTCHA is an image of obscured letters or numbers displayed in a box. A user must type the letter or number sequence correctly before he or she can access web site content or submit data. Because automated bots usually cannot read these images, they are prevented from misusing a web site's resources.

The following image is an example of a common type of CAPTCHA:

Example CAPTCHA image

When to use CAPTCHA protection

You should consider adding CAPTCHA protection to your web site if it has any of the following:

  • Forms that process user-submitted data, including e-mail forms, comment forms, and registration forms.
  • Surveys or polls.
  • Pages that accept file uploads or downloads by users.
  • Any other pages that accept user-submitted data.

CAPTCHA implementations

There are several free and open source CAPTCHA implementations available, depending on the programming language that your web site uses.

PHP

These are some of the numerous CAPTCHA implementations available for PHP:

Python

The captchas.net service listed above for PHP also has a Python implementation. For more information, please visit http://captchas.net/sample/python.

More Information

For more information about CAPTCHAs, please visit http://en.wikipedia.org/wiki/CAPTCHA.