--- fenglin/bbs/search_user.php 2004/06/07 06:04:16 1.1 +++ fenglin/bbs/search_user.php 2025/04/23 05:13:56 1.25 @@ -1,206 +1,157 @@ - -checklevel(P_ADMIN_M) || - $_SESSION["BBS_priv"]->checklevel(P_ADMIN_S) || - $_SESSION["BBS_priv"]->checklevel(P_MAN_C))) -{ - $type=1; -} - -if (isset($_GET["search_text"])) - $search_text=trim($_GET["search_text"]); -else - $search_text=""; -$search_author=addslashes(stripslashes($search_text)); - -$db_conn=include "./db_open.inc.php"; - -$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!"); - -$row=mysql_fetch_array($rs); -$toa=$u_count=$row["rec_count"]; - -mysql_free_result($rs); - -if ($toa==0) - $toa=1; - -$page_total=intval($toa/$page_max_record); -if (($toa % $page_max_record)>0) - $page_total++; -if ($page>$page_total) - $page=$page_total; -?> - - - - 用户查找结果 - - - - -
- - - - -
- - 未找到指定用户用户查找结果(共位) -
- - - - - - - - - - - - ♂',''),'') 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!"); - -do -{ - $color_index=($color_index+1)%$color_count; -?> - - - array( + "code" => 0, + "message" => "", + "errorFields" => array(), + ) + ); + + $page = (isset($_GET["page"]) ? intval($_GET["page"]) : 1); + $rpp = (isset($_GET["rpp"]) ? intval($_GET["rpp"]) : 20); + + $type = (isset($_GET["type"]) ? intval($_GET["type"]) : 0); + $online = (isset($_GET["online"]) && $_GET["online"] == "1" ? 1 : 0); + $friend = (isset($_GET["friend"]) && $_GET["friend"] == "1" ? 1 : 0); + $search_text = (isset($_GET["search_text"]) ? $_GET["search_text"] : ""); + + $sql = "SELECT IF(UID = 0, 1, 0) AS is_guest, COUNT(*) AS u_count FROM user_online + WHERE last_tm >= SUBDATE(NOW(), INTERVAL $BBS_user_off_line SECOND) + GROUP BY is_guest"; + + $rs = mysqli_query($db_conn, $sql); + if ($rs == false) { - if ($row=mysql_fetch_array($rs)) + echo("Count online user error" . mysqli_error($db_conn)); + exit(); + } + + $guest_online = 0; + $user_online = 0; + + while ($row = mysqli_fetch_array($rs)) + { + if ($row["is_guest"]) { -?> - - - - - - - -
- - - - - - - -
- - )"> - - -
- - - - - - - - - - - - - -
-
-
-
- - 分页: /页 -1) -{ -?>9797 - -8:8: -
-
- - -
-
- - - + while ($row = mysqli_fetch_array($rs)) + { + array_push($result_set["data"]["users"], array( + "uid" => $row["UID"], + "username" => $row["username"], + "nickname" => $row["nickname"], + "exp" => $row["exp"], + "gender" => $row["gender"], + "gender_pub" => $row["gender_pub"], + "last_login_dt" => (new DateTimeImmutable($row["last_login_dt"]))->setTimezone($_SESSION["BBS_user_tz"]), + )); + } + mysqli_free_result($rs); + + // Cleanup + unset($type); + unset($online); + unset($friend); + unset($search_text); + unset($page); + unset($rpp); + unset($page_total); + unset($toa); + unset($user_online); + unset($guest_online); + + // Output with theme view + $theme_view_file = get_theme_file("view/search_user", $_SESSION["BBS_theme_name"]); + if ($theme_view_file == null) + { + exit(json_encode($result_set)); // Output data in Json + } + include $theme_view_file; +?>