Gdy server jest online na stronie zawsze pisz? offline a w House w domku co ma w?a?ciciela pisze no body,
http://scr.hu/3io/valex
Dam reputa +
http://scr.hu/3io/valex
Dam reputa +
Follow along with the video below to see how to install our site as a web app on your home screen.
Notka: This feature may not be available in some browsers.
<?xml version="1.0" encoding="utf-... oczywi?cie b??dne, brakuje pewnych dopisk?w.
To jest oczywi?cie b??dne, brakuje pewnych dopisk?w.
Widzi kto? w tym jaki? b??d?<h2><div class="cufon_h2">Informacje</div></h2>
<div class="quotes">
<div class="list">
<?php
$file = "dbase/status.xml";
$xml = simplexml_load_file($file);
$time = time();
$last_check = $xml['time'];
$lastTime = $last_check + ($info_time);
if($lastTime < $time){
$filen = file_get_contents($todata.'/../config.lua');
$temppos = stristr($filen, "port = ");
$exp = explode(' ', $temppos);
$exp = explode('--', $exp[2]);
$exp = explode('"', $exp[0]);
$port = $exp[1];
//$host = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$host = $_SERVER['REMOTE_ADDR'];
if($settings["cuffon"] != 1){
$host = stringSplit($host, 14); //dzielenie za dlugiego adresu
} else {
$host = stringSplit($host, 12); //dzielenie za dlugiego adresu
}
$temppos = stristr($filen, "expmul = ");
$exp = explode(' ', $temppos);
$exp = explode('--', $exp[2]);
$exprate = $exp[0];
$temppos = stristr($filen, "worldtype = ");
$exp = explode(' ', $temppos);
$exp = explode('--', $exp[2]);
$exp = explode('"', $exp[0]);
$world_type = $exp[1];
if($world_type == "pvp-enforced"){
$world_type = "pvp-enfo";
}
$temppos = stristr($filen, "map = ");
$exp = explode(' ', $temppos);
$exp = explode('--', $exp[2]);
$exp = explode('/', $exp[0]);
$exp = explode('.', $exp[2]);
$world_name = $exp[0];
$xml = simplexml_load_file($todata.'/world/'.$world_name.'-spawn.xml');
$total = 0;
foreach($xml->spawn as $spawn){
foreach($spawn->monster as $monster){
$total++;
}
}
$xml = simplexml_load_file($todata.'/houses.xml');
$houses = 0;
foreach($xml->house as $house){
$houses++;
}
$info = chr(6).chr(0).chr(255).chr(255).'info';
$sock = @fsockopen($host, $port, $errno, $errstr, 1);
if ($sock){
fwrite($sock, $info);
$data='';
while (!feof($sock))
$data .= fgets($sock, 1024);
fclose($sock);
preg_match('/players online="(\d+)" max="(\d+)" peak="(\d+)"/', $data, $matches);
$players_online = $matches[1] . '('.$matches[3].')/' . $matches[2];
preg_match('/uptime="(\d+)"/', $data, $matches);
$h = floor($matches[1] / 3600);
$m = floor(($matches[1] - $h*3600) / 60);
$a = " $h " . ($h==1? 'h' : ($h==2||$h==3||$h==4? 'h' : 'h'));
$b = " $m " . ($m==1? 'm' : ($m==12||$m==13||$m==14? 'm' : ($m%10==2||$m%10==3||$m%10==4? 'm' : 'm'))) . ' ';
$ot_uptime = $a.$b;
preg_match('/monsters total="(\d+)"/', $data, $matches);
$monsters_online = $matches[1]."/".$total;
$status = "Online";
}else {
$players_online = "-(-)/-";
$ot_uptime = "-/-";
$monsters_online = $total;
$status = "Offline";
}
$xml = simplexml_load_file($file);
$xml['time'] = $time;
$xml['host'] = $host;
$xml['port'] = $port;
$xml['exp'] = $exprate;
$xml['type'] = $world_type;
$xml['houses'] = $houses;
$xml['players'] = $players_online;
$xml['uptime'] = $ot_uptime;
$xml['monsters'] = $monsters_online;
$xml['status'] = $status;
$newplayerFile = $xml->asXML();
$open_file = fopen($file, 'w');
fwrite($open_file, $newplayerFile);
fclose($open_file);
} else {}
echo '<table style="margin-left:7px;">
<tr>
<td>Status ots: </td>';
if($xml['status'] == "Online"){
echo '<td><b style="color:#6E8B3D;">'.$xml['status'].'</b></td>';
} else {
echo '<td><b style="color:#8B1A1A;">'.$xml['status'].'</b></td>';
}
echo '</tr>
<tr><td>Online:</td> <td>'.$xml['players'].'</td></tr>
<tr><td>Monsters:</td> <td>'.$xml['monsters'].'</td></tr>
<tr><td>Uptime:</td> <td>'.$xml['uptime'].'</td></tr>
<tr><td>Host:</td> <td>'.$xml['host'].'</td></tr>
<tr><td>Port:</td> <td>'.$xml['port'].'</td></tr>
<tr><td>World type:</td> <td>'.$xml['type'].'</td></tr>
<tr><td>Experience:</td> <td>'.$xml['exp'].'</td></tr>
<tr><td>Houses:</td> <td>'.$xml['houses'].'</td></tr>
</table>';
?>
</div>
</div>
$sock = @fsockopen($host, $port, $errno, $errstr, 1);
$sock = @fsockopen("127.0.0.1", $port, $errno, $errstr, 1);
if (file_exists($todata."/houses/".$house['name'].".xml"))
{
$xml2 = simplexml_load_file($todata."/houses/".$house['name'].".xml");
foreach($xml2->owner as $howner)
{
if($howner['name'] == '')
$owner="nobody";
else
$owner="<b>".$howner['name']."</b>";
}
}
else
{
exit('Failed to open xml file.'.$todata."/houses/".$house['name'].".xml");
}