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

Contents of /fenglin/bbs/search_user.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations)
Fri Mar 28 05:55:16 2025 UTC (11 months, 2 weeks ago) by sysadm
Branch: MAIN
Changes since 1.11: +1 -3 lines
Refine

1 <?
2 require_once "../lib/db_open.inc.php";
3 require_once "./session_init.inc.php";
4 require_once "./user_level.inc.php";
5 ?>
6 <?
7 $page_max_record=20;
8
9 if (isset($_GET["page"]))
10 $page=intval($_GET["page"]);
11 else
12 $page=1;
13 if ($page<1)
14 $page=1;
15
16 if (isset($_GET["type"]))
17 $type=intval($_GET["type"]);
18 else
19 $type=2;
20
21 if (isset($_GET["online"]))
22 $online=($_GET["online"]=="on");
23 else
24 $online=0;
25
26 if (isset($_GET["friend"]))
27 $friend=($_GET["friend"]=="on");
28 else
29 $friend=0;
30
31 if (isset($_GET["search_text"]))
32 $search_text=trim($_GET["search_text"]);
33 else
34 $search_text="";
35 $search_author=addslashes(stripslashes($search_text));
36
37 $rs=mysql_query("select user_online.SID from user_online WHERE UID = 0".
38 ($online ? " AND TIMESTAMPDIFF(SECOND, last_tm, NOW()) <= $BBS_user_off_line" : ""))
39 or die("Count guest error!");
40 $guest_count=mysql_num_rows($rs);
41 mysql_free_result($rs);
42
43 $rs=mysql_query("select user_online.SID from user_online WHERE UID <> 0".
44 ($online ? " AND TIMESTAMPDIFF(SECOND, last_tm, NOW()) <= $BBS_user_off_line" : ""))
45 or die("Count user error!");
46 $user_count=mysql_num_rows($rs);
47 mysql_free_result($rs);
48
49 $rs=mysql_query("select count(user_list.UID) as rec_count from user_list".
50 ($online?" inner join user_online on user_list.UID=user_online.UID":"").
51 ($friend?" inner join friend_list on user_list.UID=friend_list.fUID":"").
52 " inner join user_pubinfo on user_list.UID=user_pubinfo.UID where".
53 " user_list.enable and ".($type==1?"user_pubinfo.nickname":"user_list.username").
54 " like '%$search_author%'".
55 ($online ? " AND TIMESTAMPDIFF(SECOND, last_tm, NOW()) <= $BBS_user_off_line" : "").
56 ($friend ? " and friend_list.UID=".$_SESSION["BBS_uid"]:"")
57 )
58 or die("Query user error!");
59
60 $row=mysql_fetch_array($rs);
61 $u_count=$row["rec_count"];
62
63 mysql_free_result($rs);
64
65 $toa=$u_count;
66 if ($toa==0)
67 $toa=1;
68
69 $page_total=intval($toa/$page_max_record);
70 if (($toa % $page_max_record)>0)
71 $page_total++;
72 if ($page>$page_total)
73 $page=$page_total;
74 ?>
75 <html>
76 <head>
77 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
78 <title>用户查找结果</title>
79 <link rel="stylesheet" href="css/default.css" type="text/css">
80
81 <style type="text/css">
82 TD.head,TD.level,TD.login_dt,TD.dark,TD.username
83 {
84 border-right: #d0d3F0 1px solid;
85 border-left: #d0d3F0 1px solid;
86 border-bottom: #d0d3F0 1px solid;
87 }
88 TD.head
89 {
90 font-family: 楷体;
91 color:#909090;
92 }
93 TD.login_dt,TD.level,TD.dark,TD.username
94 {
95 text-align:center;
96 }
97 TD.login_dt,TD.dark
98 {
99 color:#909090;
100 background-color:#eaf0Fa;
101 }
102 TD.head,TD.level
103 {
104 background-color:#fafbfc;
105 }
106 TD.level
107 {
108 color:orange;
109 }
110 </style>
111
112 <script language="JavaScript" src="/js/nw_open.js"></script>
113 </head>
114 <body>
115 <center>
116 <table cols="2" border="0" cellpadding="0" cellspacing="0" width="770">
117 <tr>
118 <td colspan="2" style="color:green;">
119 <a class="s2" href="main.php"><? echo $BBS_name; ?></a>&gt;&gt;查找<? echo ($online?"在线":""); ?><? echo ($friend?"好友":"用户"); ?>
120 </td>
121 </tr>
122 <tr bgcolor="#d0d3F0" height="2">
123 <td colspan="2"></td></tr>
124 <tr>
125 <td class="dark" width="3%"></td>
126 <td class="head" width="97%">
127 <? if ($u_count==0)
128 {
129 ?>
130 未找到指定用户<? }
131 else
132 {
133 ?>用户查找结果(共<? echo $u_count; ?>位)<? } ?>
134 (当前在线注册用户<? echo $user_count; ?>位,游客<? echo $guest_count; ?>位)
135 </td>
136 </tr>
137 </table>
138 <table border="0" cellpadding="1" cellspacing="0" width="770">
139 <tr height="10">
140 <td>
141 </td>
142 </tr>
143 </table>
144 <table bgcolor="#f0F3Fa" border="0" cellpadding="0" cellspacing="0" width="770">
145 <tr bgcolor="#d0d3F0" height="20">
146 <td class="title" width="4%"></td>
147 <td class="title" width="15%">用户ID</td>
148 <td class="title" width="20%">昵称</td>
149 <td class="title" width="12%">等级</td>
150 <td class="title" width="18%">最后登陆时间</td>
151 <td class="title" width="27%"></td>
152 <td class="title" width="4%"></td>
153 </tr>
154 <?
155 $color[0]="#f0F3Fa";
156 $color[1]="#FAFBFC";
157 $color_index=-1;
158 $color_count=2;
159
160 $rs=mysql_query("select user_list.UID,username,nickname,exp,".
161 "gender,gender_pub,last_login_dt from user_list".
162 ($online?" inner join user_online on user_list.UID=user_online.UID":"").
163 ($friend?" inner join friend_list on user_list.UID=friend_list.fUID":"").
164 " inner join user_pubinfo on user_list.UID=user_pubinfo.UID where".
165 " user_list.enable and ".($type==1?"user_pubinfo.nickname":"user_list.username").
166 " like '%$search_author%'".
167 ($online ? " AND TIMESTAMPDIFF(SECOND, last_tm, NOW()) <= $BBS_user_off_line":"").
168 ($friend ? " and friend_list.UID=".$_SESSION["BBS_uid"]:"").
169 " order by ".($type==1?"nickname":"username").
170 " limit ".($page-1)*$page_max_record.",$page_max_record")
171 or die("Query user error!");
172
173 while($row=mysql_fetch_array($rs))
174 {
175 $color_index=($color_index+1)%$color_count;
176 ?>
177 <tr height="25">
178 <td class="dark">
179 <?
180 if ($row["gender_pub"])
181 {
182 if ($row["gender"] == 'M')
183 echo ("<font color=blue>♂</font>");
184 else
185 echo ("<font color=red>♀</font>");
186 }
187 else
188 {
189 echo ("<font color=green>?</font>");
190 }
191 ?>
192 </td>
193 <td class="username" bgcolor="#fafbfc" onmouseover="this.bgColor='#eaf0Fa';" onmouseout="this.bgColor='#fafbfc';">
194 <a class="s2" href="javascript:show_profile(<? echo $row["UID"]; ?>)"><? echo $row["username"]; ?></a>
195 </td>
196 <td class="dark">
197 <? echo $row["nickname"]; ?>
198 </td>
199 <td class="level">
200 <? echo user_level($row["exp"]); ?>
201 </td>
202 <td class="login_dt">
203 <? echo $row["last_login_dt"]; ?>
204 </td>
205 <td class="level">
206 <a class="s2" href="javascript:NW_open('send_msg.php?user_id=<? echo $row["UID"]; ?>','send_msg',500,300)">发送消息</a>
207 </td>
208 <td align="center">
209 </td>
210 </tr>
211 <?
212 }
213 ?>
214 </table>
215 <?
216 mysql_free_result($rs);
217 mysql_close($db_conn);
218 ?>
219 <table cols="3" border="0" cellpadding="5" cellspacing="0" width="770">
220 <tr bgcolor="#d0d3F0" height="10">
221 <td colspan="3" >
222 </td>
223 </tr>
224 <tr height="10">
225 <td colspan="3" >
226 </td>
227 </tr>
228 <tr>
229 <td width="25%" align="center" style="color:#909090">
230 <form action="search_user.php" method="get" id="change_page" name="change_page">
231 <input type="hidden" id="search_text" name="search_text" value="<? echo $search_text;?>">
232 <input type="hidden" id="online" name="online" value="<? echo ($online?"on":"off"); ?>">
233 <input type="hidden" id="friend" name="friend" value="<? echo ($friend?"on":"off"); ?>">
234 分页: <? echo $page; ?>/<? echo $page_total; ?>页
235 <? if ($page>1)
236 {
237 ?><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><? }
238 else
239 {
240 ?><font face=webdings>97</font><? } ?>
241 <input id="page_id" name="page" value="<? echo ($page) ; ?>" size="2">
242 <? if ($page<$page_total)
243 {
244 ?><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><? }
245 else
246 {
247 ?><font face=webdings>8:</font><? } ?>
248 </form>
249 </td>
250 <td width="50" align="center">
251 <form action="search_user.php" method="get" id="search">
252 <font color=#909090>查找用户</font>
253 <select name="type">
254 <option value="2" <? if ($type==2) echo "selected"; ?> >按用户名</option>
255 <option value="1" <? if ($type==1) echo "selected"; ?> >按昵称</option>
256 </select>
257 <input type="text" id="search_text" name="search_text" size="15">
258 <input type="checkbox" id="online" name="online" <? echo ($online?"checked":"");?> ><font color=#909090>在线</font>
259 <input type="checkbox" id="friend" name="friend" <? echo ($friend?"checked":"");?> ><font color=#909090>好友</font>
260 <input type=image src="images/search.gif" alt="查找用户" border="0" name="image"></a>
261 </form>
262 </td>
263 <td width="25">
264 </td>
265 </tr>
266 </table>
267 </center>
268 <?
269 include "./foot.inc.php";
270 ?>
271 </body>
272 </html>

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