Peršokti į turinį
  • ŽAIDIMAI
  • , ŽAIDIMAI
  • ŽAIDIMAI

Ši tema yra neaktyvi. Paskutinis pranešimas šioje temoje buvo prieš 4059 dienas (-ų). Patariame sukurti naują temą, o ne rašyti naują pranešimą.

Už neaktyvių temų prikėlimą galite sulaukti įspėjimo ir pranešimo pašalinimo!

Recommended Posts

<?php


class MCServerStatus {


    public $server;
    public $online, $motd, $online_players, $max_players;
    public $error = "OK";


    function __construct($url, $port = '25565') {


        $this->server = array(
            "url" => $url,
            "port" => $port
        );


        if ( $sock = @stream_socket_client('tcp://'.$url.':'.$port, $errno, $errstr, 1) ) {


            $this->online = true;


            fwrite($sock, "\xfe");
            $h = fread($sock, 2048);
            $h = str_replace("\x00", '', $h);
            $h = substr($h, 2);
            $data = explode("\xa7", $h);
            unset($h);
            fclose($sock);


            if (sizeof($data) == 3) {
                $this->motd = $data[0];
                $this->online_players = (int) $data[1];
                $this->max_players = (int) $data[2];
            }
            else {
                $this->error = "Cannot retrieve server info.";
            }


        }
        else {
            $this->online = false;
            $this->error = "Cannot connect to server.";
        }


    }


}


include "MCServerStatus.php";
$server = new MCServerStatus("s.nerd.nu", 25565); //The second argument is optional in this case


$var = $server->online; //$server->online returns true if the server is online, and false otherwise
echo $server->motd; //Outputs the Message of the Day
echo $server->online_players; //Outputs the number of players online
echo $server->max_players; //Outputs the maximum number of players the server allows
print_r($server); //Shows an overview of the object and its contents. (For debugging.)

Tik pasikeisk.

0201e6592d41551a13c6032cf0add8a2130.png

 

<?php


class MCServerStatus {


    public $server;
    public $online, $motd, $online_players, $max_players;
    public $error = "OK";


    function __construct($url, $port = '25565') {


        $this->server = array(
            "url" => $url,
            "port" => $port
        );


        if ( $sock = @stream_socket_client('tcp://'.$url.':'.$port, $errno, $errstr, 1) ) {


            $this->online = true;


            fwrite($sock, "\xfe");
            $h = fread($sock, 2048);
            $h = str_replace("\x00", '', $h);
            $h = substr($h, 2);
            $data = explode("\xa7", $h);
            unset($h);
            fclose($sock);


            if (sizeof($data) == 3) {
                $this->motd = $data[0];
                $this->online_players = (int) $data[1];
                $this->max_players = (int) $data[2];
            }
            else {
                $this->error = "Cannot retrieve server info.";
            }


        }
        else {
            $this->online = false;
            $this->error = "Cannot connect to server.";
        }


    }


}


include "MCServerStatus.php";
$server = new MCServerStatus("s.nerd.nu", 25565); //The second argument is optional in this case


$var = $server->online; //$server->online returns true if the server is online, and false otherwise
echo $server->motd; //Outputs the Message of the Day
echo $server->online_players; //Outputs the number of players online
echo $server->max_players; //Outputs the maximum number of players the server allows
print_r($server); //Shows an overview of the object and its contents. (For debugging.)

Tik pasikeisk.

 

 

Neveikia

New Minecraft Project Coming Soon!

Unikalus Lietuvoje!

atsisiusk maniški ir atsidaryk index.php failą ir susirašyk susikūrk, direktorija kur norį laikyt monitorių ikęlk monitoriaus failus ir į forumą ar į pagr web dėk su <iframe> funkcija.

 Neveikia su <iframe>

Darau taip: <iframe>http://xstudio.wu.lt/moni/index.php<iframe>

O man subugina web

New Minecraft Project Coming Soon!

Unikalus Lietuvoje!

Ši tema yra neaktyvi. Paskutinis pranešimas šioje temoje buvo prieš 4059 dienas (-ų). Patariame sukurti naują temą, o ne rašyti naują pranešimą.

Už neaktyvių temų prikėlimą galite sulaukti įspėjimo ir pranešimo pašalinimo!

Svečias
Ši tema yra užrakinta.
  • Šiame puslapyje naršo:   0 nariai

    • Nėra registruotų narių peržiūrinčių šį forumą.

Skelbimai



×
×
  • Sukurti naują...