Code
require_once ('includes/config.php'); //подключаем файл конфигурации
$sMySql = mysql_connect('$host', ' $db_user', ' $db_user_passw') or die("Невозможно подключиться к базе : " . mysql_error());; //открываем mysql.
$aSql = mysql_num_rows(mysql_query("SELECT guildid FROM characters.guild", $sMySql));
$nTotalGuild = $aSql;
$aSql = mysql_num_rows(mysql_query("SELECT guid FROM characters.characters WHERE race IN ( 1, 4, 11, 3, 7 )", $sMySql));
$nTotalAlliance = $aSql;
$aSql = mysql_num_rows(mysql_query("SELECT guid FROM characters.characters WHERE race IN (6, 10, 5, 2, 8)", $sMySql));
$nTotalHorde = $aSql;
function conventNormTime($nSec) {
$d = floor( $nSec / (3600*24) );
$nSec = ($nSec - $d * 3600 * 24);
$h = floor( $nSec / 3600 );
$nSec = ($nSec - $h * 3600);
$m = floor( $nSec / 60 );
return "{$d} д. {$h} ч. {$m} м.";
}
$aSql = mysql_fetch_array(mysql_query("SELECT maxplayers FROM realmd.uptime ORDER by maxplayers DESC LIMIT 1", $sMySql));
$nMaxOnline = $aSql['maxplayers'];
$aSql = mysql_fetch_array(mysql_query("SELECT uptime FROM realmd.uptime ORDER by starttime DESC LIMIT 1", $sMySql));
$tUptime = conventNormTime($aSql['uptime']);
$aSql = mysql_query("SELECT uptime FROM realmd.uptime ORDER by uptime DESC LIMIT 1", $sMySql);
$aSql =mysql_fetch_array($aSql);
$aTotal = $aSql['uptime'];
$aTotal = conventNormTime($aSql['uptime']);
$aSql = mysql_num_rows(mysql_query("SELECT id FROM realmd.account", $sMySql));
$nTotalAccount = $aSql;
$aSql = mysql_num_rows(mysql_query("SELECT guid FROM characters.characters WHERE online IN ( 1 )", $sMySql));
$nCurrenOnline = $aSql;
$aOut = array(
'online' => $nCurrenOnline,
'max_online' => $nMaxOnline,
'uptime' => $tUptime,
'max_uptime' => $aTotal,
'reg_accounts' => $nTotalAccount,
'reg_horde' => $nTotalHorde,
'reg_alliance' => $nTotalAlliance,
);
echo '<tr><td>Онлайн:</td> <td><b>{$nCurrenOnline}</b></td></tr>';
echo '<tr><td>Макс. онлайн:</td> <td><b>{$nMaxOnline}</b></td></tr>';
echo '<tr><td>Макс. аптайм:</td> <td><b>{$aTotal}</b></td></tr>';
echo '<tr><td>Акаунтов:</td> <td><b>{$nTotalAccount}</b></td></tr>';
echo '<tr><td>Альянса:</td> <td><b>{$nTotalAlliance}</b></td> </tr>';
echo '<tr><td>Орды:</td> <td><b>{$nTotalHorde}</b></td></tr>';
mysql_close ($sMySql)
?>