/[LeafOK_CVS]/fenglin/bbs/search_user.php
ViewVC logotype

Diff of /fenglin/bbs/search_user.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.5 by sysadm, Sun Dec 5 09:59:38 2004 UTC Revision 1.20 by sysadm, Sun Apr 6 03:46:57 2025 UTC
# Line 1  Line 1 
1  <?  <?
2            require_once "../lib/db_open.inc.php";
3          require_once "./session_init.inc.php";          require_once "./session_init.inc.php";
4          require_once "./user_level.inc.php";          require_once "./user_level.inc.php";
5  ?>  ?>
6  <?  <?
7  set_user_action("search_user");  $page = (isset($_GET["page"]) ? intval($_GET["page"]) : 1);
8    $rpp = (isset($_GET["rpp"]) ? intval($_GET["rpp"]) : 20);
 $page_max_record=20;  
9    
10  if (isset($_GET["page"]))  $type = (isset($_GET["type"]) ? intval($_GET["type"]) : 0);
11          $page=intval($_GET["page"]);  $online = (isset($_GET["online"]) && $_GET["online"] == "1" ? 1 : 0);
12  else  $friend = (isset($_GET["friend"]) && $_GET["friend"] == "1" ? 1 : 0);
13          $page=1;  $search_text = (isset($_GET["search_text"]) ? $_GET["search_text"] : "");
14  if ($page<1)  
15          $page=1;  $sql = "SELECT IF(UID = 0, 1, 0) AS is_guest, COUNT(*) AS u_count FROM user_online
16                    WHERE last_tm >= SUBDATE(NOW(), INTERVAL $BBS_user_off_line SECOND)
17                    GROUP BY is_guest";
18    
19  if (isset($_GET["type"]))  $rs = mysqli_query($db_conn, $sql);
20          $type=intval($_GET["type"]);  if ($rs == false)
21  else  {
22          $type=2;          echo("Count online user error" . mysqli_error($db_conn));
23            exit();
24    }
25    
26  if (isset($_GET["online"]))  $guest_online = 0;
27          $online=($_GET["online"]=="on");  $user_online = 0;
 else  
         $online=0;  
28    
29  if (isset($_GET["friend"]))  while ($row = mysqli_fetch_array($rs))
30          $friend=($_GET["friend"]=="on");  {
31  else          if ($row["is_guest"])
32          $friend=0;          {
33                    $guest_online = $row["u_count"];
34            }
35            else
36            {
37                    $user_online = $row["u_count"];
38            }
39    }
40    mysqli_free_result($rs);
41    
42  if (isset($_GET["search_text"]))  $sql = "SELECT COUNT(user_list.UID) AS rec_count FROM user_list" .
43          $search_text=trim($_GET["search_text"]);                  ($online ? " INNER JOIN user_online ON user_list.UID = user_online.UID" : "") .
44  else                  ($friend ? " INNER JOIN friend_list ON user_list.UID = friend_list.fUID" : "") .
45          $search_text="";                  ($type == 1 ? " INNER JOIN user_pubinfo ON user_list.UID = user_pubinfo.UID" : "") .
46  $search_author=addslashes(stripslashes($search_text));                  " WHERE user_list.enable AND ".
47                    ($type == 1 ? "nickname" : "username") .
48                    " LIKE '%" . mysqli_real_escape_string($db_conn, $search_text) . "%'" .
49                    ($online ? " AND last_tm >= SUBDATE(NOW(), INTERVAL $BBS_user_off_line SECOND)" : "").
50                    ($friend ? " AND friend_list.UID = " . $_SESSION["BBS_uid"] : "");
51    
52  $db_conn=include "./db_open.inc.php";  $rs = mysqli_query($db_conn, $sql);
53    if ($rs == false)
54    {
55            echo("Query user error" . mysqli_error($db_conn));
56            exit();
57    }
58    
59  $rs=mysql_query("select user_online.UID from user_online".  if ($row = mysqli_fetch_array($rs))
60          " where UID=0 and current_action not in".  {
61          " ('max_user_limit','max_ip_limit','max_session_limit','exit')".          $toa = $row["rec_count"];
62          " group by SID")  }
         or die("Count guest error!");  
 $guest_count=mysql_num_rows($rs);  
 mysql_free_result($rs);  
   
 $rs=mysql_query("select user_online.UID from user_online".  
         " where UID<>0 and current_action not in".  
         " ('max_user_limit','max_ip_limit','max_session_limit','exit')".  
         " group by SID")  
         or die("Count user error!");  
 $user_count=mysql_num_rows($rs);  
 mysql_free_result($rs);  
   
 $rs=mysql_query("select count(user_list.UID) as rec_count from user_list".  
         ($online?" inner join user_online on user_list.UID=user_online.UID":"").  
         ($friend?" inner join friend_list on user_list.UID=friend_list.fUID":"").  
         " inner join user_pubinfo on user_list.UID=user_pubinfo.UID where".  
         " user_list.enable and ".($type==1?"user_pubinfo.nickname":"user_list.username").  
         " like '%$search_author%'".  
         ($online ? " and current_action not in".  
         " ('max_user_limit','max_ip_limit','max_session_limit','exit')":"").  
         ($friend ? " and friend_list.UID=".$_SESSION["BBS_uid"]:"")  
         )  
         or die("Query user error!");  
