-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.php
More file actions
49 lines (39 loc) · 1.29 KB
/
Copy pathserver.php
File metadata and controls
49 lines (39 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
$title = "My Servers";
$page = "server";
$return = "server.php";
require __DIR__ . '/configuration.php';
require __DIR__ . '/include.php';
$cid = (int) ($_SESSION["clientid"] ?? 0);
$sharedClause = (dbCount("SHOW TABLES LIKE 'subuser'") > 0)
? " OR serverid IN (SELECT serverid FROM subuser WHERE subclientid='{$cid}')"
: "";
$result = dbQuery(
"SELECT serverid, ipid, name, game, status, online, port, `query`, qryport
FROM server
WHERE clientid='{$cid}'" . $sharedClause . "
ORDER BY serverid"
);
$servers = [];
while ($row = dbFetch($result)) {
if (!empty($row["ipid"])) {
$ipRow = dbRow("SELECT ip FROM ip WHERE ipid='{$row["ipid"]}' LIMIT 1");
$row["ip"] = $ipRow["ip"] ?? null;
if (!empty($row["ip"]) && !empty($row["port"]) && ($row["query"] ?? "none") !== "none") {
$qryport = !empty($row["qryport"]) ? $row["qryport"] : $row["port"];
$info = querySingleServer([$row["query"], $row["ip"], $qryport]);
if ($info) {
$row["servername"] = $info["Server Name"] ?? "";
$row["players"] = $info["Players"] ?? "";
$row["map"] = $info["Current Map"] ?? "";
}
}
}
$servers[] = $row;
}
$msg1 = $_SESSION["msg1"] ?? null;
$msg2 = $_SESSION["msg2"] ?? null;
unset($_SESSION["msg1"], $_SESSION["msg2"]);
include tpl('header');
include tpl('server');
include tpl('footer');