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

Annotation of /fenglin/bbs/search_user.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (hide annotations)
Mon Mar 17 13:21:14 2025 UTC (12 months ago) by sysadm
Branch: MAIN
Changes since 1.9: +0 -1 lines
Refine

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

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