aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/memberlist.php
diff options
context:
space:
mode:
authorSuhaib Khan <suhebjerk@gmail.com>2014-02-06 22:18:48 +0530
committerCesar G <prototech91@gmail.com>2014-04-23 09:11:39 -0700
commitbc67377400ad11470fb1975af1e07b136f07a24d (patch)
treee48cab262e5000afd83e54c3cd6e8c7d5645faaa /phpBB/memberlist.php
parentdad60045b60d7a622bb23d34d808fc1d03a91b90 (diff)
downloadforums-bc67377400ad11470fb1975af1e07b136f07a24d.tar
forums-bc67377400ad11470fb1975af1e07b136f07a24d.tar.gz
forums-bc67377400ad11470fb1975af1e07b136f07a24d.tar.bz2
forums-bc67377400ad11470fb1975af1e07b136f07a24d.tar.xz
forums-bc67377400ad11470fb1975af1e07b136f07a24d.zip
[ticket/10737] Improvements over last commit
PHPBB3-10737
Diffstat (limited to 'phpBB/memberlist.php')
-rw-r--r--phpBB/memberlist.php40
1 files changed, 12 insertions, 28 deletions
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 1c786c0a1a..c2a995da4c 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -982,37 +982,21 @@ switch ($mode)
break;
case 'livesearch':
- $q=request_var('q','');
+ $q=request_var('q', '', true);
$hint="";
- // Get us some users :D
- $sql = "SELECT u.user_id
- FROM " . USERS_TABLE . " u
- WHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")";
-
- $result = $db->sql_query($sql);
- $user_list = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $user_list[] = (int) $row['user_id'];
- }
- $db->sql_freeresult($result);
- $sql = 'SELECT *
- FROM ' . USERS_TABLE . '
- WHERE ' . $db->sql_in_set('user_id', $user_list);
+ $sql = "SELECT username, user_id
+ FROM " . USERS_TABLE . " u
+ WHERE username LIKE '".$q."%' AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")";
$result = $db->sql_query($sql);
$i=1;
- while ($row = $db->sql_fetchrow($result))
- { $j=($i%2)+1;
- if(stripos($row['username'],$q)===0)
- {
- $hint.="<tr class='bg".$j." row".$j."'><td><a href='" .
- $phpbb_root_path."memberlist.$phpEx". "?mode=viewprofile&u=" . $row['user_id'] .
- "' target='_blank'>" .
- $row['username'] . "</a></td></tr>";
- $i++;
- }
- else
- $hint.="";
+ while ($i<=10 && $row = $db->sql_fetchrow($result))
+ {
+ $j=($i%2)+1;
+ $hint.="<tr class='bg".$j." row".$j."'><td><a href='" .
+ $phpbb_root_path."memberlist.$phpEx". "?mode=viewprofile&u=" . $row['user_id'] .
+ "' target='_blank'>" .
+ $row['username'] . "</a></td></tr>";
+ $i++;
}
echo $hint;
exit();