-
Book Overview & Buying
-
Table Of Contents
CodeIgniter 2 Cookbook
By :
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 us.
We're going to store the CAPTCHA information CodeIgniter generates for us in a table in the database. To do that, we first need to create that table. The following is the MySQL code to do that. Copy the following into your database:
CREATE...
Change the font size
Change margin width
Change background colour