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

Diff of /fenglin/bbs/view_user.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 by sysadm, Tue Apr 29 11:55:32 2025 UTC Revision 1.4 by sysadm, Tue Sep 30 12:18:30 2025 UTC
# Line 66  Line 66 
66                  "dead" => false,                  "dead" => false,
67                  "online" => false,                  "online" => false,
68                  "last_tm" => (new DateTimeImmutable($row["last_login_dt"]))->setTimezone($_SESSION["BBS_user_tz"]),                  "last_tm" => (new DateTimeImmutable($row["last_login_dt"]))->setTimezone($_SESSION["BBS_user_tz"]),
69                    "current_action" => array(),
70                  "ip" => "",                  "ip" => "",
71                  "is_friend" => false,                  "is_friend" => false,
72                  "photo" => "",                  "photo" => "",
# Line 85  Line 86 
86          mysqli_free_result($rs);          mysqli_free_result($rs);
87    
88          $sql = "SELECT IF(last_tm < SUBDATE(NOW(), INTERVAL $BBS_user_off_line SECOND), 1, 0) AS timeout,          $sql = "SELECT IF(last_tm < SUBDATE(NOW(), INTERVAL $BBS_user_off_line SECOND), 1, 0) AS timeout,
89                          ip, last_tm FROM user_online WHERE UID = $uid                          ip, last_tm, current_action FROM user_online WHERE UID = $uid
90                          ORDER BY last_tm DESC LIMIT 1";                          AND last_tm >= SUBDATE(NOW(), INTERVAL $BBS_user_off_line SECOND)
91                            ORDER BY last_tm DESC";
92    
93          $rs = mysqli_query($db_conn, $sql);          $rs = mysqli_query($db_conn, $sql);
94          if ($rs == false)          if ($rs == false)
# Line 98  Line 100 
100                  exit(json_encode($result_set));                  exit(json_encode($result_set));
101          }          }
102    
103          if ($row = mysqli_fetch_array($rs))          while ($row = mysqli_fetch_array($rs))
104          {          {
105                  $result_set["data"]["online"] = ($row["timeout"] == 0);                  if ($result_set["data"]["online"] == false)
106                  $result_set["data"]["ip"] = ip_mask($row["ip"], $ip_mask_level);                  {
107                  $result_set["data"]["last_tm"] = (new DateTimeImmutable($row["last_tm"]))->setTimezone($_SESSION["BBS_user_tz"]);                          $result_set["data"]["online"] = true;
108                            $result_set["data"]["ip"] = ip_mask($row["ip"], $ip_mask_level);
109                            $result_set["data"]["last_tm"] = (new DateTimeImmutable($row["last_tm"]))->setTimezone($_SESSION["BBS_user_tz"]);
110                    }
111                    array_push($result_set["data"]["current_action"], $row["current_action"]);
112          }          }
113          mysqli_free_result($rs);          mysqli_free_result($rs);
114    


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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