I need a status html module for my website

Discussion in 'Bukkit Discussion' started by cuddylier, May 25, 2012.

Thread Status:
Not open for further replies.
  1. Hi

    I am looking for someone to make or possibly give me a script that can check my server's status, players online and whether it is offline or online. Much like the one here http://www.obsidiancraft.com/ on the top left


  2. Offline


    its not very hard to make if you use a querrie checkout the bukkit tools forum there are many tools wich does this
  3. I want it actually on my website though, I don't want to go to a website to check my server status..or do you mean there is tools to help make a thing to query the server?
  4. Offline


  5. Offline



    this function sends a simple serverlistping (like your client).
    it returns
    - message of the day
    - current number of players online
    - slots
    or false if server is offline
  6. I am a total n00b, Do I just edit this with my server IP and port then put it on my website? How would I put it on my website as HTML? My website IP is mc.spartanmc.net and Port: 25565 if that helps.
  7. Offline


    You would edit all you needed to edit (Eg. The $host, $port etc.) to your server specs. Then you would need to put it into a HTML banner thing. Example...

    <IMG SRC=”?”>
    This is where you would insert the Info
    The question mark in the <IMG SRC="?"> Is the location where your file is. Example <IMG SRC="bedrok.desktop.troll.gif"
  8. Ah.....I use enjin so I need to get a separate site to host it on. Any suggestions? Also do I make that github file a .gif then?

    I got this far

    <IMG SRC=”gistfile1.aw”>
    function ping($host=mc.spartanmc.net, $port=25565, $timeout=5) {
    //Set up our socket
    $fp = fsockopen($host, $port, $errno, $errstr, $timeout);
    if (!$fp) return false;
    //Send 0xFE: Server list ping
    fwrite($fp, "\xFE0000");
    //Read as much data as we can (max packet size: 241 bytes)
    $d = fread($fp, 256);
    echo bin2hex($d)."<br>";
    //Check we've got a 0xFF Disconnect
    if ($d[0] != "\xFF") return false;
    //Remove the packet ident (0xFF) and the short containing the length of the string
    $d = substr($d, 3);
    //Decode UCS-2 string
    $d = mb_convert_encoding($d, 'auto', 'UCS-2');
    //Split into array
    $d = explode("\xA7", $d);
    //Return an associative array of values
    return array(
    'motd' => $d[0],
    'players' => intval($d[1]),
    'max_players' => intval($d[2]));
    Except this doesn't work at all? I don't really have a clue, what am I doing wrong.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 26, 2016
  9. Offline


    As usual, here's my site's code. You'll need the correct php class (Google it), and query enabled on your server. You can use this, modify this, or whatever.

    require "MinecraftQuery.class.php";
    $Query = new MinecraftQuery();
    $Query->Connect('a304.net', 25565, 1);
    $info = ($Query->GetInfo());
    $players = ($Query->GetPlayers());
    $player_array = implode(", ", $players);
    <p><b>Version:</b> <?php print $info["Version"]; ?>
    <br />
    <b>Players:</b> <?php print $info["Players"]; ?>/<?php print $info["MaxPlayers"]; ?>
    <br />
    <b>Currently Online:</b> <?php print $player_array; ?>
    muffinjello likes this.
  10. Thank you. Would this be a whole webpage then? Also after googling for php classes I am none the wiser. I don't have a clue what they are, I know nothing about php :(
  11. Offline


    muffinjello likes this.
  12. Offline


    Paste the code into a php page, and make sure to put the class in the same directory as the php page. Then, you'll see what it does. After that, modify it as you wish.
  13. Where do I get the correct class file from?
  14. Offline



    beware, that query class has a few flaws :)
  15. Do you have one without flaws? :)
  16. Offline


    Works fine for me.
  17. Offline


    Excuse me, does anyone mind telling me how I would have TWO of these working on the same page (to two different servers)?

    This is what I mean...
    http://www.shortcutmining.com/pages/New/Query.phpWhen I try doing the same code again (changing it to the appropriate thing) it just puts out an error report that says:
    And the "popup" boxes that appear from clicking the button does not work! :(

    Nevermind! I solved it myself! :)
    I never knew php was such a powerful tool... anyhow, I solved it by copying / pasting the same code into a standalone document, and setting up that document to display the numbers for the other server, then I put
    where I wanted the other status to appear.... and voila! it worked!
    Of course you will need to replace the link with a link to your location of your own file.

    I hope this helps future people who come across this page!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 26, 2016
Thread Status:
Not open for further replies.

Share This Page