From b5490a243feb8acf2e564367e3be652290aef673 Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Fri, 13 Jan 2006 20:25:39 +0000 Subject: [PATCH] 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 --- phpBB/search.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/search.php b/phpBB/search.php index 98ac113e34..de924daf58 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -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 )