Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.86 KB | None | 0 0
  1. <?php
  2.     require("mta/mta_sdk.php");
  3.     $host = "localhost"; //IP del servidor
  4.     $port = 22005; //Puerto http
  5.     $user = "paypal"; // Cuenta cuyo ACL tenga permiso a 'general.http'
  6.     $pass = "paypal"; // Contraseña de la cuenta
  7.    
  8.     try{
  9.         $server = new mta($host, $port, $user, $pass);
  10.         $res = $server->getResource("stats");
  11.         $data = $res->call("getServerStats");
  12.        
  13.         if ($host == "localhost" || $host == "127.0.0.1"){
  14.             $host = file_get_contents('http://ipecho.net/plain');
  15.         }
  16.         $direccion = $host.":".$data[0];
  17. ?>
  18.        
  19.         <link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/superhero/bootstrap.min.css" rel="stylesheet">
  20.         <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  21.  
  22.             <div class="panel panel-default">
  23.                 <div class="panel-heading"><i class="fa fa-bar-chart" aria-hidden="true"></i> Estado del servidor</div>
  24.                 <div class="panel-body">
  25.                     <div class="serverstatus">
  26.                         <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>
  27.                         <p><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> Nombre: <span class="label label-success"><?php echo $data[1]; ?></span></p>
  28.                         <div id="serverstatus">
  29.                             <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>
  30.                             <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>
  31.                             <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>
  32.                         </div>
  33.                     </div>
  34.                 </div>
  35.             </div>
  36. <?php
  37.     } catch (Exception $e) {
  38.         echo 'Excepción capturada: ',  $e->getMessage(), "\n";
  39.     }
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement