Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require("mta/mta_sdk.php");
- $host = "localhost"; //IP del servidor
- $port = 22005; //Puerto http
- $user = "paypal"; // Cuenta cuyo ACL tenga permiso a 'general.http'
- $pass = "paypal"; // Contraseña de la cuenta
- try{
- $server = new mta($host, $port, $user, $pass);
- $res = $server->getResource("stats");
- $data = $res->call("getServerStats");
- if ($host == "localhost" || $host == "127.0.0.1"){
- $host = file_get_contents('http://ipecho.net/plain');
- }
- $direccion = $host.":".$data[0];
- ?>
- <link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/superhero/bootstrap.min.css" rel="stylesheet">
- <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
- <div class="panel panel-default">
- <div class="panel-heading"><i class="fa fa-bar-chart" aria-hidden="true"></i> Estado del servidor</div>
- <div class="panel-body">
- <div class="serverstatus">
- <p><i class="fa fa-globe fa-fw" aria-hidden="true"></i> Direción: <a href="mtasa://<?php echo $direccion; ?>"><?php echo $direccion; ?></a></p>
- <p><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> Nombre: <span class="label label-success"><?php echo $data[1]; ?></span></p>
- <div id="serverstatus">
- <p><i class="fa fa-power-off fa-fw" aria-hidden="true"></i> En linea: <span class="label label-success"><?php echo $data[2]; ?></span></p>
- <p><i class="fa fa-info-circle fa-fw" aria-hidden="true"></i> Versión: <span class="label label-success"><?php echo $data[3]; ?></i></span></p>
- <p><i class="fa fa-bolt fa-fw" aria-hidden="true"></i> Pérdida de paquetes: <span class="label label-success"><?php echo $data[4]; ?></span></p>
- </div>
- </div>
- </div>
- </div>
- <?php
- } catch (Exception $e) {
- echo 'Excepción capturada: ', $e->getMessage(), "\n";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement