61 lines
2.4 KiB
PHP
61 lines
2.4 KiB
PHP
<?php
|
|
error_reporting(0);
|
|
//Offline servers will splash error text. That is why error_reporting(0); is set.
|
|
|
|
include('minecraft_status.php');
|
|
|
|
$ServerList[1]=new Server('Server 1', 'kokorogamers.com', 35566);
|
|
$ServerList[2]=new Server('Server 2', 'kokorogamers.com', 35567);
|
|
$ServerList[3]=new Server('Server 3', 'kokorogamers.com', 35568);
|
|
$ServerList[4]=new Server('Server 4', 'kokorogamers.com', 35569);
|
|
$ServerList[5]=new Server('Wonderbit', 'wonderbit.xyz', 25500);
|
|
$ServerList[6]=new Server('Blockgame', 'mc.blockgame.info', 25565);
|
|
|
|
function displayserver($s){
|
|
$status = new ServerStatusQuery();
|
|
$patterns = array ('/§6/','/§7/','/§8/','/§4/','/§kA/','/§2/','/§a/','/§f/','/§r/','/§b/','/§e/');
|
|
$replacements=array('','','','','','','','','','','');
|
|
|
|
echo "<h2>".$GLOBALS['ServerList'][$s]->NAME."</h2><h3>".$GLOBALS['ServerList'][$s]->HOST.":".$GLOBALS['ServerList'][$s]->PORT."</h3>";
|
|
if($GLOBALS['ServerList'][$s]->PING){$info = $status->getServerInfo($GLOBALS['ServerList'][$s]->HOST, $GLOBALS['ServerList'][$s]->PORT);}
|
|
if($info == false){echo "<span style='color:#F00;'>OFFLINE</span><br>";}
|
|
else{
|
|
echo "<span style='color:#0F0;'>ONLINE</span><br>";
|
|
echo "MOTD: " . preg_replace($patterns, $replacements, $info->getMOTD()) . "<br>";
|
|
//echo "MOTD: " . $info->getMOTD() . "<br>";
|
|
echo "Version: " . $info->getVersion() . "<br>";
|
|
echo "Players: " . $info->getCurrentPlayers() . "<br>";
|
|
}
|
|
echo "<br>";
|
|
}
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Minecraft Server Status</title>
|
|
<link rel="stylesheet" href="styles.css?v=<?php echo time();?>">
|
|
<style>.info{vertical-align:top; padding:25px 0 25px 0; width:50%;}</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div align=center><div style='width:50vw;' align=left>
|
|
<br><br>
|
|
<div class="banner">
|
|
<h1>Minecraft Server Status</h1>
|
|
</div>
|
|
<table style='border-spacing: 30px;'><tr>
|
|
<td class='info'><?php displayserver(1); ?></td>
|
|
<td class='info'><?php displayserver(2); ?></td>
|
|
</tr><tr>
|
|
<td class='info'><?php displayserver(3); ?></td>
|
|
<td class='info'><?php displayserver(4); ?></td>
|
|
</tr><tr>
|
|
<td class='info'><?php displayserver(5); ?></td>
|
|
<td class='info'><?php displayserver(6); ?></td>
|
|
</tr></table>
|
|
<br><br>
|
|
</div>
|
|
</body>
|
|
</html>
|