aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2006-05-13 17:48:21 +0000
committerDavid M <davidmj@users.sourceforge.net>2006-05-13 17:48:21 +0000
commit2499d92c83e5bad7860e7b581525a947b6bde27d (patch)
treef943fadcf17ba055f9e489d7394c99d85bd4061c /phpBB/includes
parentc652f7a4a7531abd38c6d54eef12b8759077af65 (diff)
downloadforums-2499d92c83e5bad7860e7b581525a947b6bde27d.tar
forums-2499d92c83e5bad7860e7b581525a947b6bde27d.tar.gz
forums-2499d92c83e5bad7860e7b581525a947b6bde27d.tar.bz2
forums-2499d92c83e5bad7860e7b581525a947b6bde27d.tar.xz
forums-2499d92c83e5bad7860e7b581525a947b6bde27d.zip
- captcha stuff
- unique_id git-svn-id: file:///svn/phpbb/trunk@5911 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/auth/auth_db.php2
-rw-r--r--phpBB/includes/captcha/captcha_gd.php53
-rw-r--r--phpBB/includes/functions.php3
-rw-r--r--phpBB/includes/ucp/ucp_register.php2
4 files changed, 24 insertions, 36 deletions
diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php
index a53ae0e819..a4a6c8d268 100644
--- a/phpBB/includes/auth/auth_db.php
+++ b/phpBB/includes/auth/auth_db.php
@@ -71,7 +71,7 @@ function login_db(&$username, &$password)
if ($confirm_row)
{
- if ($confirm_row['code'] != $confirm_code)
+ if (strcasecmp($confirm_row['code'], $confirm_code) == 0)
{
return array(
'status' => LOGIN_ERROR_ATTEMPTS,
diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php
index a1b9325895..fb7dee7a49 100644
--- a/phpBB/includes/captcha/captcha_gd.php
+++ b/phpBB/includes/captcha/captcha_gd.php
@@ -15,20 +15,6 @@
*
* Thanks to Robert Hetzler (Xore)
*
-* @todo see notes in includes/captcha/captcha_gd.php
-*
-* Within the policy 'policy_occlude' the letters need to have more space in-between of them.
-* At the moment it can happen that the letters get overlapped
-*
-* Completely remove the number 0
-* Make it case-insensitive
-*
-* The policy_entropy seems to be the best readable, then follows policy_occlude and policy_3dbitmap not readable.
-*
-* Within the policy 'policy_3dbitmap':
-* The 2 and the Z seem to be very similar
-* The letters are not distinguishable(?) enough from the background, maybe related to the letters itself
-* The colors are generally a bit off making it hard to read...
*/
class captcha
{
@@ -39,7 +25,7 @@ class captcha
{
global $config;
- $policy_modules = array('policy_entropy', 'policy_occlude'); // 'policy_3dbitmap'
+ $policy_modules = array('policy_entropy', 'policy_occlude', 'policy_3dbitmap');
// Remove all disabled policy modules
foreach ($policy_modules as $key => $name)
@@ -58,7 +44,7 @@ class captcha
/**
* Send image and destroy
*/
- function send_image(&$image)
+ function send_image(&$image, $array=array())
{
header('Content-Type: image/png');
header('Cache-control: no-cache, no-store');
@@ -215,12 +201,13 @@ class captcha
$colors = array();
- $minr = mt_rand(0, 127);
- $ming = mt_rand(0, 127);
- $minb = mt_rand(0, 127);
- $maxr = mt_rand(128, 256);
- $maxg = mt_rand(128, 256);
- $maxb = mt_rand(128, 256);
+ $minr = mt_rand(0, 8);
+ $ming = mt_rand(0, 8);
+ $minb = mt_rand(0, 8);
+
+ $maxr = mt_rand(128, 220);
+ $maxg = mt_rand(128, 220);
+ $maxb = mt_rand(128, 220);
for ($i = -30; $i <= 30; ++$i)
{
@@ -379,7 +366,7 @@ class captcha
{
global $config;
$char_size = 40;
- $overlap_factor = .35;
+ $overlap_factor = .32;
// Generate image
$img_x = 250;
@@ -1545,7 +1532,7 @@ function captcha_bitmaps()
array(0,1,0,0,1,0,0,0,0),
array(0,0,1,1,0,0,0,0,0),
),
- 'K' => array( // New 'K', supplied by Neothermic
+ 'K' => array( // New 'K', supplied by NeoThermic
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,1,0,0),
@@ -1800,11 +1787,11 @@ function captcha_bitmaps()
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
),
- 'Z' => array(
+ 'Z' => array( // New 'Z' supplied by Anon
array(1,1,1,1,1,1,1,1,1),
+ array(1,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,1,0),
- array(0,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,1,0,0),
array(0,0,0,0,0,1,0,0,0),
array(0,0,0,0,0,1,0,0,0),
@@ -1813,8 +1800,8 @@ function captcha_bitmaps()
array(0,0,0,1,0,0,0,0,0),
array(0,0,1,0,0,0,0,0,0),
array(0,1,0,0,0,0,0,0,0),
- array(0,1,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
+ array(1,0,0,0,0,0,0,0,1),
array(1,1,1,1,1,1,1,1,1),
),
'1' => array(
@@ -1834,13 +1821,13 @@ function captcha_bitmaps()
array(0,0,0,0,1,0,0,0,0),
array(0,1,1,1,1,1,1,1,0),
),
- '2' => array(
- array(0,0,1,1,1,1,1,0,0),
- array(0,1,0,0,0,0,0,1,0),
- array(1,0,0,0,0,0,0,0,1),
- array(0,0,0,0,0,0,0,0,1),
+ '2' => array( // New '2' supplied by Anon
+ array(0,0,0,1,1,1,0,0,0),
+ array(0,0,1,0,0,0,1,0,0),
+ array(0,1,0,0,0,0,1,1,0),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,1),
+ array(0,0,0,0,0,0,0,1,1),
array(0,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,1,0,0),
array(0,0,0,0,0,1,0,0,0),
@@ -1848,8 +1835,8 @@ function captcha_bitmaps()
array(0,0,0,1,0,0,0,0,0),
array(0,0,1,0,0,0,0,0,0),
array(0,1,0,0,0,0,0,0,0),
- array(1,0,0,0,0,0,0,0,0),
array(1,1,1,1,1,1,1,1,1),
+ array(0,0,0,0,0,0,0,0,0),
),
'3' => array(
array(0,0,1,1,1,1,1,0,0),
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 9e0b7a1b1d..bc33f96562 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -136,7 +136,8 @@ function gen_rand_string($num_chars = 8)
*/
function unique_id($extra = 'c')
{
- global $db, $config, $dss_seeded;
+ global $config;
+ static $dss_seeded;
$val = $config['rand_seed'] . microtime();
$val = md5($val);
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index 40d530f808..6fab261f91 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -156,7 +156,7 @@ $config['max_reg_attempts'] = 0;
if ($row = $db->sql_fetchrow($result))
{
- if ($row['code'] != $confirm_code)
+ if (strcasecmp($row['code'], $confirm_code) == 0)
{
$error[] = $user->lang['CONFIRM_CODE_WRONG'];
$wrong_confirm = true;