summaryrefslogtreecommitdiffstats
path: root/user_guide/helpers/captcha_helper.html
diff options
context:
space:
mode:
authorBarry Mieny <barry@mieny.com>2010-10-04 16:33:58 +0200
committerBarry Mieny <barry@mieny.com>2010-10-04 16:33:58 +0200
commitdd6719738936be31cdaa1758ca86d5eb14dcab3d (patch)
treeb5ef66e31b2d0f4f2c1cbccc367bde92c156e1f9 /user_guide/helpers/captcha_helper.html
parent3351fbc56cea19ec3dd603836beb0a420b1ded65 (diff)
Cleanup of stray spaces and tabs
Diffstat (limited to 'user_guide/helpers/captcha_helper.html')
-rw-r--r--user_guide/helpers/captcha_helper.html18
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 />
&nbsp;captcha_id bigint(13) unsigned NOT NULL auto_increment,<br />
&nbsp;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-&gt;load-&gt;helper(&#x27;captcha&#x27;);<br />
$vals = array(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&#x27;img_path&#x27; =&gt; &#x27;./captcha/&#x27;,<br />
@@ -161,10 +161,10 @@ echo $cap[&#x27;image&#x27;];<br />
echo &#x27;&lt;input type=&quot;text&quot; name=&quot;captcha&quot; value=&quot;&quot; /&gt;&#x27;;</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-&gt;db-&gt;query(&quot;DELETE FROM captcha WHERE captcha_time &lt; &quot;.$expiration); <br />
+$this-&gt;db-&gt;query(&quot;DELETE FROM captcha WHERE captcha_time &lt; &quot;.$expiration); <br />
<br />
// Then see if a captcha exists:<br />
$sql = &quot;SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND date &gt; ?&quot;;<br />
@@ -176,7 +176,7 @@ if ($row-&gt;count == 0)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;You must submit the word that appears in the image&quot;;<br />
}</code>
-
+
</div>
<!-- END CONTENT -->