Compare commits

..

6 Commits

Author SHA1 Message Date
9fc797a17f grid layout 2025-08-16 12:23:24 -04:00
59fbfb685d Merge pull request 'grid layout' (#2) from grid into main
Reviewed-on: #2
2025-08-16 12:15:31 -04:00
439d555979 grid layout 2025-08-16 12:14:11 -04:00
03559fa6b2 Merge pull request 'server class' (#1) from test into main
Reviewed-on: #1
2025-08-16 09:05:55 -04:00
35544d4e75 new server class 2025-08-16 09:03:01 -04:00
510a371b87 test branch 2025-08-16 07:44:57 -04:00
2 changed files with 43 additions and 43 deletions

View File

@@ -1,34 +1,23 @@
<?php
error_reporting(0);
//Offline servers will splash error text. That is why error_reporting(0); is set.
include('minecraft_status.php');
$S_HOST[1]='kokorogamers.com';
$S_HOST[2]='kokorogamers.com';
$S_HOST[3]='kokorogamers.com';
$S_HOST[4]='kokorogamers.com';
$S_HOST[5]='wonderbit.xyz';
$S_HOST[6]='mc.blockgame.info';
$ServerList[1]=new Server(NAME:'Server 1', HOST:'kokorogamers.com', PORT:35566);
$ServerList[2]=new Server(NAME:'Server 2', HOST:'kokorogamers.com', PORT:35567);
$ServerList[3]=new Server(NAME:'Server 3', HOST:'kokorogamers.com', PORT:35568);
$ServerList[4]=new Server(NAME:'Server 4', HOST:'kokorogamers.com', PORT:35569);
$ServerList[5]=new Server(NAME:'Wonderbit', HOST:'wonderbit.xyz', PORT:25500);
$ServerList[6]=new Server(NAME:'Blockgame', HOST:'mc.blockgame.info', PORT:25565);
$S_PORT[1]=35566;
$S_PORT[2]=35567;
$S_PORT[3]=35568;
$S_PORT[4]=35569;
$S_PORT[5]=25500;
$S_PORT[6]=25565;
$CHK_SERVER[1]=ping($S_HOST[1],$S_PORT[1],0.5);
$CHK_SERVER[2]=ping($S_HOST[2],$S_PORT[2],0.5);
$CHK_SERVER[3]=ping($S_HOST[3],$S_PORT[3],0.5);
$CHK_SERVER[4]=ping($S_HOST[4],$S_PORT[4],0.5);
$CHK_SERVER[5]=ping($S_HOST[5],$S_PORT[5],0.5);
$CHK_SERVER[6]=ping($S_HOST[6],$S_PORT[6],0.5);
function displayserver($s){
function displayserver($s){
$status = new ServerStatusQuery();
$patterns = array ('/§7/','/§4/','/§kA/','/§2/','/§a/','/§f/','/§r/','/§b/','/§e/');
$replacements=array('','','','','','','','','');
$patterns = array ('/§6/','/§7/','/§8/','/§4/','/§kA/','/§2/','/§a/','/§f/','/§r/','/§b/','/§e/');
$replacements=array('','','','','','','','','','','');
echo $s!=5 && $s!=6?"<h2>Server ".$s."</h2><h3>".$GLOBALS['S_HOST'][$s].":".$GLOBALS['S_PORT'][$s]."</h3>":"<h3>".$GLOBALS['S_HOST'][$s].":".$GLOBALS['S_PORT'][$s]."</h3>";
if($GLOBALS['CHK_SERVER'][$s]){$info = $status->getServerInfo($GLOBALS['S_HOST'][$s], $GLOBALS['S_PORT'][$s]);}
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>";
@@ -45,26 +34,27 @@
<html>
<head>
<title>Minecraft Server Status</title>
<style>.info{vertical-align:top; padding:25px 0 25px 0; width:50%;}</style>
<style>
html,body {background-color:#222; color:#CCC; margin:0;}
h1,h2{color:#EFEF88;}
.center{width:50vw; margin:auto;}
.container{display: grid; grid-template-columns: auto auto;}
.content{margin-right: 60px;}
</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'><h1>Wonderbit</h1><?php displayserver(5); ?></td>
<td class='info'><h1>Blockgame Server</h1><?php displayserver(6); ?></td>
</tr></table>
<br><br>
<div class='center'>
<br><br>
<h1>Minecraft Server Status</h1>
<div class='container'>
<div class='contnent'><?php displayserver(1); ?></div>
<div class='contnent'><?php displayserver(2); ?></div>
<div class='contnent'><?php displayserver(3); ?></div>
<div class='contnent'><?php displayserver(4); ?></div>
<div class='contnent'><?php displayserver(5); ?></div>
<div class='contnent'><?php displayserver(6); ?></div>
</div>
<br><br>
</div>
</body>
</html>

View File

@@ -1,6 +1,16 @@
<?php
function ping($host, $port, $timeout){return fSockOpen($host, $port, $errno, $errstr, $timeout);}
class Server{
public $NAME; public $HOST; public $PORT; public $PING;
public function __construct($NAME,$HOST,$PORT) {
$this->NAME = $NAME; $this->HOST = $HOST; $this->PORT = $PORT; $this->PING = ping($HOST, $PORT, 0.5);
}
function ping($host, $port, $timeout){return fSockOpen($host, $port, $errno, $errstr, $timeout);}
}
class ServerStatus {
private $status = array();
public function __construct($status) {$this->status = $status;}