Parašė AL· 2008 Gru. 21 20:12:10
#1
Sveiki, gal kas žinot kodel nerodo ar serveris online ar offline? Radusiam klaidą būsiu dėkingas. Va kodai:
<?php
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 = "On";
}
else
{
$output = "Full";
}
if ($output != "Full" and $players != "0" or $maxplayers != "0")
{
$output = $output;
}
else
{
$output = "Off";
}
if ($map != "")
{
$map = $map;
}
else
{
$map = "nera";
}
}
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<title>*FragerZone.xz.Lt*</title>
<link rel="shortcut icon" type="image/gif" href=".//images/ico.gif"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="./css.css"/>
</head>
<body class="body">';
echo'
<body bgcolor=#210202 leftmargin=0 topmargin=15 marginwidth=0 marginheight=0>
<center>
<div id=index>
<div id=headeris>
</div>
<div id=subheaderis>
<table width="100%" height="100%">
<tr style="text-align: center; height: 100%;">
<td width="20%"><a href="index.php" class=linkas>Server status</a></td>
<td width="20%"><a class=linkas href="list_cs_source.php">CS:S Serveriai</a></td>
<td width="20%"><a class=linkas href="1.6.php">CS 1.6 Serveriai</a></td>
<td width="20%"><a class=linkas href="downloads.php">Downloads</a></td>
<td width="20%"><a class=linkas href="contacts.php">Kontaktai</a></td>
</tr>
</table>
</div>
<div id=fonas>
<table width="710" border="0" cellpadding="0" cellspacing="0">
<tr>
<div style="width:20px;">
</div>
<td align="center">
<div style="width:100%">?
<div align="center" style="padding-bottom:15px"><b>Counter Strike Source Servers List</b></div>
<div align="center">
<table style="width: 640px; text-align: center; background-color:#A0A0A4">
<tr class="td_title">
<td style="font-weight: 700;">ID</td>
<td style="font-weight: 700">Server</td>
<td style="font-weight: 700;">Map</td>
<td style="font-weight: 700;">Players</td>
</tr>
<tr class="td" onMouseOver="this.className="onmouse"" onMouseOut="this.className="td"">
<td>4</td>
<td ><b>css.kiberzona.lt:27015
</b></td>
<td>'.$map.'</td>
<td>'.$players.' of '.$maxplayers.'</td>
</tr>
</table>
<BR>
<p align=center style="padding-top:50px;">
<img width=88 height=31 border=0 src="//www.hey.lt/count.php?id=csZonecool2">
</p>
</div>
</center></div>
<td>
<div style="width:20px;">
</div>
</tr>
</table>
</div>
<div id=footeris><div style="width:100%; height:10px;"></div>
Copyright <a class=linkas href="http://cszone.lt/">
www.csZone.lt</a> 2008 Visos teises saugomos ©
</div>
</div>
</center>
</div>';
echo '</body></html>';
?>