diff options
Diffstat (limited to 'user_guide/helpers/captcha_helper.html')
-rw-r--r-- | user_guide/helpers/captcha_helper.html | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/user_guide/helpers/captcha_helper.html b/user_guide/helpers/captcha_helper.html index c4aa65fad..bd7482266 100644 --- a/user_guide/helpers/captcha_helper.html +++ b/user_guide/helpers/captcha_helper.html @@ -87,9 +87,9 @@ CAPTCHA Helper <p>The "word" is the word that appears in the captcha image, which if not supplied to the function, will be a random string.</p> - + <h3>Using the CAPTCHA helper</h3> - + <p>Once loaded you can generate a captcha like this:</p> <code>$vals = array(<br /> @@ -120,14 +120,14 @@ echo $cap['image'];</code> </ul> <h3>Adding a Database</h3> - + <p>In order for the captcha function to prevent someone from submitting, you will need to add the information returned from <kbd>create_captcha()</kbd> function to your database. Then, when the data from the form is submitted by the user you will need to verify that the data exists in the database and has not expired.</p> - + <p>Here is a table prototype:</p> - + <code>CREATE TABLE captcha (<br /> captcha_id bigint(13) unsigned NOT NULL auto_increment,<br /> captcha_time int(10) unsigned NOT NULL,<br /> @@ -138,7 +138,7 @@ echo $cap['image'];</code> )</code> <p>Here is an example of usage with a database. On the page where the CAPTCHA will be shown you'll have something like this:</p> - + <code>$this->load->helper('captcha');<br /> $vals = array(<br /> 'img_path' => './captcha/',<br /> @@ -161,10 +161,10 @@ echo $cap['image'];<br /> echo '<input type="text" name="captcha" value="" />';</code> <p>Then, on the page that accepts the submission you'll have something like this:</p> - + <code>// First, delete old captchas<br /> $expiration = time()-7200; // Two hour limit<br /> -$this->db->query("DELETE FROM captcha WHERE captcha_time < ".$expiration); <br /> +$this->db->query("DELETE FROM captcha WHERE captcha_time < ".$expiration); <br /> <br /> // Then see if a captcha exists:<br /> $sql = "SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND date > ?";<br /> @@ -176,7 +176,7 @@ if ($row->count == 0)<br /> {<br /> echo "You must submit the word that appears in the image";<br /> }</code> - + </div> <!-- END CONTENT --> |