63    
64  $row=mysql_fetch_array($rs);  mysqli_free_result($rs);
 $u_count=$row["rec_count"];  
65    
66  mysql_free_result($rs);  if (!in_array($rpp, $BBS_list_rpp_options))
67    {
68            $rpp = $BBS_list_rpp_options[0];
69    }
70    
71  $toa=$u_count;  $page_total = ceil($toa / $rpp);
72  if ($toa==0)  if ($page > $page_total)
73          $toa=1;  {
74            $page = $page_total;
75    }
76    
77  $page_total=intval($toa/$page_max_record);  if ($page <= 0)
78  if (($toa % $page_max_record)>0)  {
79          $page_total++;          $page = 1;
80  if ($page>$page_total)  }
         $page=$page_total;  
81  ?>  ?>
82  <html>  <html>
83          <head>          <head>
84                  <meta http-equiv="Content-Type" content="text/html; charset=gb2312">                  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
85                  <title>用户查找结果</title>                  <title>鐢ㄦ埛鏌ユ壘缁撴灉</title>
86                  <link rel="stylesheet" href="css/default.css" type="text/css">                  <link rel="stylesheet" href="css/default.css" type="text/css">
   
87  <style type="text/css">  <style type="text/css">
88  TD.head,TD.level,TD.login_dt,TD.dark,TD.username  TD.head,TD.level,TD.login_dt,TD.dark,TD.username
89  {  {
# Line 95  TD.head,TD.level,TD.login_dt,TD.dark,TD. Line 93  TD.head,TD.level,TD.login_dt,TD.dark,TD.
93  }  }
94  TD.head  TD.head
95  {  {
96          font-family: 楷体_GB2312;          font-family: 妤蜂綋;
97          color:#909090;          color: #909090;
98  }  }
99  TD.login_dt,TD.level,TD.dark,TD.username  TD.login_dt,TD.level,TD.dark,TD.username
100  {  {
101          text-align:center;          text-align: center;
102  }  }
103  TD.login_dt,TD.dark  TD.login_dt,TD.dark
104  {  {
105          color:#909090;          color: #909090;
106          background-color:#eaf0Fa;          background-color: #eaf0Fa;
107  }  }
108  TD.head,TD.level  TD.head,TD.level
109  {  {
110          background-color:#fafbfc;          background-color: #fafbfc;
111  }  }
112  TD.level  TD.level
113  {  {
114          color:orange;          color: orange;
115    }
116    TD.username
117    {
118            background-color: #fafbfc;
119    }
120    TD.username:hover
121    {
122            background-color: #eaf0Fa;
123  }  }
124  </style>  </style>
125    
126                  <script language="JavaScript" src="/js/nw_open.js"></script>  <script type="text/javascript" src="../js/nw_open.js"></script>
127    <script type="text/javascript">
128    function ch_page(page)
129    {
130            document.change_page.page.value = page;
131            document.change_page.submit();
132            return false;
133    }
134    
135    function ch_rpp()
136    {
137            document.change_page.page.value = Math.floor((document.change_page.page.value - 1) * <? echo $rpp; ?> / document.change_page.rpp.value) + 1;
138            document.change_page.submit();
139            return false;
140    }
141    </script>
142          </head>          </head>
143          <body>          <body>
144                  <center>                  <center>
145                          <table cols="2" border="0" cellpadding="0" cellspacing="0" width="770">                          <table cols="2" border="0" cellpadding="0" cellspacing="0" width="770">
146                                  <tr>                                  <tr>
147                                          <td colspan="2" style="color:green;">                                          <td colspan="2" style="color:green;">
148                                                  <a class="s2" href="main.php">枫林在线论坛</a>&gt;&gt;查找<? echo ($online?"在线":""); ?><? echo ($friend?"好友":"用户"); ?>                                                  <a class="s2" href="main.php"><? echo $BBS_name; ?></a>&gt;&gt;鏌ユ壘<? echo ($online?"鍦ㄧ嚎":""); ?><? echo ($friend?"濂藉弸":"鐢ㄦ埛"); ?>
149                                          </td>                                          </td>
150                                  </tr>                                  </tr>
151                                  <tr bgcolor="#d0d3F0" height="2">                                  <tr bgcolor="#d0d3F0" height="2">
# Line 132  TD.level Line 153  TD.level
153                                  <tr>                                  <tr>
154                                          <td class="dark" width="3%"></td>                                          <td class="dark" width="3%"></td>
155                                          <td class="head" width="97%">                                          <td class="head" width="97%">
156                                                  <? if ($u_count==0)  <?
157    if ($toa==0)
158  {  {
159  ?>  ?>鏈壘鍒版寚瀹氱敤鎴<?
160                                                  未找到指定用户<? }  }
161          else  else
162  {  {
163  ?>用户查找结果(共<? echo $u_count; ?>位)<? } ?>  ?>鐢ㄦ埛鏌ユ壘缁撴灉锛堝叡<? echo $toa; ?>浣嶏級
164                                                  (当前在线注册用户<? echo $user_count; ?>位,游客<? echo $guest_count; ?>位)  <?
165    }
166    ?>锛堝綋鍓嶅湪绾挎敞鍐岀敤鎴<? echo $user_online; ?>浣嶏紝娓稿<? echo $guest_online; ?>浣嶏級
167                                          </td>                                          </td>
168                                  </tr>                                  </tr>
169                          </table>                          </table>
# Line 152  TD.level Line 176  TD.level
176                          <table bgcolor="#f0F3Fa" border="0" cellpadding="0" cellspacing="0" width="770">                          <table bgcolor="#f0F3Fa" border="0" cellpadding="0" cellspacing="0" width="770">
177                                  <tr bgcolor="#d0d3F0" height="20">                                  <tr bgcolor="#d0d3F0" height="20">
178                                          <td class="title" width="4%"></td>                                          <td class="title" width="4%"></td>
179                                          <td class="title" width="15%">用户ID</td>                                          <td class="title" width="15%">鐢ㄦ埛ID</td>
180                                          <td class="title" width="20%">昵称</td>                                          <td class="title" width="20%">鏄电О</td>
181                                          <td class="title" width="12%">等级</td>                                          <td class="title" width="12%">绛夌骇</td>
182                                          <td class="title" width="18%">最后登陆时间</td>                                          <td class="title" width="18%">鏈鍚庣櫥闄嗘椂闂</td>
183                                          <td class="title" width="27%"></td>                                          <td class="title" width="27%"></td>
184                                          <td class="title" width="4%"></td>                                          <td class="title" width="4%"></td>
185                                  </tr>                                  </tr>
186                                  <?  <?
187  $color[0]="#f0F3Fa";  $sql = "SELECT user_list.UID, username, nickname, exp, gender, gender_pub, last_login_dt FROM user_list" .
188  $color[1]="#FAFBFC";                  ($online ? " INNER JOIN user_online ON user_list.UID = user_online.UID" : "") .
189  $color_index=-1;                  ($friend ? " INNER JOIN friend_list ON user_list.UID = friend_list.fUID" : "") .
190  $color_count=2;                  " INNER JOIN user_pubinfo ON user_list.UID = user_pubinfo.UID WHERE user_list.enable AND ".
191                    ($type == 1 ? "nickname" : "username") .
192  $rs=mysql_query("select user_list.UID,username,nickname,exp,".                  " LIKE '%" . mysqli_real_escape_string($db_conn, $search_text) . "%'" .
193          "gender,gender_pub,last_login_dt from user_list".                  ($online ? " AND last_tm >= SUBDATE(NOW(), INTERVAL $BBS_user_off_line SECOND)" : "").
194          ($online?" inner join user_online on user_list.UID=user_online.UID":"").                  ($friend ? " AND friend_list.UID = " . $_SESSION["BBS_uid"] : "") .
195          ($friend?" inner join friend_list on user_list.UID=friend_list.fUID":"").                  " ORDER BY " . ($type == 1 ? "nickname" : "username") .
196          " inner join user_pubinfo on user_list.UID=user_pubinfo.UID where".                  " LIMIT " . ($page-1) * $rpp . ", $rpp";
197          " user_list.enable and ".($type==1?"user_pubinfo.nickname":"user_list.username").  
198          " like '%$search_author%'".  $rs = mysqli_query($db_conn, $sql);
199          ($online ? " and current_action not in".  if ($rs == false)
200          " ('max_user_limit','max_ip_limit','max_session_limit','exit')":"").  {
201          ($friend ? " and friend_list.UID=".$_SESSION["BBS_uid"]:"").          echo("Query user error" . mysqli_error($db_conn));
202          " order by ".($type==1?"nickname":"username").          exit();
203          " limit ".($page-1)*$page_max_record.",$page_max_record")  }
         or die("Query user error!");  
