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

Parašė mikis19· 2013 Lie. 25 20:07:51
#1

Sveiki, kaskodel man meto sita
Parse error: syntax error, unexpected T_STRING in /home/u784309059/public_html/themes/templates/panels.php(74) : eval()'d code on line 99
Kai imetu minecraft status panele
Code

openside("Serverio statusas");
class Minequery {

public static function query($address, $port = 25566, $timeout = 30) {
$query = array();

$beginning_time = microtime(true);

$socket = @fsockopen($address, $port, $errno, $errstr, $timeout);

if (!$socket) {

return false;
}

$end_time = microtime(true);

fwrite($socket, "QUERY\n");

$response = "";

while(!feof($socket)) {
$response .= fgets($socket, 1024);
}

$response = explode("\n", $response);


$query['serverPort'] = explode(" ", $response[0], 2);
$query['serverPort'] = $query['serverPort'][1];


$query['playerCount'] = explode(" ", $response[1], 2);
$query['playerCount'] = $query['playerCount'][1];


$query['maxPlayers'] = explode(" ", $response[2], 2);
$query['maxPlayers'] = $query['maxPlayers'][1];


$query['playerList'] = explode(" ", $response[3], 2);
$query['playerList'] = explode(", ", trim($query['playerList'][1], "[]"));

$query['latency'] = ($end_time - $beginning_time) * 1000;

return $query;
}


public static function query_json($address, $port = 25566, $timeout = 30) {
$beginning_time = microtime(true);

$socket = @fsockopen($address, $port, $errno, $errstr, $timeout);

if (!$socket) {

return false;
}

$end_time = microtime(true);

fwrite($socket, "QUERY_JSON\n");

$response = "";

while(!feof($socket)) {
$response .= fgets($socket, 1024);
}

$query = json_decode($response);
$query->latency = ($end_time - $beginning_time) * 1000;

return $query;
}
}
$s = Minequery::query("play.mc-rule.lt");
echo "<b>Serverio IP:</b> play.mc-rule.lt
<br/>";
if($s){
echo "<b>Statusas: <font style='color:#00CC33'>ON</font></b><br/>";
if($s['playerCount']>0){
$i=0;
foreach($s['playerList'] as $player)
{
if($i!=0){
}
echo "<img title='$player' src='http://mc-rule.lt/avatar.php?u=$player&s=60' />";
$i++;
}
}
}else{

echo "<b>Statusas: <font style='color:#993333'>OFF</font></b><br/>";

}
echo "<br /><b>Serverio versija: <font style='color:#cc9900'>1.4.7,</font><font style='color:#993333'></font></b><br/>";
closeside();