Меня интересует блок мониторинга COD4
Как зделать чтобы в блоке отображалось всего навсего
Call of Duty 4: 0(количество играков на сервер)/20(макс играков на сервере)
А то пишется когда неково нету сервер пуст это меня раздрожает и когда кто играет выдаётся полная иформация
<?php
if (!defined('BLOCK_FILE')) {
Header("Location: ../index.php");
exit;
}
$server="152.168.6.8";
$qw=chr(32);
$fp = fsockopen ("udp://".$server,"28960");
if (!$fp) {
echo "ERROR: $errno - $errstr<br>\n";
} else {
fwrite($fp,"яяяяgetinfo");
socket_set_timeout($fp,2,1);
$st=fread($fp,1);
$r=socket_get_status($fp);
$r=$r["unread_bytes"];
$st.=fread($fp,$r);
fclose($fp);
$posname1=strpos($st,"hostname");
$posname2=strpos($st,"mapname");
$posname3=strpos($st,"\clients");
$posname4=strpos($st,"sv_maxclients");
$posname5=strpos($st,"gametype");
$name=substr($st,$posname1+9,$posname2-$posname1-10);
$map=substr($st,$posname2+8,$posname3-$posname2-8);
$current=substr($st,$posname3+9,$posname4-$posname3-10);
$max=substr($st,$posname4+14,$posname5-$posname4-15);
}
$show_map="<img src=/images/cod/".$map.".jpg width=\"130\" height=\"98\">";
$content=("
<table width=\"145\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" align=\"center\">
<tr>
<td rowspan=\"7\">
<center><font color=\"#8c7952\">$show_map</font></center>
</td>
</tr>
</table>
<table width=\"145\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" align=\"center\">
<tr>
<td<b>Карта:</b> <b>$map</b></td>
</tr>
</table>
<table width=\"145\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" align=\"center\">
<tr>
<td>
<b>Имя:</b> <b>$name</b></td>
</table>
<table width=\"145\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" align=\"center\">
<tr>
<td><b>Адрес:</b></td>
<td><b>$server</b></td>
</tr>
</table>
<table width=\"145\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" align=\"center\">
<tr><td><b>Игроков: $current/$max</td></tr>
</table>
<head>
<!-- HEAD START HERE -->
<script language=\"JavaScript\">
<!--
function winopcoduo()
{
windop = window.open(\"/codmon/monitor/player.php\",\"mywin\" ,\"height=800,width=300 ,scrollbars=yes\");
}
-->
</script>
<!-- HEAD END HERE -->
</head>
<body bgcolor=\"#EDEDED\" text=\"#000000\" link=\"#000000\" topmargin=\"0\" leftmargin=\"0\">
<center>
<!-- BODY START HERE -->
<a href=\"Java Scriptwinopcoduo();\"><b><font color=\"red\">Кто играет ?</font></b></a>
");
if($posname3==0){$content= "<table width=\"101%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" align=\"center\" bgcolor=\"535353\">
<tr>
<td colspan=\"1\"><center><b>Сервер пуст!</b></center></td>
</tr>
</table>";}
$fp = fsockopen ("udp://".$server,"28960");
if (!$fp) {
echo "ERROR: $errno - $errstr<br>\n";
} else {
fwrite($fp,"яяяяgetinfo");
$st=fread($fp,1);
$r=socket_get_status($fp);
$r=$r["unread_bytes"];
$st.=fread($fp,$r);
fclose($fp);
$playersn=ord(substr($st,5,1));
$st=substr($st,6);
if ($playersn !=0 )
Echo("</body></html>");
}
?>
Как зделать чтобы в блоке отображалось всего навсего
Call of Duty 4: 0(количество играков на сервер)/20(макс играков на сервере)
А то пишется когда неково нету сервер пуст это меня раздрожает и когда кто играет выдаётся полная иформация
Версия PHP: PHP 5
Сервер: Локальный сервер