Скрипты (Mangos/Trinity)
Дата: Суббота, 03.09.2011, 07:10 | Сообщение # 1
VIP Статус: Злобный Пингвин
Группа: **V.i.P**
Сообщений: 1044
Доброго времени суток уважаемые форумчане вот сделал для вас темку кторая думаю будет очень актуальна для тех кто начинает делать сайты или просто хочет добавить к себе на сайт что-то новенькое, Ладно не будем кто что с этим будет делать. Ну что поехали : [blizz] Пример конфигурационного файла:
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 ?>
Максимальный онлайн за время работы сервера
[spoiler]
Code
<? include('config.php'); mysql_selectdb ("$dbr"); $max = mysql_query ("select max(`maxplayers`) from uptime"); $max = mysql_result ($max,0); echo "Максимальный онлайн:$max "; ?[/spoiler]>
Смена пароля
Code
<?php if($_POST['ok']) { if(!ereg("^[a-zA-Z0-9]+$", $_POST["login"])) { $err[] = '<b>Имя аккуанта:</b> введены запрещенные символы или поле пустое.'; } if(empty($_POST["oldpass"])) { $err[] = '<b>Старый пароль:</b> поле пустое.'; } if(empty($_POST["newpass"])) { $err[] = '<b>Новый пароль:</b> поле пустое.'; } if(empty($_POST["newspasss"])) { $err[] = '<b>Новый пароль ещё:</b> поле пустое.'; } $login = $_POST["login"]; $pass = $_POST["oldpass"]; $newpass = $_POST["newpass"]; $newpasss = $_POST["newspasss"]; $hashpass = sha1(strtoupper($login).":".strtoupper($pass)); $query = mysql_query("SELECT `username`,`sha_pass_hash` FROM `account` WHERE `username`='".$login."'"); $arr = mysql_fetch_array($query); if($arr['username'] != $login){ $err[] = 'Введён неверный логин'; } if($hashpass != $arr['sha_pass_hash']){ $err[] = 'Введён невеный старый пароль'; } if($newpass != $newpasss){ $err[] = 'Введённые пароли не совподают'; } if(count($err) == 0){ mysql_query("UPDATE `account` set sha_pass_hash = SHA1(CONCAT(UPPER('$login'),':',UPPER('$newpass'))) where username = \"".$login."\";"); header("location: ?change=ok"); }else{ $err[] = $error; } } foreach ($err as $error){ echo '<div align="center">'.$error."</div>"; } if( $_GET["change"] == null ){ echo '<form method="POST" enctype="multipart/form-data"> <table align="center" border="0" width="" cellpadding="0" cellspacing="0"> <tr><td>Имя аккуанта:</td></tr> <tr><td align="center"><input type="text" name="login" align="center"></td></tr> <tr><td>Старый пароль:</td></tr> <tr><td align="center"><input type="password" name="oldpass" align="center"></td></tr> <tr><td>Новый пароль:</td></tr> <tr><td align="center"><input type="password" name="newpass" align="center"></td></tr> <tr><td>Новый пароль ещё:</td></tr> <tr><td align="center"><input type="password" name="newspasss" align="center"></td></tr> <tr><td align="center"><input type="submit" name="ok" value="Сменить пароль"></td></tr> </table> </form>'; }else{ echo "<meta http-equiv=\"refresh\" content=\"5; url=test.php\" />"; echo '<div align="center" style="color: green; font-weight: bold;" >Пароль сменён успешно !</div>'; } ?>
Время работы сервера
Code
<? $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>"; ?>
Cтатистика по расам и классам
Code
<? $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>"; ?>
[/blizz]
Сообщение отредактировал Shoop - Суббота, 03.09.2011, 07:27
Дата: Суббота, 03.09.2011, 07:19 | Сообщение # 2
VIP Статус: Злобный Пингвин
Группа: **V.i.P**
Сообщений: 1044
[blizz]Бан Лист
Code
<?php echo "<TABLE>"; echo "<TR><TD colSpan=5>Список заблокированных</TD></TR>"; echo "<TR><TD width=10%>Аккаунт</TD><TD>Забанил</TD><TD>Причина</TD><TD>Был забанен</TD><TD>Будет разбанен</TD></TR>"; $getban = mysql_query("SELECT * FROM account_banned WHERE active='1'"); while($banid = mysql_fetch_array($getban)) { $id = "".$banid['id'].""; $who = "".$banid['bannedby'].""; $unbandate = date("d.m.Y", $banid['unbandate']); $bandate = date("d.m.Y", $banid['bandate']); $reason = "".$banid['banreason'].""; $getbanned = mysql_query("SELECT username FROM account WHERE id='$id'"); while($banned = mysql_fetch_array($getbanned)) { $acc = "".$banned['username'].""; echo "<TR><TD width=10%>$acc</TD><TD>$who</TD><TD width=45%>$reason</TD><TD width=20%>$bandate</TD><TD width=25%>$unbandate</TD></TR>"; } } echo "</TABLE>"; ?>
Картинка-Статус для какого-либо сервера.
Code
<?php $fp = fsockopen("0we.ru", 8080, $errno, $errstr, 30); if($fp){ $im = imagecreatefrompng("online.png"); }else{ $im = imagecreatefrompng("offline.png"); } header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?>
Проверка статуса сервера.
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>"; ?>
Список:Кто Onlain
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>
Информация о Арена Командах
Code
mysql_selectdb ("characters"); $rating = mysql_query ("select max(`rating`) from arena_team_stats"); $rating = mysql_result ($rating,0); $id = mysql_query ("SELECT arenateamid FROM arena_team_stats WHERE rating=$rating"); $id = mysql_result ($id,0); $name = mysql_query ("SELECT name FROM arena_team WHERE arenateamid=$id"); $name = mysql_result ($name,0); $player_rating = mysql_query ("select max(`personal_rating`) from arena_team_member"); $player_rating = mysql_result ($player_rating,0); $player_id = mysql_query ("SELECT guid FROM arena_team_member WHERE personal_rating=$player_rating"); $player_id = mysql_result ($player_id,0); $player_name = mysql_query ("SELECT name FROM characters WHERE guid=$player_id"); $player_name = mysql_result ($player_name,0); echo "Самая лучшая команда: <font color=green>$name</font> (<font color=red>$rating</font>)<br>"; echo "Самый лучший игрок Арены: <font color=blue>$player_name</font>"
Code
$rdb - логин база $cdb - база персонажей
Code
mysql_selectdb("$rdb"); $gm_guid_result = array(); $i=1; $gm_acc_id = mysql_query("select `id` from `account` WHERE `gmlevel` > '0'"); while ($gm_acc_result = mysql_fetch_object($gm_acc_id)) { mysql_selectdb("$cdb"); $id_gm = mysql_query ("select `guid` from `characters` WHERE `account` = '$gm_acc_result->id'"); while ($gm_guid = mysql_fetch_object($id_gm)) { $gm_guid_result[$i] = $gm_guid->guid; $i++; } } $gm_guid_string = implode(",", $gm_guid_result); if (!$gm_guid_string) { $rating = mysql_query ("select max(`rating`) from arena_team_stats"); $rating = mysql_result ($rating,0); $player_rating = mysql_query ("select max(`personal_rating`) from arena_team_member"); $player_rating = mysql_result ($player_rating,0); } else { $arena_gm_result = array(); $k=1; $arena_gm_id = mysql_query("select `arenateamid` from `arena_team_member` WHERE `guid` in ($gm_guid_string)"); while ($arena_gm = mysql_fetch_object($arena_gm_id)) { $arena_gm_result[$k] = $arena_gm->arenateamid; $k++; } $arena_gm_result_sort = array_unique($arena_gm_result); $arena_gm_result_sort_string = implode(",", $arena_gm_result_sort); if (!$arena_gm_result_sort_string) { $rating = mysql_query ("select max(`rating`) from arena_team_stats"); $rating = mysql_result ($rating,0); $player_rating = mysql_query ("select max(`personal_rating`) from arena_team_member"); $player_rating = mysql_result ($player_rating,0); } else { $ rating = mysql_query ("select max(`rating`) from arena_team_stats where arenateamid not in ($arena_gm_result_sort_string)"); $rating = mysql_result ($rating,0); $player_rating = mysql_query ("select max(`personal_rating`) from arena_team_member WHERE guid not in ($gm_guid_string)"); $player_rating = mysql_result ($player_rating,0); } } $id = mysql_query ("SELECT arenateamid FROM arena_team_stats WHERE rating=$rating"); $id = mysql_result ($id,0); $name = mysql_query ("SELECT name FROM arena_team WHERE arenateamid=$id"); $name = mysql_result ($name,0); $player_id = mysql_query ("SELECT guid FROM arena_team_member WHERE personal_rating='$player_rating'"); $player_id = mysql_result ($player_id,0); $player_name = mysql_query ("SELECT name FROM characters WHERE guid=$player_id"); $player_name = mysql_result ($player_name,0); echo "Самая лучшая команда: <font color=green>$name</font> (<font color=red>$rating</font>)<br>"; echo "Самый лучший игрок Арены: <font color=blue>$player_name</font>";
[/blizz]
Сообщение отредактировал Shoop - Суббота, 03.09.2011, 07:26
Дата: Суббота, 03.09.2011, 07:20 | Сообщение # 3
VIP Статус: Злобный Пингвин
Группа: **V.i.P**
Сообщений: 1044
[blizz]топ Задротов сервера
Code
<?php define("DBHOST", "localhost"); define("DBUSER", "root"); define("DBPASS", "mangos"); define("COLLATE", "utf8"); define("CDB", "characters"); 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}м."; } $class = array ( 1=>"Воин", 2=>"Паладин", 3 = >"Охотник", 4=>"Разбойник", 5=>"Жрец", 6 =>"Рыцарь Смерти", 7=>"Шаман", 8=>"Маг", 9=>"Чернок нижник ", 11=>"Друид" ); $race = array ( 1=>"Человек", 2=>"Орк", 3=>"Д ворф", 4=>"Ночной Эльф", 5=>"Нежить", 6=>"Таурен", 7=>"Гном ", 8 =>"Тролль", 10=>"Эльф Крови", 11=>"Дреней" ); $sMySql = mysql_connect(DBHOST, DBUSER, DBPASS); // Соединяемся с базой mysql_query("SET NAMES COLLATE"); // Устанавливаем кодировку соединения mysql_select_db(CDB, $sMySql); $aSql = mysql_query("SELECT `name`, `race`, `class`, `totaltime` FROM `characters` ORDER BY `totaltime` DESC LIMIT 0 , 15", $sMySql); $szContent .= " <table width='98%' border='1' align='center'><tr> <td align='center' width='20%'><font color='green'>Персонаж</font></td> <td align='center' width='20%'><font color='green'>Сыгранное время</font></td> <td align='center' width='20%'><font color='green'>Класс</font></td> <td align='center' width='20%'><font color='green'>Раса</font></td> </tr></table>"; while ($row = mysql_fetch_array($aSql)) { $name = $row['name']; $totaltime = conventNormTime($row['totaltime']); $show_race = $race[$row['race']]; $show_class = $class[$row['class']]; $szContent .= "<table width='98%' border='1' align='center'><tr> <td align='center' width='20%'>".$name."</td> <td align='center' width='20%'>".$totaltime."</td> <td align='center' width='20%'>".$show_class."</td> <td align='center' width='20%'>".$show_race."</td> </tr></table>"; } mysql_close($sMySql); // Закрываем соединение mysql echo $szContent; ?>
Скрипт регистрации:
Code
<?php // Configuration. // Realm database. $r_db = "Realmd"; // IP (and port). $ip = "127.0.0.1:3306"; // Username. $user = "trinity"; // Password. $pass = "trinity"; // Site title. $title = "Registration Form"; $title2 = "Server name"; // End config. $page = '<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>' . $title . '</title> </head> <body style="background-color:black;color:yellow;font-family:verdana;"> <form method="post" action="' . $_SERVER["SCRIPT_NAME"] . '"> <p style="text-align:center;"> <strong>' . $title2 . ' - ' . $title . '</strong> Login: <input name="username" type="text" maxlength="14" /> Password: <input name="password" type="password" maxlength="12" /> Email: <input name="email" type="text" maxlength="50" /> <input name="tbc" type="checkbox" checked="checked" /> WotLK <button type="submit">Registration</button> </p> </form> </body> </html>'; function error_s ($text) { echo("<p style=\"background-color:black;color:yellow;font-family:verdana;\">" . $text); echo(" <a style=\"color:orange;\" href=\"" . $_SERVER["SCRIPT_NAME"] . "\">Go back...</a></p>"); }; $user_chars = "#[^a-zA-Z0-9_\-]#";&
[/blizz]
Сообщение отредактировал Shoop - Суббота, 03.09.2011, 07:26
Дата: Суббота, 03.09.2011, 07:24 | Сообщение # 4
VIP Статус: Злобный Пингвин
Группа: **V.i.P**
Сообщений: 1044
[blizz]Скрипт по классам и расам:
Code
<? include('config.php'); mysql_connect("$ip", "$dblogin", "$dbpass"); mysql_select_db ("$dbc"); $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 "; echo "Дварфов: $dwarv "; echo "Ночных Эльфов: $night "; echo "Гномов: $gnome "; echo "Дренейев: $draenei "; echo "Орков: $orc "; echo "Нежити: $undead "; echo "Тауренов: $tauren "; echo "Троллей: $troll "; echo "Эльфов Крови: $blood "; echo "Друидов: $druid "; echo "Охотников: $hunter "; echo "Магов: $mage "; echo "Паладинов: $paladin "; echo "Жрецов: $priest "; echo "Разбойников: $rogue "; echo "Шаманов: $shaman "; echo "Чернокнижников: $warlock "; echo "Воинов: $warrior "; echo "Рыцарей Смерти: $death "; ?>
Имя, Уровень ,Звани в Гильдии , Раса , Класс - таблица
Quote
$realm = $realmdDB -> selectrow("SELECT * FROM `realmlist` WHERE `id` = ?d;", $CONF['realmID']);
$realmOnline = testRealm($realm);
if ($realmOnline) {
if (isset($_GET['id'])) {
$guild = $charactersDB -> selectrow(
"SELECT `c`.`name` as `lname`, `g`.`name`, `g`.`createdate`, `g`.`BankMoney`, `g`.`info`, `g`.`motd` ".
"FROM `guild` as `g` ".
"LEFT JOIN `characters` as `c` ON `c`.`guid` = `g`.`leaderguid` ".
"WHERE `g`.`guildid` = ?d;", $_GET['id']);
$members = $charactersDB -> select(
"SELECT `c`.`name`, `c`.`race`, `c`.`class`, `c`.`account`, `g_m`.`pnote`, `g_m`.`offnote`, `g_r`.`rname`, ".
"CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`c`.`data`, ' ', 54), ' ', -1) AS UNSIGNED) as `level`, ".
"CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`c`.`data`, ' ', 23), ' ', -1) AS UNSIGNED) as `gender` ".
"FROM `guild_member` as `g_m` ".
"LEFT JOIN `characters` as `c` ON `c`.`guid` = `g_m`.`guid` ".
"LEFT JOIN `guild_rank` as `g_r` ON (`g_r`.`rid` = `g_m`.`rank` AND `g_r`.`guildid` = `g_m`.`guildid`) ".
"WHERE `g_m`.`guildid` = ?d", $_GET['id']);
?>
Название: Гильдмастер: Дата создания: Денег в банке: Информация: Девиз:
Участники гильдии: # Имя Уровень Звание в гильдии Раса Класс $i = 1; foreach ($members as $member) { $member['aname'] = $realmdDB -> selectcell("SELECT `username` FROM `account` WHERE `id` = ?d;", $member['account']); ?> "; ?> "; ?> $i++; } echo "
\n";
} else {
!isset($_GET['sb'])? $_GET['sb'] = 'name': $_GET['sb'];
!isset($_GET['sc'])? $_GET['sc'] = 'ASC': $_GET['sc'];
if ($_GET['sc'] != 'ASC' && $_GET['sc'] != 'DESC') $_GET['sc'] = 'DESC';
$guilds = $charactersDB -> select(
"SELECT `c`.`name` as `lname`, `g`.`name`, `g`.`createdate`, `g`.`BankMoney`, `g`.`guildid` ".
"FROM `guild` as `g` ".
"LEFT JOIN `characters` as `c` ON `c`.`guid` = `g`.`leaderguid` ".
"ORDER BY ?# ".$_GET['sc'].";", $_GET['sb']);
$i = 1;
?>
\n";
}
} else {
echo $realm['name']." выключен.
\n";
}
?>
Максимальный онлайн
Code
<? include('config.php'); mysql_selectdb ("$dbr"); $max = mysql_query ("select max(`maxplayers`) from uptime"); $max = mysql_result ($max,0); echo "Максимальный онлайн:$max "; ?>
[/blizz]
Сообщение отредактировал Shoop - Суббота, 03.09.2011, 07:26
Дата: Суббота, 03.09.2011, 07:32 | Сообщение # 5
VIP Статус: Злобный Пингвин
Группа: **V.i.P**
Сообщений: 1044
[blizz]Статистика арены 2х2
Code
$select_db = mysql_select_db('characters'); $select_arena_ratings = mysql_query("SELECT rating,arenateamid FROM `characters`.`arena_team_stats` ORDER BY rating DESC"); $i = 1; echo "<table border=1 align=center>"; echo "<td width=190px>Название команды</td>"; echo "<td width=130px>Очки</td>"; echo "<td width=130px>Состав</td>"; echo "</table>"; while($select_arena_rating = mysql_fetch_array($select_arena_ratings)) { $select_arena_tnames = mysql_query("SELECT * FROM `characters`.`arena_team` WHERE type=2 && arenateamid='".$select_arena_rating[arenateamid]."'"); while($select_arena_tname = mysql_fetch_array($select_arena_tnames)) { $select_member_names = mysql_query("SELECT * FROM `characters`.`arena_team_member` WHERE arenateamid = '".$select_arena_tname[arenateamid]."'"); $select_member_rows = mysql_num_rows($select_member_names); if($select_member_rows == 2) { echo "<table border=1 align=center>"; echo "<td width=190px><dic style='width:110px;'><a>".$select_arena_tname['name']."</a></div></td>"; echo "<td width=130px><dic style='width:110px;'><a>".$select_arena_rating['rating']."</a></div></td>"; echo "<td width=130px>"; while($select_member_name = mysql_fetch_array($select_member_names)) { $result_name_members = mysql_query("SELECT * FROM `characters`.`characters` WHERE guid = '".$select_member_name[guid]."'"); $result_name_member = mysql_fetch_array($result_name_members); echo "<div style='width:110px;'><a>".$result_name_member['name']."</a></div>"; } echo "</td>"; } echo "</table>"; $i++; } }
Статистика арены 3х3
Code
$select_db = mysql_select_db('characters'); $select_arena_ratings = mysql_query("SELECT rating,arenateamid FROM `characters`.`arena_team_stats` ORDER BY rating DESC"); $i = 1; echo "<table border=1 align=center>"; echo "<td width=190px>Название команды</td>"; echo "<td width=130px>Очки</td>"; echo "<td width=130px>Состав</td>"; echo "</table>"; while($select_arena_rating = mysql_fetch_array($select_arena_ratings)) { $select_arena_tnames = mysql_query("SELECT * FROM `characters`.`arena_team` WHERE type=3 && arenateamid='".$select_arena_rating[arenateamid]."'"); while($select_arena_tname = mysql_fetch_array($select_arena_tnames)) { $select_member_names = mysql_query("SELECT * FROM `characters`.`arena_team_member` WHERE arenateamid = '".$select_arena_tname[arenateamid]."'"); $select_member_rows = mysql_num_rows($select_member_names); if($select_member_rows == 3) { echo "<table border=1 align=center>"; echo "<td width=190px><dic style='width:110px;'><a>".$select_arena_tname['name']."</a></div></td>"; echo "<td width=130px><dic style='width:110px;'><a>".$select_arena_rating['rating']."</a></div></td>"; echo "<td width=130px>"; while($select_member_name = mysql_fetch_array($select_member_names)) { $result_name_members = mysql_query("SELECT * FROM `characters`.`characters` WHERE guid = '".$select_member_name[guid]."'"); $result_name_member = mysql_fetch_array($result_name_members); echo "<div style='width:110px;'><a>".$result_name_member['name']."</a></div>"; } echo "</td>"; } echo "</table>"; $i++; } }
Статистика арены 5х5
Code
$select_db = mysql_select_db('characters'); $select_arena_ratings = mysql_query("SELECT rating,arenateamid FROM `characters`.`arena_team_stats` ORDER BY rating DESC"); $i = 1; echo "<table border=1 align=center>"; echo "<td width=190px>Название команды</td>"; echo "<td width=130px>Очки</td>"; echo "<td width=130px>Состав</td>"; echo "</table>"; while($select_arena_rating = mysql_fetch_array($select_arena_ratings)) { $select_arena_tnames = mysql_query("SELECT * FROM `characters`.`arena_team` WHERE type=5 && arenateamid='".$select_arena_rating[arenateamid]."'"); while($select_arena_tname = mysql_fetch_array($select_arena_tnames)) { $select_member_names = mysql_query("SELECT * FROM `characters`.`arena_team_member` WHERE arenateamid = '".$select_arena_tname[arenateamid]."'"); $select_member_rows = mysql_num_rows($select_member_names); if($select_member_rows == 5) { echo "<table border=1 align=center>"; echo "<td width=190px><dic style='width:110px;'><a>".$select_arena_tname['name']."</a></div></td>"; echo "<td width=130px><dic style='width:110px;'><a>".$select_arena_rating['rating']."</a></div></td>"; echo "<td width=130px>"; while($select_member_name = mysql_fetch_array($select_member_names)) { $result_name_members = mysql_query("SELECT * FROM `characters`.`characters` WHERE guid = '".$select_member_name[guid]."'"); $result_name_member = mysql_fetch_array($result_name_members); echo "<div style='width:110px;'><a>".$result_name_member['name']."</a></div>"; } echo "</td>"; } echo "</table>"; $i++; } }
[/blizz]
Сообщение отредактировал Shoop - Суббота, 03.09.2011, 07:33
Дата: Суббота, 03.09.2011, 07:37 | Сообщение # 6
VIP Статус: Злобный Пингвин
Группа: **V.i.P**
Сообщений: 1044
[blizz]топ 5 самых активных
Code
<?php $conn=mysql_connect('localhost', 'root', 'ascent') or die(); mysql_select_db('forum'); $news_id = $_GET['user_id']; $news = $_GET['user_posts']; $i=0; $query_news=mysql_query("SELECT user_posts, username, user_id FROM phpbb_users ORDER BY user_posts DESC LIMIT 5") or die (mysql_error()); $num_news=mysql_num_rows($query_news); mysql_close($conn); ?> <?php while($fetch_news=mysql_fetch_array($query_news)) { $news_id = $fetch_news['user_id']; $i++?> <?php $uid = $fetch_news['user_id']; ?> [*] <?php print(sprintf("<a href=\"http://localhost/community/memberlist.php?mode=viewprofile&u=%s\">", (string)$uid));?> <strong class="explore-caption"><?php print $fetch_news['username']; ?></strong> <?php print $fetch_news['user_posts']; ?> posts</a> </li> <?php }?>
Этот срипт показывает 5 убийц седня и вобшем
Code
<?php $dbhost = "host"; $dbuser = "username"; $dbpass = "password"; $dbchar = "characters"; //Most trinity dbs have characters as db. but if u have another, edit it. mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbchar); ?> <strong>Top Kills Today</strong> <hr /> <?php $sql = "SELECT name, killsToday FROM characters ORDER BY killsToday DESC LIMIT 5"; $i = '1'; $query = @mysql_query($sql); $num = @mysql_num_rows($query); if(!$num) { echo 'No kills today.'; } else { while($row = mysql_fetch_assoc(($query))) { echo "" . $i . ". " . $row["name"] . " with " . $row["killsToday"] . " Honorable Kills.<hr />"; $i++; } } ?> <strong>Top Kills Total</strong> <hr /> <?php $sql = "SELECT name, killsLifeTime FROM characters ORDER BY killsLifeTime DESC LIMIT 5"; $i='1'; $query = @mysql_query($sql); $num = @mysql_num_rows($query); if(!$num) { echo 'No kills yet.'; } else { while($row = mysql_fetch_assoc(($query))) { echo "" . $i . ". " . $row["name"] . " with " . $row["killsLifeTime"] . " Honorable Kills.<hr />"; $i++; } }?>
[/blizz]
Сообщение отредактировал Shoop - Суббота, 03.09.2011, 07:38
Дата: Суббота, 03.09.2011, 16:13 | Сообщение # 7
Группа: **V.i.P**
Сообщений: 461
А зачем ТУТ такоеже делать?
http://devil-wow.com/ CS 1.6 War3 + CSDM IP - 46.174.48.80:27015