Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 06:27 am EST
Geeklog Forums
Member search
Status: offline
suprsidr
Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
What would be the most simple way to add a member search feature?
it needs to return all possible matches eg.
suprsidr
mrsuprsidr
suprsidr234
...
and link to profile.
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
it needs to return all possible matches eg.
suprsidr
mrsuprsidr
suprsidr234
...
and link to profile.
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
9
9
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
put it in a phpblock
function phpblock_usernameSearch()
{
global $_CONF, $_TABLES;
if (!empty($_GET['username'])){
$username = COM_applyfilter($_GET['username']);
//query db for matches
$result = DB_query("SELECT uid, username FROM {$_TABLES['users']} WHERE username LIKE '%$username%'");
if (DB_numRows($result) >= 1){
$list = '<p>Results:</p>';
$list = '<ul>';
while ($A = DB_fetchArray($result)){
$list .= '<li><a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '">' . COM_stripslashes($A['username']) . '</a></li>';
}
$list .= '</ul>';
$list .= '<p>Search Again?</p>';
}
}
//display form
$form = '<div id="username-search">';
$form .= '<form action="' . $_PHPSELF . '" method="GET">';
$form .= '<input type="text" size="12" name="username">';
$form .= '<input type="submit" value="search">';
$form .= '</form></div>';
//return block
return $list . LB . $form;
}
that should work. ... in fact, it does work
Text Formatted Code
function phpblock_usernameSearch()
{
global $_CONF, $_TABLES;
if (!empty($_GET['username'])){
$username = COM_applyfilter($_GET['username']);
//query db for matches
$result = DB_query("SELECT uid, username FROM {$_TABLES['users']} WHERE username LIKE '%$username%'");
if (DB_numRows($result) >= 1){
$list = '<p>Results:</p>';
$list = '<ul>';
while ($A = DB_fetchArray($result)){
$list .= '<li><a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '">' . COM_stripslashes($A['username']) . '</a></li>';
}
$list .= '</ul>';
$list .= '<p>Search Again?</p>';
}
}
//display form
$form = '<div id="username-search">';
$form .= '<form action="' . $_PHPSELF . '" method="GET">';
$form .= '<input type="text" size="12" name="username">';
$form .= '<input type="submit" value="search">';
$form .= '</form></div>';
//return block
return $list . LB . $form;
}
that should work. ... in fact, it does work
6
10
Quote
Status: offline
suprsidr
Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
You rock Mach!
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
6
9
Quote
All times are EST. The time is now 06:27 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content