From d6b1d9fc47aac9f4bfef8afb8255c15c12d160d3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Sep 2025 18:25:35 +0000 Subject: [PATCH 1/3] Initial plan From 1aae4b4b83b8e19e8e6ac1ccda5b35eb41c102c0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Sep 2025 18:30:50 +0000 Subject: [PATCH 2/3] Create standalone server status page Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com> --- server_status.php | 291 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 291 insertions(+) create mode 100644 server_status.php diff --git a/server_status.php b/server_status.php new file mode 100644 index 00000000..5110a5f0 --- /dev/null +++ b/server_status.php @@ -0,0 +1,291 @@ +getUserById($_SESSION['user_id']); + +// Get settings +$settings = $db->getSettings(); +@$GLOBALS['panel_language'] = $settings['panel_language']; +ogpLang(); + +function ping_host($host, $timeout = 5) { + if (function_exists('exec')) { + $output = array(); + $result = 0; + + // Use ping command based on OS + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + exec("ping -n 1 -w " . ($timeout * 1000) . " " . escapeshellarg($host), $output, $result); + } else { + exec("ping -c 1 -W " . $timeout . " " . escapeshellarg($host), $output, $result); + } + + if ($result === 0) { + // Extract ping time from output + foreach ($output as $line) { + if (preg_match('/time[<=]([0-9.]+)\s*ms/i', $line, $matches)) { + return floatval($matches[1]); + } + } + return 0; // Host is up but couldn't extract time + } + } + return false; // Host is down or ping unavailable +} + +function get_hostname($ip) { + $hostname = gethostbyaddr($ip); + return ($hostname && $hostname !== $ip) ? $hostname : false; +} + +// Get all remote servers +$servers = $db->getRemoteServers(); + +?> + + + + + + Server Status - OGP + + + +
+

🖥️ Server Status Dashboard

+ + + + +
+ No servers configured in the system. +
+ + + + + + + + + + + + + status_chk(); + $is_online = ($status === 1); + + // Get ping time + $ping_time = ping_host($server_ip, 3); + + // Determine ping color class + $ping_class = ''; + if ($ping_time !== false) { + if ($ping_time <= 50) { + $ping_class = 'ping-good'; + } elseif ($ping_time <= 150) { + $ping_class = 'ping-medium'; + } else { + $ping_class = 'ping-bad'; + } + } + ?> + + + + + + + + + +
Server NameLocation/IPHostnameStatusPing (ms)
+ +
() + +
N/A'; ?> + + 🟢 UP + + 🔴 DOWN + + + + + ms + + + N/A + +
+ + +
+ Last updated: +
+ +
+ ← Back to Dashboard +
+
+ + \ No newline at end of file From 62267841dcf9d56e75352fbee29cf77923aa0c85 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Sep 2025 18:33:13 +0000 Subject: [PATCH 3/3] Add server status link to dashboard for all users Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com> --- modules/dashboard/dashboard.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/dashboard/dashboard.php b/modules/dashboard/dashboard.php index a40875d2..df8b3c1d 100644 --- a/modules/dashboard/dashboard.php +++ b/modules/dashboard/dashboard.php @@ -202,6 +202,21 @@ function exec_ogp_module() foreach($colhtml as $html ) echo $html.''; } + + // Server Status Link - Available to all users + echo "
+
+

Server Status

+
+

View the status of all game servers

+ + 🖥️ View Server Status + +
Opens in a new window +
+
+
"; + if( $isAdmin AND $db->isModuleInstalled('status') ) { echo "".get_lang('server_status')."
";