Submitting a form with CodeIgniter CAPTCHA

It is sometimes necessary to add a little more security to a form other than escaping and validating user input; sometimes you may wish to ensure that a human and not some script or bot is entering data and submitting your form.

A tried and tested way of doing this is CAPTCHA. There are alternatives to CAPTCHA; for example, a mathematic question (what's 10 + 7, for example) is fairly easy to construct in your application. A new method is getting your users to play a short game. Based on how they do, they are assessed as being either a human or a bot; areyouahuman.com is a good resource for this. But for now, we'll concentrate on CodeIgniter's CAPTCHA functionality to make a CAPTCHA protected form for ...

Get CodeIgniter 2 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.