1. Guest, as per the stickied thread, this forum has not been in use since 2014. All bugs and feature requests should be posted to JIRA.

Rejected Server info low load speed

Discussion in 'Bugs & Feature Requests' started by DrDeft, Nov 26, 2012.

  1. md_5

    Administrator Developer

  2. Is this script incorrect? Can you give me the link to 1.4 compatible script please?

    <?php
    $srvls = array(
    "Gamai" => array("81.25.59.232", "25565", "Alcar", "zfallenz1"),
    "Olimp" => array("81.25.59.232", "25665", "Oper", "eugeniozh"),
    "Arank" => array("81.25.59.232", "25765", "Mr606", "mr_606"),
    "Evropa" => array("159.224.135.120", "25865", "Oper", "eugeniozh"),
    "Bezzar" => array("159.224.135.120", "25965", "Mr606", "mr_606"),
    "Gidra" => array("159.224.135.120", "26065", "Alcar", "zfallenz1"),

    );
    $playersCount = 0;
    ?>

    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" href="http://gamai.ru/monitorserverov/monitor.css" type="text/css" />
    <div class="monitorserverov">

    <?php
    foreach ($srvls as $srv => $prm){

    echo "<br><div><img src=images/blog/icons/".$srv.".jpg>&nbsp;<b>".$srv."</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <img src=images/blog/icons/skype.png>&nbsp;<a href='skype:".$prm[3]."?call'>".$prm[3]."</a><br>Генерал полиции: <b>".$prm[2]."</b></div>";

    $socket = @fsockopen($prm[0], $prm[1]);

    if ($socket !== false) {

    @fwrite($socket, "\xFE");

    $data = @fread($socket, 1024);

    if ($data !== false && substr($data, 0, 1) == "\xFF") {

    $info = explode("\xA7", mb_convert_encoding(substr($data,1), "iso-8859-1", "utf-16be"));
    $playersCount += $info[1];
    echo "<div class='monitor' style='background-position:".(-260+260*$info[1]/$info[2])."px 0;'>".$info[1]."/".$info[2]."</div>";
    } else {
    echo "<div class=\"serveroff\">Restarting</div>";
    }
    } else {
    echo "<div class=\"serveroff\">Restarting</div>";
    }
    }
    ?>
    <br>
    Total Online: <b><?php echo "$playersCount";?></b>
    </div>
     
  3. md_5

    Administrator Developer

    /me dun know php
    Code (Text):
    <?php
    /* Minecraft 1.4.2 server list ping script
    Originally created by lol768 -- 30/10/2012
    Available for use under the GNU LGPLv3 License
    For usage and distribution information, see: http://www.gnu.org/licenses/lgpl-3.0.html */
     
    $host = "199.241.30.86"; //IP/host of Minecraft server
    $port = 25565; //Minecraft server port, not query port
    $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); //Create the socket
    $connected = socket_connect($socket, $host, $port); //Try and connect using the info provided above
     
    if (!$connected)
        die("Could not connect to server."); //No connection could be established
     
    socket_send($socket, "\xFE\x01", 2, 0); //Send the server list ping request (two bytes)
    $retVal = socket_recv($socket, &$data, 1024, 0); //Get the info and store it in $data
    socket_close($socket); //Close socket
     
    if ($retVal != false && substr($data, 0, 1) == "\xFF") //Ensure we're getting a kick message as expected
    {
        $data = substr($data, 9); //Remove packet, length and starting characters
        $data = explode("\x00\x00", $data); //0000 separated info
        $protocolVersion = $data[0]; //Get it all into separate variables
        $serverVersion = $data[1];
        $motd = $data[2];
        $playersOnline = $data[3];
        $playersMax = $data[4];
    }
    else
    {
        die("Couldn't get expected data"); //Either retVal was false or we didn't get a kick message
    }
     
    //Example usage:
    echo ("$motd is a $serverVersion Minecraft server with $playersOnline/$playersMax players online.");
    ?>
     
    • Like Like x 1