summaryrefslogtreecommitdiffstats
path: root/system/helpers/captcha_helper.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2013-04-15 02:32:52 +0200
committerAndrey Andreev <narf@bofh.bg>2013-04-15 02:32:52 +0200
commit31da423ebba877984675e7232f100842d58b6dfc (patch)
tree52532260b5589f3e7d461c75dcd4b8721aece299 /system/helpers/captcha_helper.php
parent5eb1cbfa673bfa4b8a66ab8a56389a279c1f975b (diff)
parentffe1bd215fe64dc054296ed8aa1ac253bbf1962b (diff)
Merge pull request #2396 from abkr/develop
Add options in create_captcha() to specify the randomly generated captcha word length and character pool
Diffstat (limited to 'system/helpers/captcha_helper.php')
-rw-r--r--system/helpers/captcha_helper.php5
1 files changed, 2 insertions, 3 deletions
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php
index 78e255a15..f3b9c6cc4 100644
--- a/system/helpers/captcha_helper.php
+++ b/system/helpers/captcha_helper.php
@@ -51,7 +51,7 @@ if ( ! function_exists('create_captcha'))
*/
function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '')
{
- $defaults = array('word' => '', 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_path' => '', 'expiration' => 7200);
+ $defaults = array('word' => '', 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_path' => '', 'expiration' => 7200, 'word_length' => 8, 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
foreach ($defaults as $key => $val)
{
@@ -95,9 +95,8 @@ if ( ! function_exists('create_captcha'))
if (empty($word))
{
- $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$word = '';
- for ($i = 0, $mt_rand_max = strlen($pool) - 1; $i < 8; $i++)
+ for ($i = 0, $mt_rand_max = strlen($pool) - 1; $i < $word_length; $i++)
{
$word .= $pool[mt_rand(0, $mt_rand_max)];
}