quickfind.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:3k
- <?php
- // +-------------------------------------------------------------+
- // | DeskPRO v [2.0.1 Production]
- // | Copyright (C) 2001 - 2004 Headstart Solutions Limited
- // | Supplied by WTN-WDYL
- // | Nullified by WTN-WDYL
- // | Distribution via WebForum, ForumRU and associated file dumps
- // +-------------------------------------------------------------+
- // | DESKPRO IS NOT FREE SOFTWARE
- // +-------------------------------------------------------------+
- // | License ID : Full Enterprise License =) ...
- // | License Owner : WTN-WDYL Team
- // +-------------------------------------------------------------+
- // | $RCSfile: quickfind.php,v $
- // | $Date: 2004/02/10 01:34:32 $
- // | $Revision: 1.16 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - User search popup widget.
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- include "./../global.php";
- // which radio button do we want selected
- if ($_REQUEST['type'] == 'email') {
- $select_email = 1;
- } else {
- $select_username = 1;
- }
- ############################### CREATE FORM ###############################
- tech_mini_header();
- $rows[] = array('<B>Search by</B>', form_radio_single('type', 'username', $select_username) . ' Username ' . form_radio_single('type', 'email', $select_email) . ' E-mail');
- $rows[] = array('<B>Search for</B>', form_input('search'));
- $rows[] = array('', form_submit('Search'));
- echo '<form method="post" action="quickfind.php">';
- echo form_hidden('name', $_REQUEST['name']);
- echo simple_table('<center><b>Find Users</b></center>', $rows, '100%');
- echo '</form>';
- ############################### DISPLAY RESULTS ###############################
- if ($_REQUEST['name']) {
- $name = $_REQUEST['name'];
- } else {
- $name = 'User.user';
- }
- if ($_REQUEST['type'] == 'username') {
- $db->query("SELECT username, email, id FROM user WHERE username LIKE '%" . mysql_escape_string($_REQUEST['search']) . "%'");
- $total = $db->num_rows();
- $search = 1;
- } elseif ($_REQUEST['type'] == 'email') {
- $db->query("SELECT username, email, id FROM user WHERE email LIKE '%" . mysql_escape_string($_REQUEST['search']) . "%'");
- $total = $db->num_rows();
- $search = 1;
- } else {
- $search = 0;
- }
- while ($result = $db->row_array()) {
- $table[] = array($result[username], $result[email], "<a href="#" onClick="window.opener.document.$name.value='$result[username]'; window.close();">Select</a>n");
- }
- if (is_array($table)) {
- echo simple_table("<center><b>Users ($total matches)</b></center>", $table, '100%');
- } else {
- if ($search) {
- echo "<center><b>No results found. Please try again.</b></center>";
- } else {
- echo "<center><b>Ready to search.</B></center>";
- }
- }