1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-01 05:08:57 +02:00

Changes to the way the limits are enforced on username length when searching

This should now allow you to search for a specific user with a name < 3 chars long, whilst still preventing wildcard searchs with less than 3 chars


git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@5447 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Graham Eames 2006-01-13 20:25:39 +00:00
parent e16e060fff
commit b5490a243f

View File

@ -197,13 +197,13 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
}
else
{
if (preg_match('#^[\*%]+$#', trim($search_author)) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($search_author))))
$search_author = str_replace('*', '%', trim($search_author));
if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < 3 ) )
{
$search_author = '';
}
$search_author = str_replace('*', '%', trim($search_author));
$sql = "SELECT user_id
FROM " . USERS_TABLE . "
WHERE username LIKE '" . str_replace("\'", "''", $search_author) . "'";
@ -420,12 +420,12 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
//
if ( $search_author != '' )
{
if (preg_match('#^[\*%]+$#', trim($search_author)) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($search_author))))
$search_author = str_replace('*', '%', trim($search_author));
if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < 3 ) )
{
$search_author = '';
}
$search_author = str_replace('*', '%', trim(str_replace("\'", "''", $search_author)));
}
if ( $total_match_count )