Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Monitoriukas

Parašė KevinC· 2012 Gru. 27 17:12:13
#1

Reiktų, kad atvaizduotų 2 serverius,dabar atvaizduoja tik vieną.Gal padėtumėt? +REP


$ip = "cs.rushas.lan.lt";
$port = "27015";
$packet = "\xFF\xFF\xFF\xFFTSource Engine Query\x00";
 function getnextstring(&$data)
    {
       $temp="";
       $counter=0;
       while (ord($data[$counter++])!=0) $temp.=$data[$counter-1];
       $data=substr($data,strlen($temp)+1);
       return $temp;
   }
   function getnextbytevalue(&$data)
   {
     $temp=ord($data[0]);
     $data=substr($data,1);
     return $temp;
   }
 
        if(!$live_server = fsockopen("udp://".$ip.":".$port.""))
       {
        $output = "Off";
      }
       else
       {
        fwrite($live_server, $packet);
        socket_set_timeout($live_server,1,0);
        $junk = fread($live_server,5);
        $status = socket_get_status($live_server);
        $do = 1;
        $server_info= "";
 
         while($do)
         {
           $str_1 = fread($live_server,1);
           $server_info .= $str_1;
           $status = socket_get_status($live_server);
           if($status["unread_bytes"] == 0) {$do = 0;}
         }
        fclose($live_server);
 
        if (strlen($server_info) > 0)
        {
          $success = 1;
         $junk = getnextstring($server_info);
         $servername = getnextstring($server_info);
         $map = getnextstring($server_info);
         $junk = getnextstring($server_info);
         $junk = getnextstring($server_info);
         $players = getnextbytevalue($server_info);
         $maxplayers = getnextbytevalue($server_info);
         }
 
         if ($players != '') {
          $players = $players;
         } else {
          $players = "0";
         }
 
         if ($maxplayers != '')
         {
          $maxplayers = $maxplayers;
         }
         else
         {
          $maxplayers = "0";
         }
         if ($players < $maxplayers)
         {
          $output = "<font color='#bcd83b'>Įjungtas</font>";
         }
 
        else
        {
          $output = "<font color='#d83b3b'>Pilnas</font>";
        }
        if ($output != "Pilnas" and $players != "0" or $maxplayers != "0")
        {
          $output = $output;
        }
        else
        {
          $output = "<font color='#d83b3b'>Išjungtas</font>";
        }
        if ($map != '')
         {
          $map = "".$map."";
         }
         else
         {
          $map = "-----";
         }
          if ($servername != '') {
          $servername = $servername;
         } else {
          $servername = "<font color='#d83b3b'>Serveris neveikia</font>";
         }
 
       echo "<style>
       .csmonitorius{
       background: #494949;
       color: #ffffff;
       text-shadow: 1px 1px 0px #000000;
       -moz-border-radius:5px;
-webkit-border-radius:5px;
-opera-border-radius:5px;
-khtml-border-radius:5px;
border-radius:5px;
width: 98%;
margin-top: 3px;
margin-bottom: 3px;
       }
       </style>";
         echo "<table cellpadding='0' class='csmonitorius' cellspacing='1' width='100%' height='25'>\n<tr>\n";
         echo"<td align='center'>".$output."</td>
      <td align='center'>".$ip.":".$port."</td>
      <td align='center'>".$servername."</td>
      <td align='center'>".$map."</td>
      <td calign='center'>".$players."/".$maxplayers."</td>";
      echo "</tr>\n</table>\n";
      }

Parašė avice· 2012 Gru. 27 17:12:05
#2


function getnextstring(&$data)
    {
    $temp="";
    $counter=0;
    while (ord($data[$counter++])!=0) $temp.=$data[$counter-1];
    $data=substr($data,strlen($temp)+1);
    return $temp;
    }
    function getnextbytevalue(&$data)
    {
    $temp=ord($data[0]);
    $data=substr($data,1);
    return $temp;
    }
    function serveris($ip,$port) {
    $ip = $ip;
    $port = $port;
    $packet = "\xFF\xFF\xFF\xFFTSource Engine Query\x00";
    $live_server = fsockopen("udp://".$ip.":".$port."");
 
    if(!$live_server)
    {
    $output = "Off";
    }
    else
    {
    fwrite($live_server, $packet);
    socket_set_timeout($live_server,1,0);
    $junk = fread($live_server,5);
    $status = socket_get_status($live_server);
    $do = 1;
    $server_info= "";
 
    while($do)
    {
    $str_1 = fread($live_server,1);
    $server_info .= $str_1;
    $status = socket_get_status($live_server);
    if($status["unread_bytes"] == 0) {$do = 0;}
    }
    fclose($live_server);
 
    if (strlen($server_info) > 0)
    {
    $success = 1;
    $junk = getnextstring($server_info);
    $servername = getnextstring($server_info);
    $map = getnextstring($server_info);
    $junk = getnextstring($server_info);
    $junk = getnextstring($server_info);
    $players = getnextbytevalue($server_info);
    $maxplayers = getnextbytevalue($server_info);
    }
 
    if ($players != '') {
    $players = $players;
    } else {
    $players = "0";
    }
 
    if ($maxplayers != '')
    {
    $maxplayers = $maxplayers;
    }
    else
    {
    $maxplayers = "0";
    }
    if ($players < $maxplayers)
    {
    $output = "<font color='#ff0000'>On</font>";
    }
 
    else
    {
    $output = "<font color='#54ff00'>Full</font>";
    }
    if ($output != "Full" and $players != "0" or $maxplayers != "0")
    {
    $output = $output;
    }
    else
    {
    $output = "<font color='#ff3600'>Off</font>";
    }
    if ($map != '')
    {
    $map = $map;
    }
    else
    {
    $map = "-----";
    }
    if ($servername != '') {
    $servername = $servername;
    } else {
    $servername = "<font color='#ff3600'>Serveris neveikia</font>";
    }
    echo "<table cellpadding='0' cellspacing='1' width='100%' height='25'><tr>";
    echo"<td class='gtinasr56' align='center'>".$output."</td>
    <td class='vovercikas' align='center'>".$ip.":".$port."</td>
    <td class='vovercikas' align='center'>".$servername."</td>
    <td class='vovercikas' align='center'>".$map."</td>
    <td class='vovercikas' align='center'>".$players."/".$maxplayers."</td>";
    echo "</tr></table>";
    }
    }
    serveris('77.241.194.220','27015');
    serveris('77.241.194.220','27017');
    serveris('73.241.154.224','27016');
    serveris('77.241.154.227','27015');
    serveris('71.241.194.228','27015');

Parašė KevinC· 2012 Gru. 27 17:12:48
#3

Man reikia su Backround, o ant šito nėra jo, kur tu davei. :)

Parašė mNm.· 2012 Gru. 27 22:12:50
#4

taigi styles susitvarkyk panaudok is seno..

Parašė Jaunelis· 2012 Gru. 28 01:12:02
#5

tau gal dar ir į saitą ikelti nemokamai? pritaikyt prie dizaino? :D tau davė kodus dėkok žmogui :) o ne skūskis dėl bg.