From dd6719738936be31cdaa1758ca86d5eb14dcab3d Mon Sep 17 00:00:00 2001
From: Barry Mieny The "word" is the word that appears in the captcha image, which if not
supplied to the function, will be a random string. Once loaded you can generate a captcha like this: In order for the captcha function to prevent someone from submitting, you will need
to add the information returned from create_captcha() 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. Here is a table prototype: Here is an example of usage with a database. On the page where the CAPTCHA will be shown you'll have something like this: Then, on the page that accepts the submission you'll have something like this:Using the CAPTCHA helper
-
+
$vals = array(
@@ -120,14 +120,14 @@ echo $cap['image'];Adding a Database
-
+
CREATE TABLE captcha (
)
captcha_id bigint(13) unsigned NOT NULL auto_increment,
captcha_time int(10) unsigned NOT NULL,
@@ -138,7 +138,7 @@ echo $cap['image'];$this->load->helper('captcha');
$vals = array(
'img_path' => './captcha/',
@@ -161,10 +161,10 @@ echo $cap['image'];
echo '<input type="text" name="captcha" value="" />';// First, delete old captchas
-
+
diff --git a/user_guide/helpers/compatibility_helper.html b/user_guide/helpers/compatibility_helper.html
index de8c49d0a..9afec6541 100644
--- a/user_guide/helpers/compatibility_helper.html
+++ b/user_guide/helpers/compatibility_helper.html
@@ -68,7 +68,7 @@ Compatibility Helper
You may use those functions without loading this helper. The functions are split between that file and this Helper so that only
functions required by the framework are included by default. This way, whether or not you load the additional functions in this Helper
remains your choice.
$expiration = time()-7200; // Two hour limit
-$this->db->query("DELETE FROM captcha WHERE captcha_time < ".$expiration);
+$this->db->query("DELETE FROM captcha WHERE captcha_time < ".$expiration);
// Then see if a captcha exists:
$sql = "SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND date > ?";
@@ -176,7 +176,7 @@ if ($row->count == 0)
{
echo "You must submit the word that appears in the image";
}
This helper is loaded using the following code:
diff --git a/user_guide/helpers/date_helper.html b/user_guide/helpers/date_helper.html index 2d908705e..f8775b146 100644 --- a/user_guide/helpers/date_helper.html +++ b/user_guide/helpers/date_helper.html @@ -116,7 +116,7 @@ echo standard_date($format, $time);$map = directory_map('./mydirectory/', 1);
-By default, hidden files will not be included in the returned array. To override this behavior, +
By default, hidden files will not be included in the returned array. To override this behavior, you may set a third parameter to true (boolean):
$map = directory_map('./mydirectory/', FALSE, TRUE);
diff --git a/user_guide/helpers/form_helper.html b/user_guide/helpers/form_helper.html
index 03a60685b..0aaa8f60f 100644
--- a/user_guide/helpers/form_helper.html
+++ b/user_guide/helpers/form_helper.html
@@ -258,11 +258,11 @@ echo form_fieldset_close();
Similar to other functions, you can submit an associative array in the second parameter if you prefer to set additional attributes.
diff --git a/user_guide/helpers/html_helper.html b/user_guide/helpers/html_helper.html index 50a1c48a4..845ecf109 100644 --- a/user_guide/helpers/html_helper.html +++ b/user_guide/helpers/html_helper.html @@ -118,7 +118,7 @@ echo link_tag('css/mystyles.css');
echo link_tag('favicon.ico', 'shortcut icon', 'image/ico');
- // <link href="http://site.com/favicon.ico" rel="shortcut icon" type="image/ico" />
+ // <link href="http://site.com/favicon.ico" rel="shortcut icon" type="image/ico" />
echo link_tag('feed', 'alternate', 'application/rss+xml', 'My RSS Feed');
@@ -134,7 +134,7 @@ echo link_tag('css/mystyles.css');
echo link_tag($link);
// <link href="http://site.com/css/printer.css" rel="stylesheet" type="text/css" media="print" />
-
+
Generates non-breaking spaces ( ) based on the number you submit. Example:
echo nbs(3);
diff --git a/user_guide/helpers/smiley_helper.html b/user_guide/helpers/smiley_helper.html
index 661330aab..d95562d94 100644
--- a/user_guide/helpers/smiley_helper.html
+++ b/user_guide/helpers/smiley_helper.html
@@ -91,7 +91,7 @@ a publicly accessible place on your server. This helper also assumes you have t
In your application/controllers/ folder, create a file called smileys.php and place the code below in it.
-Important: Change the URL in the get_clickable_smileys() function below so that it points to +
Important: Change the URL in the get_clickable_smileys() function below so that it points to your smiley folder.
You'll notice that in addition to the smiley helper we are using the Table Class.
@@ -105,21 +105,21 @@ class Smileys extends Controller { { parent::Controller(); } - + function index() { $this->load->helper('smiley'); $this->load->library('table'); - + $image_array = get_clickable_smileys('http://example.com/images/smileys/', 'comments'); - + $col_array = $this->table->make_columns($image_array, 8); - + $data['smiley_table'] = $this->table->generate($col_array); - + $this->load->view('smiley_view', $data); } - + } ?> diff --git a/user_guide/helpers/string_helper.html b/user_guide/helpers/string_helper.html index 2b12c2a2a..d3f97fb52 100644 --- a/user_guide/helpers/string_helper.html +++ b/user_guide/helpers/string_helper.html @@ -145,7 +145,7 @@ The third parameter is FALSE by default; if set to TRUE it will remove occurence $string=",Fred, Bill,, Joe, Jimmy,";Converts single and double quotes in a string to the corresponding HTML entities. Example:
diff --git a/user_guide/helpers/text_helper.html b/user_guide/helpers/text_helper.html index 438eaec45..6a68180b6 100644 --- a/user_guide/helpers/text_helper.html +++ b/user_guide/helpers/text_helper.html @@ -120,7 +120,7 @@ part it should correctly identify characters outside the normal range (like acceTransliterates high ASCII characters to low ASCII equivalents, useful when non-English characters need to be used where only standard ASCII characters are safely used, for instance, in URLs.
$string = convert_accented_characters($string);
-
+
This function uses a companion config file application/config/foreign_chars.php to define the to and from array for transliteration.