This repository was archived by the owner on Oct 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathstat.php
More file actions
55 lines (45 loc) · 1.31 KB
/
stat.php
File metadata and controls
55 lines (45 loc) · 1.31 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
50
51
52
53
54
55
<?php
require_once './mcstat.php';
require_once './mcformat.php';
$hostname = NULL;
if (array_key_exists('server', $_GET)) {
$hostname = $_GET['server'];
}
if ($hostname) {
$m = new MinecraftStatus($hostname);
$status = $m->ping();
}
$hostname = htmlspecialchars($hostname);
echo '
<html>
<head>
<style>
.motd {
text-shadow: 1px 1px 1px #000000;
filter: dropshadow(color=#000000, offx=1, offy=1);
}
</style>';
echo '<title> Minecraft Server Status' . ($hostname ? ' :: ' . $hostname : '') . '</title>';
echo '</head>
<body>
<p>Query server status:</p>
<form name="MC" method="get" action="">
<input type="text" name="server" onClick="this.select();" value="'.($hostname ? $hostname : '').'">
<input type="submit">
</form>';
if ($hostname) {
echo '<h1>Status for ' . $hostname . '</h1>';
if ($status) {
echo '<table>
<tr><th>MOTD</th><th>Server version</th><th>Players</th><th>Ping</th></tr>';
echo '<tr><td class="motd">' . MC_parseMotdColors($status['motd']). '</td><td>' .
$status['server_version'] . '</td><td>' . $status['player_count'] .
'/' . $status['player_max'] . '</td><td>' . $status['latency'] . '</td></tr>';
echo '</table>';
} else {
echo '<p>Could not query '.$hostname.' ('.$m->lastError.')</p>';
}
}
echo '</body>
</html>';
?>