Simple PHP script (works with bungee).

Discussion in 'Server & Community Management' started by jeff142, Jun 8, 2013.

  1. jeff142

    Benefactor

    It seams most how to's on line are the old ones and none of them work with bungee

    Hear is a php script to show players online and it works with bungee

    You can do the easy way and iframe this on your site, or include it and echo it.

    Code (Text):
    <?php
    // your servers ip
    $ip= '198.27.74.160';
    // your servers port
    $port = '25565';
     
     
    function mc_status($host,$port) {
        $fp = fsockopen($host,$port,$errno,$errstr,$timeout=10);
            fputs($fp, "\xFE\x01");
            $response = '';
            $response .= fgets($fp);
            fclose($fp);
      $response = explode("\x00\x00", $response);
    return $response;
    }
     
    $data = mc_status($ip,$port);
     
    echo $data[4].'/'.$data[5];
     
    ?>
     
    • Like Like x 3
  2. Don't iframe it and nobody gets hurt.

    If you have PHP installed (which you obviously do...) use the include.

    Thanks jeff, will be moving to Bungee soon so was gonna need a new way to get all player count (and you posting this makes my lazyself very happy).
     
  3. jeff142

    Benefactor

    Your not the only lazy ones, my nick dosnt show the players online many more becuse of this :p
    And hes right, don't iframe it just looks bad