mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-24 16:21:20 +02:00
- captcha stuff
- unique_id git-svn-id: file:///svn/phpbb/trunk@5911 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
c652f7a4a7
commit
2499d92c83
@ -71,7 +71,7 @@ function login_db(&$username, &$password)
|
|||||||
|
|
||||||
if ($confirm_row)
|
if ($confirm_row)
|
||||||
{
|
{
|
||||||
if ($confirm_row['code'] != $confirm_code)
|
if (strcasecmp($confirm_row['code'], $confirm_code) == 0)
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'status' => LOGIN_ERROR_ATTEMPTS,
|
'status' => LOGIN_ERROR_ATTEMPTS,
|
||||||
|
@ -15,20 +15,6 @@
|
|||||||
*
|
*
|
||||||
* Thanks to Robert Hetzler (Xore)
|
* 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
|
class captcha
|
||||||
{
|
{
|
||||||
@ -39,7 +25,7 @@ class captcha
|
|||||||
{
|
{
|
||||||
global $config;
|
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
|
// Remove all disabled policy modules
|
||||||
foreach ($policy_modules as $key => $name)
|
foreach ($policy_modules as $key => $name)
|
||||||
@ -58,7 +44,7 @@ class captcha
|
|||||||
/**
|
/**
|
||||||
* Send image and destroy
|
* Send image and destroy
|
||||||
*/
|
*/
|
||||||
function send_image(&$image)
|
function send_image(&$image, $array=array())
|
||||||
{
|
{
|
||||||
header('Content-Type: image/png');
|
header('Content-Type: image/png');
|
||||||
header('Cache-control: no-cache, no-store');
|
header('Cache-control: no-cache, no-store');
|
||||||
@ -215,12 +201,13 @@ class captcha
|
|||||||
|
|
||||||
$colors = array();
|
$colors = array();
|
||||||
|
|
||||||
$minr = mt_rand(0, 127);
|
$minr = mt_rand(0, 8);
|
||||||
$ming = mt_rand(0, 127);
|
$ming = mt_rand(0, 8);
|
||||||
$minb = mt_rand(0, 127);
|
$minb = mt_rand(0, 8);
|
||||||
$maxr = mt_rand(128, 256);
|
|
||||||
$maxg = mt_rand(128, 256);
|
$maxr = mt_rand(128, 220);
|
||||||
$maxb = mt_rand(128, 256);
|
$maxg = mt_rand(128, 220);
|
||||||
|
$maxb = mt_rand(128, 220);
|
||||||
|
|
||||||
for ($i = -30; $i <= 30; ++$i)
|
for ($i = -30; $i <= 30; ++$i)
|
||||||
{
|
{
|
||||||
@ -379,7 +366,7 @@ class captcha
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
$char_size = 40;
|
$char_size = 40;
|
||||||
$overlap_factor = .35;
|
$overlap_factor = .32;
|
||||||
|
|
||||||
// Generate image
|
// Generate image
|
||||||
$img_x = 250;
|
$img_x = 250;
|
||||||
@ -1545,7 +1532,7 @@ function captcha_bitmaps()
|
|||||||
array(0,1,0,0,1,0,0,0,0),
|
array(0,1,0,0,1,0,0,0,0),
|
||||||
array(0,0,1,1,0,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,0,1),
|
||||||
array(1,0,0,0,0,0,0,1,0),
|
array(1,0,0,0,0,0,0,1,0),
|
||||||
array(1,0,0,0,0,0,1,0,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),
|
||||||
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,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,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,0,1,0),
|
|
||||||
array(0,0,0,0,0,0,1,0,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),
|
||||||
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,0,1,0,0,0,0,0),
|
||||||
array(0,0,1,0,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(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,0),
|
||||||
|
array(1,0,0,0,0,0,0,0,1),
|
||||||
array(1,1,1,1,1,1,1,1,1),
|
array(1,1,1,1,1,1,1,1,1),
|
||||||
),
|
),
|
||||||
'1' => array(
|
'1' => array(
|
||||||
@ -1834,13 +1821,13 @@ function captcha_bitmaps()
|
|||||||
array(0,0,0,0,1,0,0,0,0),
|
array(0,0,0,0,1,0,0,0,0),
|
||||||
array(0,1,1,1,1,1,1,1,0),
|
array(0,1,1,1,1,1,1,1,0),
|
||||||
),
|
),
|
||||||
'2' => array(
|
'2' => array( // New '2' supplied by Anon
|
||||||
array(0,0,1,1,1,1,1,0,0),
|
array(0,0,0,1,1,1,0,0,0),
|
||||||
array(0,1,0,0,0,0,0,1,0),
|
array(0,0,1,0,0,0,1,0,0),
|
||||||
array(1,0,0,0,0,0,0,0,1),
|
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,0,1),
|
||||||
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,0,1,0),
|
||||||
array(0,0,0,0,0,0,1,0,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),
|
||||||
@ -1848,8 +1835,8 @@ function captcha_bitmaps()
|
|||||||
array(0,0,0,1,0,0,0,0,0),
|
array(0,0,0,1,0,0,0,0,0),
|
||||||
array(0,0,1,0,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,1,1,1,1,1,1,1,1),
|
array(1,1,1,1,1,1,1,1,1),
|
||||||
|
array(0,0,0,0,0,0,0,0,0),
|
||||||
),
|
),
|
||||||
'3' => array(
|
'3' => array(
|
||||||
array(0,0,1,1,1,1,1,0,0),
|
array(0,0,1,1,1,1,1,0,0),
|
||||||
|
@ -136,7 +136,8 @@ function gen_rand_string($num_chars = 8)
|
|||||||
*/
|
*/
|
||||||
function unique_id($extra = 'c')
|
function unique_id($extra = 'c')
|
||||||
{
|
{
|
||||||
global $db, $config, $dss_seeded;
|
global $config;
|
||||||
|
static $dss_seeded;
|
||||||
|
|
||||||
$val = $config['rand_seed'] . microtime();
|
$val = $config['rand_seed'] . microtime();
|
||||||
$val = md5($val);
|
$val = md5($val);
|
||||||
|
@ -156,7 +156,7 @@ $config['max_reg_attempts'] = 0;
|
|||||||
|
|
||||||
if ($row = $db->sql_fetchrow($result))
|
if ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($row['code'] != $confirm_code)
|
if (strcasecmp($row['code'], $confirm_code) == 0)
|
||||||
{
|
{
|
||||||
$error[] = $user->lang['CONFIRM_CODE_WRONG'];
|
$error[] = $user->lang['CONFIRM_CODE_WRONG'];
|
||||||
$wrong_confirm = true;
|
$wrong_confirm = true;
|
||||||
|
@ -161,12 +161,12 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_edit_time', '0'
|
|||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes', '4');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes', '4');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs', '50');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs', '50');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_occlude', '1');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_occlude', '1');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_occlude_noise_pixel', '2');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_occlude_noise_pixel', '1');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_occlude_noise_line', '1');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_occlude_noise_line', '1');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_entropy', '1');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_entropy', '1');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_entropy_noise_pixel', '2');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_entropy_noise_pixel', '2');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_entropy_noise_line', '1');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_entropy_noise_line', '1');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_3dbitmap', '1');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_3dbitmap', '0');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page', '10');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page', '10');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('print_pm', '1');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('print_pm', '1');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_interval', '600');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_interval', '600');
|
||||||
|
@ -628,7 +628,7 @@ if ($submit || $preview || $refresh)
|
|||||||
$confirm_row = $db->sql_fetchrow($result);
|
$confirm_row = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if ($confirm_row['code'] !== $confirm_code)
|
if (strcasecmp($confirm_row['code'], $confirm_code) == 0)
|
||||||
{
|
{
|
||||||
$error[] = $user->lang['CONFIRM_CODE_WRONG'];
|
$error[] = $user->lang['CONFIRM_CODE_WRONG'];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user