Close

Software on server

A project log for Minecraft server user count display

A simple display to show the kids (and me) how many that is logged in to our minecraft server.

kjetilKjetil 07/27/2015 at 20:290 Comments

For the webserver I use this php scripts to ping my minecraft server:

https://github.com/FunnyItsElmo/PHP-Minecraft-Server-Status-Query

and this code for the actual webpage:

<?php
        include_once 'MinecraftStatus/status.class.php';
        $status = new MinecraftServerStatus();
        $response = $status->getStatus('trondsen.name', 25565, '1.6.0');
        if(!$response) {
                echo"The Server is offline!";
        } else {
                echo"Online: ".$response['players']."  \nMax: ".$response['maxplayers']."  ";
        }
?>

This give a simple webpage with the max limmit of players an how many that is online at the moment.

If the server is down the message "The server is offline" is displayed.

(I do know my servername is in the script, but the server is not open...)

Discussions