웹마스터 팁

http://www.kaillera.com에뮬 멀티할때 접속하는 카일레라 서버의 상태 페이지를 만들어 봅시다. 'w'
카일레라 서버는 링크1에 있습니다.
--------------------------------------------------------------------
<pre>
<?php
  $_ip="192.168.0.1:27888"; // 자신의 ip와 포트 번호로 수정합니다.

  $file=@file("http://".$_ip."/?page=status");
  if($file) {
    echo "서버 상태(status): <font color=blue>가동중.(online)</font>nn";
    $uptime=$file[3]; $uptime=str_replace("uptime:","",$uptime);
    $uptime=str_replace("seconds","",$uptime); $uptime=trim($uptime);

    $stamp=explode(".",$uptime);

    $days=(int)($stamp[0]/86400);
    $stamp[0]-=$days*86400;
    $hrs=(int)($stamp[0]/3600);
    $stamp[0]-=$hrs*3600;
    $mins=(int)($stamp[0]/60);
    $stamp[0]-=$mins*60;
    $secs=(int)($stamp[0]);

    echo "가동 시간(uptime): ".$days." days ".$hrs." hours ".$mins." min ".$secs." secs ".$stamp[1]." microsecs.n";

    $clients=$file[5]; $clients=trim(str_replace("# clients:","",$clients));
    echo "접속자(clients): ".$clients." 명n";

    $games=$file[6]; $games=trim(str_replace("# games:","",$games));
    echo "개설된 게임(games): ".$games." 개n";

    echo"</pre>n<table border=1 bordercolor=black cellpadding=3 cellspacing=0>n";
    echo"<caption><font size=3 face="Tahoma"><b>Client List</b></font></caption>n";
    echo"<tr><th>No</th><th>Name</th><th>Client</th><th>Connection</th><th>Status</th></tr>n";
    for($i=10;$i<$clients+10;$i++) {
      $j++;
      $temp=explode("t",$file[$i]);
      echo"<tr><td> ".$j." </td><td> ".$temp[0]." </td><td> ".$temp[1]." </td><td> ".$temp[2]." </td><td> ".$temp[3]." </td></tr>n";
    } $j=0;

    echo"</table>n<table border=1 bordercolor=black cellpadding=3 cellspacing=0>n";
    echo"<caption><font size=3 face="Tahoma"><b>Games List</b></font></caption>n";
    echo"<tr><th>No</th><th>Title</th><th>Users</th><th>Status</th></tr>n";

    for($i=$clients+13;$i<$clients+13+$games;$i++) {
      $j++;
      $temp=explode("t",$file[$i]);
      echo"<tr><td>".$j."</td><td>".$temp[0]."</td><td>".$temp[1]."</td><td>".$temp[2]."</td></tr>n";
    }
    echo"</table>";
  } else echo"서버 상태(status): <font color=red>정지.(offline)</font>n</pre>";
?>