/[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.11 - (show annotations)
Thu Mar 27 12:29:03 2025 UTC (11 months, 3 weeks ago) by sysadm
Branch: MAIN
Changes since 1.10: +6 -12 lines
Refine

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

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