Config.php
PHP код:
<?
$ip ="127.0.0.1"; // server IP
$dbip ="127.0.0.1"; // mysql IP
$dbport ="3306"; // mysql порт
$gameport ="8085"; // Порт сервера(game)
$dblogin ="login"; // mysql юзер
$dbpass ="pass"; // mysql пароль
$mdb ="mangos"; // База мира
$rdb ="realmd"; // База аккаунтов
$cdb ="characters"; // База персонажей
?>
Подключение к Базе данных:
PHP код:
<?
require_once ('config.php');
mysql_connect ("$dbip:$dbport","$dblogin","$dbpass");
?>
Количество созданных аккаунтов, количество по фракциям, количество гильдий:
PHP код:
<?
mysql_selectdb ("$rdb");
$acc = mysql_query ("select count(`id`) from `account`");
$acc = mysql_result ($acc,0);
mysql_selectdb ("$cdb");
$char = mysql_query ("select count(`guid`) from `characters`");
$char = mysql_result ($char,0);
$alliance = mysql_query ("select count(`guid`) from `characters` where `race` in (1,3,4,7,11)");
$alliance = mysql_result ($alliance,0);
$horde = mysql_query ("select count(`guid`) from `characters` where `race` in (2,5,6,8,10)");
$horde = mysql_result ($horde,0);
$guild = mysql_query ("select count(`guildid`) from `guild`");
$guild = mysql_result ($guild,0);
echo "Account: $acc<br>";
echo "Characters: $char<br>";
echo "Alliance: $alliance<br>";
echo "Horde: $horde<br>";
echo "Guild: $guild<br>";
?>
Статус сервера:
PHP код:
<?
$fp = @fsockopen ("$ip","$gameport",$errno,$errstr,1);
if ($fp)
echo "Server: online><br>";
else
echo "Server: offline><br>";
?>
Игроки он-лайн:
PHP код:
<?
mysql_selectdb ("$cdb");
$online = mysql_query ("select count(`guid`) from `characters` where `online` = 1");
$online = mysql_result ($online,0);
echo "Players Online: $online<br>";
?>
Аптайм:
PHP код:
<?
mysql_select_db ("$mdb");
$uptime = mysql_query ("select max(`starttime`) from `uptime`");
$uptime = time()-mysql_result ($uptime,0);
$sec = $uptime%60;
$uptime = intval ($uptime/60);
$min = $uptime%60;
$uptime = intval ($uptime/60);
$hours = $uptime;
echo "Uptime: $hours h $min min $sec sec<br>";
?>
Статистика по расам и классам:
PHP код:
<?
mysql_selectdb("$cdb");
$human = mysql_query ("select count(`guid`) from `characters` where `race` = 1");
$human = mysql_result ($human,0);
$dwarv = mysql_query ("select count(`guid`) from `characters` where `race` = 3");
$dwarv = mysql_result ($dwarv,0);
$night = mysql_query ("select count(`guid`) from `characters` where `race` = 4");
$night = mysql_result ($night,0);
$gnome = mysql_query ("select count(`guid`) from `characters` where `race` = 7");
$gnome = mysql_result ($gnome,0);
$draenei = mysql_query ("select count(`guid`) from `characters` where `race` = 11");
$draenei = mysql_result ($draenei,0);
$orc = mysql_query ("select count(`guid`) from `characters` where `race` = 2");
$orc = mysql_result ($orc,0);
$undead = mysql_query ("select count(`guid`) from `characters` where `race` = 5");
$undead = mysql_result ($undead,0);
$tauren = mysql_query ("select count(`guid`) from `characters` where `race` = 6");
$tauren = mysql_result ($tauren,0);
$troll = mysql_query ("select count(`guid`) from `characters` where `race` = 8");
$troll = mysql_result ($troll,0);
$blood = mysql_query ("select count(`guid`) from `characters` where `race` = 10");
$blood = mysql_result ($blood,0);
$druid = mysql_query ("select count(`guid`) from `characters` where `class` = 11");
$druid = mysql_result ($druid,0);
$hunter = mysql_query ("select count(`guid`) from `characters` where `class` = 3");
$hunter = mysql_result ($hunter,0);
$mage = mysql_query ("select count(`guid`) from `characters` where `class` = 8");
$mage = mysql_result ($mage,0);
$paladin = mysql_query ("select count(`guid`) from `characters` where `class` = 2");
$paladin = mysql_result ($paladin,0);
$priest = mysql_query ("select count(`guid`) from `characters` where `class` = 5");
$priest = mysql_result ($priest,0);
$rogue = mysql_query ("select count(`guid`) from `characters` where `class` = 4");
$rogue = mysql_result ($rogue,0);
$shaman = mysql_query ("select count(`guid`) from `characters` where `class` = 7");
$shaman = mysql_result ($shaman,0);
$warlock = mysql_query ("select count(`guid`) from `characters` where `class` = 9");
$warlock = mysql_result ($warlock,0);
$warrior = mysql_query ("select count(`guid`) from `characters` where `class` = 1");
$warrior = mysql_result ($warrior,0);
$death = mysql_query ("select count(`guid`) from `characters` where `class` = 6");
$death = mysql_result ($death,0);
echo "Humans: $human<br>";
echo "Dwarves: $dwarv<br>";
echo "Night Elves: $night<br>";
echo "Gnomes: $gnome<br>";
echo "Draenei: $draenei<br>";
echo "Orcs: $orc<br>";
echo "Undead: $undead<br>";
echo "Tauren: $tauren<br>";
echo "Trolls: $troll<br>";
echo "Blood Elves: $blood<br><br>";
echo "Druid: $druid<br>";
echo "Hunter: $hunter<br>";
echo "Mage: $mage<br>";
echo "Paladin: $paladin<br>";
echo "Priest: $priest<br>";
echo "Rogue: $rogue<br>";
echo "Shaman: $shaman<br>";
echo "Warlock: $warlock<br>";
echo "Warrior: $warrior<br>";
echo "Death Knight: $death<br>";
?>
Тема с mangos.ru, автора не помню...