Основные Скрипты для Mangos Сайта.
Чистые скрипты, которые вы сможите легко вставить в любой ваш проект. CONFIG.PHP
Code
<?
$ip ="127.0.0.1"; // IP сервера
$dbip ="127.0.0.1"; // IP mysql
$dbport ="3306"; // порт mysql
$gameport ="8085"; // игровой порт
$dblogin ="login"; // логин mysql
$dbpass ="password"; // пароль mysql
$mdb ="mangos"; // название базы mangos
$rdb ="realmd"; // название базы realmd
$cdb ="characters"; // название базы characters
?>
Подключение к базе
Code
<?
require_once ('config.php');
mysql_connect ("$dbip:$dbport","$dblogin","$dbpass");
?>
Проверка статуса сервера
Code
<?
$fp = @fsockopen ("$ip","$gameport",$errno,$errstr,1);
if ($fp)
echo "Статус Сервера: online<br>";
else
echo "Статус Сервера: offline<br>";
?>
Кол-во аккаунтов, персонажей, орды, альянса, гильдий
Code
<?
mysql_selectdb ($rdb);
$acc = mysql_query ("select count(*) from account");
$acc = mysql_result ($acc,0);
mysql_selectdb ("$cdb");
$char = mysql_query ("select count(*) from characters");
$char = mysql_result ($char,0);
$alliance = mysql_query ("select count(*) from characters where race in (1,3,4,7,11)");
$alliance = mysql_result ($alliance,0);
$horde = mysql_query ("select count(*) from characters where race in (2,5,6,8,10)");
$horde = mysql_result ($horde,0);
$guild = mysql_query ("select count(*) from guild");
$guild = mysql_result ($guild,0);
echo "Аккаунтов: $acc<br>";
echo "Персонажей: $char<br>";
echo "Альянса: $alliance<br>";
echo "Орды: $horde<br>";
echo "Гильдий: $guild<br>";
?>
Кол-во игроков онлайн, орды онлайн, альянса онлайн, максимальный онлайн
Code
<?
mysql_selectdb ("$cdb");
$online = mysql_query ("select count(*) from characters where online = 1");
$online = mysql_result ($online,0);
$allianceonline = mysql_query ("select count(*) from characters where online = 1 and race in (1,3,4,7,11)");
$allianceonline = mysql_result ($allianceonline,0);
$hordeonline = mysql_query ("select count(*) from characters where online = 1 and race in (2,5,6,8,10)");
$hordeonline = mysql_result ($hordeonline,0);
mysql_selectdb ("$rdb");
$max = mysql_query ("select max(`maxplayers`) from uptime");
$max = mysql_result ($max,0);
echo "Игроков Онлайн: $online<br>";
echo "Альянса Онлайн: $allianceonline<br>";
echo "Орды Онлайн: $hordeonline<br>";
echo "Максимальный Онлайн: $max<br>";
?>
Добавлено (22.01.2010, 00:01)
---------------------------------------------
Всьо в адну тему невлезло от продолжение
Время работы сервера
Code
<?
mysql_select_db ("$rdb");
$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%24;
$uptime = intval($uptime/24);
$days = $uptime;
echo "Время Работы: $days д $hours ч $min м $sec с<br>";
?>
Статистика по расам и классам
Code
<?
mysql_selectdb ("$cdb");
$human = mysql_query ("select count(*) from characters where race = 1");
$human = mysql_result ($human,0);
$dwarv = mysql_query ("select count(*) from characters where race = 3");
$dwarv = mysql_result ($dwarv,0);
$night = mysql_query ("select count(*) from characters where race = 4");
$night = mysql_result ($night,0);
$gnome = mysql_query ("select count(*) from characters where race = 7");
$gnome = mysql_result ($gnome,0);
$draenei = mysql_query ("select count(*) from characters where race = 11");
$draenei = mysql_result ($draenei,0);
$orc = mysql_query ("select count(*) from characters where race = 2");
$orc = mysql_result ($orc,0);
$undead = mysql_query ("select count(*) from characters where race = 5");
$undead = mysql_result ($undead,0);
$tauren = mysql_query ("select count(*) from characters where race = 6");
$tauren = mysql_result ($tauren,0);
$troll = mysql_query ("select count(*) from characters where race = 8");
$troll = mysql_result ($troll,0);
$blood = mysql_query ("select count(*) from characters where race = 10");
$blood = mysql_result ($blood,0);
$druid = mysql_query ("select count(*) from characters where class = 11");
$druid = mysql_result ($druid,0);
$hunter = mysql_query ("select count(*) from characters where class = 3");
$hunter = mysql_result ($hunter,0);
$mage = mysql_query ("select count(*) from characters where class = 8");
$mage = mysql_result ($mage,0);
$paladin = mysql_query ("select count(*) from characters where class = 2");
$paladin = mysql_result ($paladin,0);
$priest = mysql_query ("select count(*) from characters where class = 5");
$priest = mysql_result ($priest,0);
$rogue = mysql_query ("select count(*) from characters where class = 4");
$rogue = mysql_result ($rogue,0);
$shaman = mysql_query ("select count(*) from characters where class = 7");
$shaman = mysql_result ($shaman,0);
$warlock = mysql_query ("select count(*) from characters where class = 9");
$warlock = mysql_result ($warlock,0);
$warrior = mysql_query ("select count(*) from characters where class = 1");
$warrior = mysql_result ($warrior,0);
$death = mysql_query ("select count(*) from characters where class = 6");
$death = mysql_result ($death,0);
echo "Людей: $human<br>";
echo "Дворфов: $dwarv<br>";
echo "Ночных Эльфов: $night<br>";
echo "Гномов: $gnome<br>";
echo "Дренейев: $draenei<br>";
echo "Орков: $orc<br>";
echo "Нежити: $undead<br>";
echo "Тауренов: $tauren<br>";
echo "Троллей: $troll<br>";
echo "Эльфов Крови: $blood<br><br>";
echo "Друидов: $druid<br>";
echo "Охотников: $hunter<br>";
echo "Магов: $mage<br>";
echo "Паладинов: $paladin<br>";
echo "Жрецов: $priest<br>";
echo "Разбойников: $rogue<br>";
echo "Шаманов: $shaman<br>";
echo "Чернокнижников: $warlock<br>";
echo "Воинов: $warrior<br>";
echo "Рыцарей Смерти: $death<br>";
?>
Добавлено (22.01.2010, 00:04)
---------------------------------------------
Список игроков онлайн
Code
<table border="0">
<tr>
<td><strong>Имя:</strong></td>
<td><strong>Раса:</strong></td>
<td><strong>Класс:</strong></td>
<td><strong>Уровень:</strong></td>
</tr>
<?
mysql_selectdb ("$cdb");
mysql_query ('set names cp1251');
$result = mysql_query ("select name, race, class, data from characters where online = 1");
$class = array
(1=>"Воин",2=>"Паладин",3=>"Охотник",4=>"Разбойник",5=>"Жрец",6=>"Рыцарь Смерти",7=>"Шаман",8=>"Маг",9=>"Чернокнижник",11=>"Друид");
$race = array
(1=>"Человек",2=>"Орк",3=>"Дворф",4=>"Ночной Эльф",5=>"Нежить",6=>"Таурен",7=>"Гном",8=>"Тролль",10=>"Эльф Крови",11=>"Дреней");
while ($row = mysql_fetch_array ($result))
{
$ch_name = $row['name'];
$ch_race = $row['race'];
$ch_class = $row['class'];
$char_data = explode(' ',$row['data']);
$ch_lvl = $char_data[53];
echo "<tr><td><strong>$ch_name</strong></td>";
echo "<td><strong>$race[$ch_race]</strong></td>";
echo "<td><strong>$class[$ch_class]</strong></td>";
echo "<td><strong>$ch_lvl</strong></td></tr>";
}
?>
</table>
____________________________________________________ Незабывайте про +сики