How to: Create a CAPTCHA Script with PHP
Learn how to protect your site from spammers and bots using a simple CAPTCHA script.
You likely have encountered CAPTCHA on a number of Websites. It is that small image with a verification code--usually some combination of random words or letters--that you type into a box before submitting something, such as feedback or a comment.
CAPTCHA is a very simple and common protection that helps prevent spam and the automatic submission of an operation by some kind of program or robot. CAPTCHA protection is used on Website forms, such as ours (below), and works by generating a random string, writing it to an image, then storing the string inside of a session. The site then checks the CAPTCHA when the form is submitted.
To learn how to make your own simple CAPTCHA image using PHP, click here for a step-by-step tutorial from our sister site, PHPBuilder.com.
By Aaron Weiss
January 06, 2010
Learn how to put up a "Keep Out" sign at your Website in this introduction to protecting your Website using robots.text from networking expert Aaron Weiss.