Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
Все равно пишет что там ошибка
<?php
if( ! defined( 'DATALIFEENGINE' ) ) {
die( "Hacking attempt!" );
}
$content = file_get_contents(ROOT_DIR."/templates/icubeland/gmonitoring.tpl");//
$select = $db->query("SELECT * FROM gen_monitoring ORDER BY id DESC");
if($db->num_rows($select)){
$monitoring = "";
include_once ('engine/api/api.class.php');
$lastcachetime = $dle_api->load_from_cache('lastcachetime');
if(!$lastcachetime){
$dle_api->save_to_cache ('lastcachetime',time());
goto reloadonline;
}
}
else if(time()-$lastcachetime > 180){
reloadonline:
include('MinecraftQuery.class.php');
while($srv = $db->get_row($select)){
$srvip = $srv['ip'];
$srvid = $srv['id'];
$srvport = $srv['port'];
$Query = new MinecraftQuery();
$Query->Connect($srvip, $srvport);
$srv = $Query->GetInfo();
$online = $srv['Players'];
$servername = $srv['HostName'];
if($servername) $dle_api->save_to_cache ("server$srvid", $online);
else $dle_api->save_to_cache ("server$srvid", "999");
}
}
while($srv = $db->get_row($select)){
$text = $content;
$srvname = $srv['servername'];
$srvip = $srv['ip'];
$srvport = $srv['port'];
$srvid = $srv['id'];
$srvonline = $dle_api->load_from_cache("server$srvid");
$text = str_replace("{servername}", $srvname, $text);
$text = str_replace("{online}", $srvonline, $text);
$text = str_replace("{percent}", $srvonline, $text);
$text = preg_replace("/\[total-online](.*[\s\S]*?)\[\/total-online]/", "", $text);
if($srvonline != 999){
$text = str_replace("[server-on]", "", $text);
$text = str_replace("[/server-on]", "", $text);
$text = preg_replace("/\[server-off](.*[\s\S]*?)\[\/server-off]/", "", $text);
}
else{
$text = str_replace("[server-off]", "", $text);
$text = str_replace("[/server-off]", "", $text);
$text = preg_replace("/\[server-on](.*[\s\S]*?)\[\/server-on]/", "", $text);
}
echo $text;
}
$select = $db->query("SELECT * FROM gen_monitoring ORDER BY id DESC");
if($db->num_rows($select) > 1){
$totalonline = 0;
$echototal = $content;
$echototal = str_replace("[total-online]", "", $echototal);
$echototal = str_replace("[/total-online]", "", $echototal);
$echototal = preg_replace("/\[server-off](.*[\s\S]*?)\[\/server-off]/", "", $echototal);
$echototal = preg_replace("/\[server-on](.*[\s\S]*?)\[\/server-on]/", "", $echototal);
while($srv = $db->get_row($select)){
$srvid = $srv['id'];
$srvonline = $dle_api->load_from_cache("server$srvid");
if($srvonline == 999) $srvonline = 0;
$totalonline += $srvonline;
}
$echototal = str_replace("{totalonline}", $totalonline, $echototal);
}
else $echototal = preg_replace("/\[total-online](.*[\s\S]*?)\[\/total-online]/", "", $echototal);
echo $echototal;
}
?>