Вот код:
/**
* STRESS WEB
* @author S.T.R.E.S.S.
* @copyright 2008 - 2012 STRESS WEB
* @version 13
* @web http://stressweb.ru
*/
if ( !defined("STRESSWEB") )
die( "Access denied..." );
if ( !$l2cfg["server"]["enable"] ) {
$tpl->SetResult( 'server', "Статус серверов временно не доступен" );
} else {
$mod_server = $controller->GetCache( 'mod_server' );
if ( $mod_server )
$tpl->SetResult( 'server', $mod_server );
else {
$LS = array();
$Total = 0;
foreach ( $lsList as $_L ) {
$LS[$_L] = $controller->GetStatus( $l2cfg["ls"][$_L]["host"], $l2cfg["ls"][$_L]["port"] );
}
foreach ( $gsList as $_S ) {
$tpl->LoadView( "server" );
$tpl->Block( 'main', false );
$tpl->Block( 'item' );
$GS = $controller->GetStatus( $l2cfg["gs"][$_S]["host"], $l2cfg["gs"][$_S]["port"] );
$db->gdb( $_S );
$Online = $gdb[$_S]->result( $gdb[$_S]->query("SELECT count(0) FROM `characters` WHERE `online`>'0'"), 0 );
if ( $l2cfg["gs"][$_S]["fake"]["enable"] ) {
$Online = intval( $Online * (1 + $l2cfg["gs"][$_S]["fake"]["percent"] / 100) );
}
$slink = ( $l2cfg["mod_rewrite"] ) ? "/stat/s{$_S}":"/index.php?f=stat&sid={$_S}";
$tpl->Set( "nameLink", "[url="".HTTP_HOME_URL."{$slink}"]{$l2cfg["gs"][$_S]["title"]}[/url]" );
$tpl->Set( "name", "{$l2cfg["gs"][$_S]["title"]}" );
$tpl->Set( "online", $Online );
$tpl->Set( "login", $LS[$l2cfg["gs"][$_S]["ls"]] );
$tpl->Set( "game", $GS );
$tpl->Set( "chronicle", $l2cfg["gs"][$_S]["chronicle"] );
$tpl->Build( "server_item" );
$Total += $Online;
if ( $l2cfg["txt"]["enable"] and $l2cfg["txt"]["gs"] == $_S ) {
$fopen = fopen( ROOT_DIR.'online.txt', "w" );
if ( $fopen ) {
fwrite( $fopen, $Online );
fclose( $fopen );
}
}
}
$tpl->LoadView( "server" );
$tpl->Block( 'main' );
$tpl->Block( 'item', false );
if ( isset($LS[0]) )
$tpl->Set( "login", $LS[0] );
$tpl->Set( 'item', $tpl->GetResult("server_item", true) );
if ( count($gsList) > 1 ) {
$tpl->Block( 'total' );
$tpl->Set( "total", $Total );
} else
$tpl->Block( 'total', false );
$tpl->Build( "server" );
if ( $l2cfg["cache"]["enable"] and $l2cfg['cache']['sList'] ) {
$controller->SetCache( "mod_server", $tpl->GetResult("server"), $l2cfg['cache']['sList'] );
}
}
}
?>
--
-- Структура таблицы `character_variables`
--
CREATE TABLE IF NOT EXISTS `character_variables` (
`obj_id` int(11) NOT NULL DEFAULT '0',
`type` varchar(86) NOT NULL DEFAULT '0',
`name` varchar(86) CHARACTER SET utf8 NOT NULL DEFAULT '0',
`value` varchar(4000) CHARACTER SET utf8 NOT NULL DEFAULT '0',
`expire_time` bigint(20) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
(268747893, 'user-var', 'offline', '1415437605', -1),