aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/captcha/plugins/captcha_abstract.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2009-04-18 15:09:19 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2009-04-18 15:09:19 +0000
commit1042152a55ab2d0764c446949a77f085ab7a77f3 (patch)
tree008dc317ce03e80988c8c79f8c6d0cf263a02b32 /phpBB/includes/captcha/plugins/captcha_abstract.php
parente3d98fe77b1f2c60ceefa0ddf9091d08815d1f89 (diff)
downloadforums-1042152a55ab2d0764c446949a77f085ab7a77f3.tar
forums-1042152a55ab2d0764c446949a77f085ab7a77f3.tar.gz
forums-1042152a55ab2d0764c446949a77f085ab7a77f3.tar.bz2
forums-1042152a55ab2d0764c446949a77f085ab7a77f3.tar.xz
forums-1042152a55ab2d0764c446949a77f085ab7a77f3.zip
Merge changes made in revisions #r9405 to #r9467
2009-04-18 git-svn-id: file:///svn/phpbb/trunk@9468 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/captcha/plugins/captcha_abstract.php')
-rw-r--r--phpBB/includes/captcha/plugins/captcha_abstract.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php
index 621fea414a..4f494b9c69 100644
--- a/phpBB/includes/captcha/plugins/captcha_abstract.php
+++ b/phpBB/includes/captcha/plugins/captcha_abstract.php
@@ -29,6 +29,8 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin
protected $type;
protected $solved = false;
+ protected $min_chars = 4;
+ protected $max_chars = 7;
function init($type)
{
@@ -46,7 +48,7 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin
function execute_demo()
{
- $this->code = gen_rand_string(mt_rand(5, 8));
+ $this->code = gen_rand_string(mt_rand($this->min_chars, $this->max_chars));
$this->seed = hexdec(substr(unique_id(), 4, 10));
// compute $seed % 0x7fffffff
@@ -188,10 +190,11 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin
*/
protected function generate_code()
{
- $this->code = gen_rand_string(mt_rand(5, 8));
+ $this->code = gen_rand_string(mt_rand($this->min_chars, $this->max_chars));
$this->confirm_id = md5(unique_id(phpbb::$user->ip));
$this->seed = hexdec(substr(unique_id(), 4, 10));
$this->solved = false;
+
// compute $seed % 0x7fffffff
$this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff);