--- fenglin/bbs/search_user.php 2004/06/10 01:56:34 1.2 +++ fenglin/bbs/search_user.php 2025/04/14 11:23:46 1.22 @@ -1,153 +1,262 @@ -= SUBDATE(NOW(), INTERVAL $BBS_user_off_line SECOND) + GROUP BY is_guest"; -if (isset($_GET["page"])) - $page=intval($_GET["page"]); -else - $page=1; -if ($page<1) - $page=1; +$rs = mysqli_query($db_conn, $sql); +if ($rs == false) +{ + echo("Count online user error" . mysqli_error($db_conn)); + exit(); +} -if (isset($_GET["type"])) - $type=intval($_GET["type"]); -else - $type=1; -if (!($_SESSION["BBS_priv"]->checklevel(P_ADMIN_M) || - $_SESSION["BBS_priv"]->checklevel(P_ADMIN_S) || - $_SESSION["BBS_priv"]->checklevel(P_MAN_C))) +$guest_online = 0; +$user_online = 0; + +while ($row = mysqli_fetch_array($rs)) { - $type=1; + if ($row["is_guest"]) + { + $guest_online = $row["u_count"]; + } + else + { + $user_online = $row["u_count"]; + } } +mysqli_free_result($rs); -if (isset($_GET["search_text"])) - $search_text=trim($_GET["search_text"]); -else - $search_text=""; -$search_author=addslashes(stripslashes($search_text)); +$sql = "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" : "") . + ($type == 1 ? " INNER JOIN user_pubinfo ON user_list.UID = user_pubinfo.UID" : "") . + " WHERE user_list.enable AND ". + ($type == 1 ? "nickname" : "username") . + " LIKE '%" . mysqli_real_escape_string($db_conn, $search_text) . "%'" . + ($online ? " AND last_tm >= SUBDATE(NOW(), INTERVAL $BBS_user_off_line SECOND)" : ""). + ($friend ? " AND friend_list.UID = " . $_SESSION["BBS_uid"] : ""); -$db_conn=include "./db_open.inc.php"; +$rs = mysqli_query($db_conn, $sql); +if ($rs == false) +{ + echo("Query user error" . mysqli_error($db_conn)); + exit(); +} -$rs=mysql_query("select count(user_list.UID) as rec_count from user_list". - " 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%'") - or die("Query user error!"); +if ($row = mysqli_fetch_array($rs)) +{ + $toa = $row["rec_count"]; +} -$row=mysql_fetch_array($rs); -$toa=$u_count=$row["rec_count"]; +mysqli_free_result($rs); -mysql_free_result($rs); +if (!in_array($rpp, $BBS_list_rpp_options)) +{ + $rpp = $BBS_list_rpp_options[0]; +} -if ($toa==0) - $toa=1; +$page_total = ceil($toa / $rpp); +if ($page > $page_total) +{ + $page = $page_total; +} -$page_total=intval($toa/$page_max_record); -if (($toa % $page_max_record)>0) - $page_total++; -if ($page>$page_total) - $page=$page_total; +if ($page <= 0) +{ + $page = 1; +} ?> - - 用户查找结果 + + 鐢ㄦ埛鏌ユ壘缁撴灉 - + + + +
- - - + + + + + + +
- +
+ >>鏌ユ壘 +
+ - 未找到指定用户鏈壘鍒版寚瀹氱敤鎴用户查找结果(共位) +?>鐢ㄦ埛鏌ユ壘缁撴灉锛堝叡浣嶏級 +锛堝綋鍓嶅湪绾挎敞鍐岀敤鎴浣嶏紝娓稿浣嶏級
- - - - - - - - - -
- - - - - - - + + + - +
+ + + + + + + + + += SUBDATE(NOW(), INTERVAL $BBS_user_off_line SECOND)" : ""). + ($friend ? " AND friend_list.UID = " . $_SESSION["BBS_uid"] : "") . + " ORDER BY " . ($type == 1 ? "nickname" : "username") . + " LIMIT " . ($page-1) * $rpp . ", $rpp"; -$rs=mysql_query("select user_list.UID,username,nickname,". - "IF(user_pubinfo.gender_pub,IF(user_pubinfo.gender='M',". - "'',''),'') as gender". - " from user_list". - " 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%' order by ".($type==1?"nickname":"username"). - " limit ".($page-1)*$page_max_record.",$page_max_record") - or die("Query user error!"); +$rs = mysqli_query($db_conn, $sql); +if ($rs == false) +{ + echo("Query user error" . mysqli_error($db_conn)); + exit(); +} -do +while ($row = mysqli_fetch_array($rs)) { - $color_index=($color_index+1)%$color_count; ?> - - - + - 鈾"); } - else + else { + echo (""); + } + } + else + { + echo ("?"); + } ?> - - + " target=_blank> + + + + +
鐢ㄦ埛ID鏄电О绛夌骇鏈鍚庣櫥闄嗘椂闂
- + - - )"> - + + + + +checkpriv(0, S_MSG)) + { +?> + ', 'send_msg', 500, 300);">鍙戦佹秷鎭 + +
- - +
@@ -157,52 +266,68 @@ mysql_close($db_conn); - - - + +
-
- - 分页: /页 -1) -{ -?>97 +
+ 姣忛〉浜 + 1) { -?>97 - - + |鈼 + +8: +|鈼 鈼 + + 绗/椤 +8: - - - + + + + >鍦ㄧ嚎 + >濂藉弸 + +
-