mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 05:18:52 +00:00
Fix Bug #49195 - Queries on un-indexed column user_email
Added function to generate email-hash. Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10060 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
7cf867419f
commit
c52f05b332
8 changed files with 16 additions and 7 deletions
|
@ -283,6 +283,7 @@
|
|||
<li>[Feature] Place debug notices during captcha rendering in the error log - useful for debugging output already started errors.</li>
|
||||
<li>[Feature] Ability to define constant PHPBB_USE_BOARD_URL_PATH to use board url for images/avatars/ranks/imageset...</li>
|
||||
<li>[Feature] Added INC/DEC command to template syntax, applicable to DEFINES and normal template variables, including loops.</li>
|
||||
<li>[Feature] Added function to generate email-hash. (Bug #49195)</li>
|
||||
|
||||
</ul>
|
||||
<a name="v304"></a><h3>1.ii. Changes since 3.0.4</h3>
|
||||
|
|
|
@ -847,7 +847,7 @@ class acp_users
|
|||
{
|
||||
$sql_ary += array(
|
||||
'user_email' => $update_email,
|
||||
'user_email_hash' => crc32($update_email) . strlen($update_email)
|
||||
'user_email_hash' => phpbb_email_hash($update_email),
|
||||
);
|
||||
|
||||
add_log('user', $user_id, 'LOG_USER_UPDATE_EMAIL', $user_row['username'], $user_row['user_email'], $update_email);
|
||||
|
|
|
@ -551,6 +551,14 @@ function _hash_crypt_private($password, $setting, &$itoa64)
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hash email
|
||||
*/
|
||||
function phpbb_email_hash($email)
|
||||
{
|
||||
return crc32(strtolower($email)) . strlen($email);
|
||||
}
|
||||
|
||||
/**
|
||||
* Global function for chmodding directories and files for internal use
|
||||
*
|
||||
|
|
|
@ -171,7 +171,7 @@ function user_add($user_row, $cp_data = false)
|
|||
'user_password' => (isset($user_row['user_password'])) ? $user_row['user_password'] : '',
|
||||
'user_pass_convert' => 0,
|
||||
'user_email' => strtolower($user_row['user_email']),
|
||||
'user_email_hash' => crc32(strtolower($user_row['user_email'])) . strlen($user_row['user_email']),
|
||||
'user_email_hash' => phpbb_email_hash($user_row['user_email']),
|
||||
'group_id' => $user_row['group_id'],
|
||||
'user_type' => $user_row['user_type'],
|
||||
);
|
||||
|
@ -1727,7 +1727,7 @@ function validate_email($email, $allowed_email = false)
|
|||
{
|
||||
$sql = 'SELECT user_email_hash
|
||||
FROM ' . USERS_TABLE . "
|
||||
WHERE user_email_hash = " . (crc32($email) . strlen($email));
|
||||
WHERE user_email_hash = " . $db->sql_escape(phpbb_email_hash($email));
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
|
|
@ -110,7 +110,7 @@ class ucp_profile
|
|||
'username' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? $data['username'] : $user->data['username'],
|
||||
'username_clean' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? utf8_clean_string($data['username']) : $user->data['username_clean'],
|
||||
'user_email' => ($auth->acl_get('u_chgemail')) ? $data['email'] : $user->data['user_email'],
|
||||
'user_email_hash' => ($auth->acl_get('u_chgemail')) ? crc32($data['email']) . strlen($data['email']) : $user->data['user_email_hash'],
|
||||
'user_email_hash' => ($auth->acl_get('u_chgemail')) ? phpbb_email_hash($data['email']) : $user->data['user_email_hash'],
|
||||
'user_password' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? phpbb_hash($data['new_password']) : $user->data['user_password'],
|
||||
'user_passchg' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? time() : 0,
|
||||
);
|
||||
|
|
|
@ -38,7 +38,7 @@ class ucp_remind
|
|||
{
|
||||
$sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
|
||||
FROM ' . USERS_TABLE . "
|
||||
WHERE user_email = '" . $db->sql_escape($email) . "'
|
||||
WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'
|
||||
AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
|
||||
$result = $db->sql_query($sql);
|
||||
$user_row = $db->sql_fetchrow($result);
|
||||
|
|
|
@ -45,7 +45,7 @@ class ucp_resend
|
|||
|
||||
$sql = 'SELECT user_id, group_id, username, user_email, user_type, user_lang, user_actkey, user_inactive_reason
|
||||
FROM ' . USERS_TABLE . "
|
||||
WHERE user_email = '" . $db->sql_escape($email) . "'
|
||||
WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'
|
||||
AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
|
||||
$result = $db->sql_query($sql);
|
||||
$user_row = $db->sql_fetchrow($result);
|
||||
|
|
|
@ -1337,7 +1337,7 @@ class install_install extends module
|
|||
WHERE config_name = 'avatar_salt'",
|
||||
|
||||
'UPDATE ' . $data['table_prefix'] . "users
|
||||
SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email1']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . (crc32($data['board_email1']) . strlen($data['board_email1'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "'
|
||||
SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email1']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . $db->sql_escape(phpbb_email_hash($data['board_email1'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "'
|
||||
WHERE username = 'Admin'",
|
||||
|
||||
'UPDATE ' . $data['table_prefix'] . "moderator_cache
|
||||
|
|
Loading…
Add table
Reference in a new issue