204    
205  while($row=mysql_fetch_array($rs))  while ($row = mysqli_fetch_array($rs))
206  {  {
         $color_index=($color_index+1)%$color_count;  
207  ?>  ?>
208                                  <tr height="25">                                  <tr height="25">
209                                          <td class="dark">                                          <td class="dark">
# Line 189  while($row=mysql_fetch_array($rs)) Line 211  while($row=mysql_fetch_array($rs))
211          if ($row["gender_pub"])          if ($row["gender_pub"])
212          {          {
213                  if ($row["gender"] == 'M')                  if ($row["gender"] == 'M')
214                          echo ("<font color=blue>♂</font>");                  {
215                            echo ("<font color=blue>鈾</font>");
216                    }
217                  else                  else
218                          echo ("<font color=red>♀</font>");                  {
219                            echo ("<font color=red>鈾</font>");
220                    }
221          }          }
222          else          else
223          {          {
# Line 199  while($row=mysql_fetch_array($rs)) Line 225  while($row=mysql_fetch_array($rs))
225          }          }
226  ?>  ?>
227                                          </td>                                          </td>
228                                          <td class="username" bgcolor="#fafbfc" onmouseover="this.bgColor='#eaf0Fa';" onmouseout="this.bgColor='#fafbfc';">                                          <td class="username">
229                                                  <a class="s2" href="javascript:show_profile(<? echo $row["UID"]; ?>)"><? echo $row["username"]; ?></a>                                                  <a class="s2" href="show_profile.php?uid=<? echo $row["UID"]; ?>" target=_blank><? echo $row["username"]; ?></a>
230                                          </td>                                          </td>
231                                          <td class="dark">                                          <td class="dark">
232                                                  <? echo $row["nickname"]; ?>                                                  <? echo $row["nickname"]; ?>
# Line 212  while($row=mysql_fetch_array($rs)) Line 238  while($row=mysql_fetch_array($rs))
238                                                  <? echo $row["last_login_dt"]; ?>                                                  <? echo $row["last_login_dt"]; ?>
239                                          </td>                                          </td>
240                                          <td class="level">                                          <td class="level">
241                                                  <a class="s2" href="javascript:NW_open('send_msg.php?user_id=<? echo $row["UID"]; ?>','send_msg',500,300)">发送消息</a>  <?
242                                                  <a class="s2" href="javascript:NW_open('bbs_email.php?user_id=<? echo $row["UID"]; ?>','send_msg',500,300)">发送邮件</a>          if ($_SESSION["BBS_priv"]->checkpriv(0, S_MSG))
243            {
244    ?>
245                                                    <a class="s2" href="" onclick="return NW_open('send_msg.php?uid=<? echo $row["UID"]; ?>', 'send_msg', 500, 300);">鍙戦佹秷鎭</a>
246    <?
247            }
248    ?>
249                                          </td>                                          </td>
250                                          <td align="center">                                          <td align="center">
251                                          </td>                                          </td>
252                                  </tr>                                  </tr>
253  <?  <?
254  }  }
255    
256    mysqli_free_result($rs);
257  ?>  ?>
258                          </table>                          </table>
 <?  
 mysql_free_result($rs);  
 mysql_close($db_conn);  
 ?>  
