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:
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.
There are several free and open source CAPTCHA implementations available, depending on the programming language that your web site uses.
These are some of the numerous CAPTCHA implementations available for PHP:
- The Securimage script enables you to easily add PHP-based CAPTCHAs to a web site. For more information, please visit http://www.phpcaptcha.org.
- The captchas.net service provides CAPTCHA implementations for several languages, including PHP. For more information, please visit http://captchas.net/sample/php.
- Google provides the reCAPTCHA service. For general information about reCAPTCHA, please visit http://www.google.com/recaptcha. For specific information about implementing reCAPTCHA with PHP, please visit https://developers.google.com/recaptcha/intro.
- If you are a programmer and would like to write your own CAPTCHA implementation, you can use the Text_CAPTCHA PEAR package in PHP. For more information, please visit http://pear.php.net/package/Text_CAPTCHA.
The captchas.net service listed above for PHP also has a Python implementation. For more information, please visit http://captchas.net/sample/python.