259                          <table cols="3" border="0" cellpadding="5" cellspacing="0" width="770">                          <table cols="3" border="0" cellpadding="5" cellspacing="0" width="770">
260                                  <tr bgcolor="#d0d3F0" height="10">                                  <tr bgcolor="#d0d3F0" height="10">
261                                          <td colspan="3" >                                          <td colspan="3" >
# Line 236  mysql_close($db_conn); Line 266  mysql_close($db_conn);
266                                          </td>                                          </td>
267                                  </tr>                                  </tr>
268                                  <tr>                                  <tr>
269      <td width="25%" align="center" style="color:#909090">                                  <form action="search_user.php" method="get" id="change_page" name="change_page">
270      <form action="search_user.php" method="get" id="change_page" name="change_page">                                          <td width="30%" style="color:#909090">
271        <input type="hidden" id="search_text" name="search_text" value="<? echo $search_text;?>">                                          姣忛〉<select size="1" id="rpp" name="rpp" onchange="ch_rpp();">
272        <input type="hidden" id="online" name="online" value="<? echo ($online?"on":"off"); ?>">  <?
273        <input type="hidden" id="friend" name="friend" value="<? echo ($friend?"on":"off"); ?>">          foreach ($BBS_list_rpp_options as $v)
274        分页: <? echo $page; ?>/<? echo $page_total; ?>页          {
275  <? if ($page>1)                  echo ("<option value=\"$v\"" . ($v == $rpp ? " selected" : "") . ">$v</option>");
276  {          }
277  ?><a class="s8" title="首页" href="search_user.php?page=1&amp;type=<? echo $type; ?>&amp;online=<? echo ($online?"on":"off"); ?>&amp;friend=<? echo ($friend?"on":"off"); ?><? if ($search_text!="") echo "&amp;search_text=".$search_text;?>"><font face=webdings>9</font></a><a class="s8" title="上一页" href="search_user.php?page=<? echo $page-1; ?>&amp;type=<? echo $type; ?>&amp;online=<? echo ($online?"on":"off"); ?>&amp;friend=<? echo ($friend?"on":"off"); ?><? if ($search_text!="") echo "&amp;search_text=".$search_text;?>"><font face=webdings>7</font></a><? }  ?>
278    else                          </select>浜
279  {                          <?
280  ?><font face=webdings>97</font><? } ?>  if ($page > 1)
281        <input id="page_id" name="page" value="<? echo ($page) ; ?>" size="2">  {
282  <? if ($page<$page_total)  ?>
283  {                          <a class="s8" title="棣栭〉" href="" onclick="return ch_page(1);"><font face=webdings>9</font></a>
284  ?><a class="s8" title="下一页" href="search_user.php?page=<? echo $page+1; ?>&amp;type=<? echo $type; ?>&amp;online=<? echo ($online?"on":"off"); ?>&amp;friend=<? echo ($friend?"on":"off"); ?><? if ($search_text!="") echo "&amp;search_text=".$search_text;?>"><font face=webdings>8</font></a><a class="s8" title="尾页" href="search_user.php?page=<? echo $page_total; ?>&amp;type=<? echo $type; ?>&amp;online=<? echo ($online?"on":"off"); ?>&amp;friend=<? echo ($friend?"on":"off"); ?><? if ($search_text!="") echo "&amp;search_text=".$search_text;?>"><font face=webdings>:</font></a><? }                          <a class="s8" title="涓婁竴椤" href="" onclick="return ch_page(<? echo ($page - 1); ?>);"><font face=webdings>7</font></a>
285    else  <?
286  {  }
287  ?><font face=webdings>8:</font><? } ?>  else
288      </form>  {
289      </td>  ?>
290                                          <td width="50" align="center">  <font face=webdings>9 7</font>
291                                                  <form action="search_user.php" method="get" id="search">  <?
292                                                          <font color=#909090>查找用户</font>  }
293                                                          <select name="type">  ?>
294                                                                  <option value="2" <? if ($type==2) echo "selected"; ?> >按用户名</option>                  绗<input id="page" name="page" value="<? echo ($page) ; ?>" style="width: 30px;">/<? echo $page_total; ?>椤
295                                                                  <option value="1" <? if ($type==1) echo "selected"; ?> >按昵称</option>  <?
296                                                          </select>  if ($page < $page_total)
297                                                          <input type="text" id="search_text" name="search_text" size="15">  {
298                                                          <input type="checkbox" id="online" name="online" <? echo ($online?"checked":"");?> ><font color=#909090>在线</font>  ?>
299                                                          <input type="checkbox" id="friend" name="friend" <? echo ($friend?"checked":"");?> ><font color=#909090>好友</font>                          <a class="s8" title="涓嬩竴椤" href="" onclick="return ch_page(<? echo ($page + 1); ?>);"><font face=webdings>8</font></a>
300                                                          <input type=image src="images/search.gif" alt="查找用户" border="0" name="image"></a>                          <a class="s8" title="灏鹃〉" href="" onclick="return ch_page(<? echo ($page_total); ?>);"><font face=webdings>:</font></a>
301                                                  </form>  <?
302    }
303    else
304    {
305    ?>
306    <font face=webdings>8 :</font>
307    <?
308    }
309    ?>
310                                            </td>
311                                            <td width="50%">
312                                                    <select name="type">
313                                                            <option value="0" <? if ($type==0) echo "selected"; ?> >鎸夌敤鎴峰悕</option>
314                                                            <option value="1" <? if ($type==1) echo "selected"; ?> >鎸夋樀绉</option>
315                                                    </select>
316                                                    <input type="text" id="search_text" name="search_text" size="15" value="<? echo $search_text;?>">
317                                                    <input type="checkbox" id="online" name="online" value="1" <? echo ($online ? "checked" : "");?>><font color=#909090>鍦ㄧ嚎</font>
318                                                    <input type="checkbox" id="friend" name="friend" value="1" <? echo ($friend ? "checked" : "");?>><font color=#909090>濂藉弸</font>
319                                                    <input type=image src="images/search.gif" alt="鏌ユ壘鐢ㄦ埛" border="0" name="image"></a>
320                                          </td>                                          </td>
321                                          <td width="25">                                          <td width="10%">
322                                          </td>                                          </td>
323                                            </form>
324                                  </tr>                                  </tr>
325                          </table>                          </table>
326                  </center>                  </center>
327  <?  <?
328          include "./foot.inc.php";  mysqli_close($db_conn);
329    
330    include "./foot.inc.php";
331  ?>  ?>
332          </body>          </body>
333  </html>  </html>
   


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1