Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style>
- body {
- margin: 0;
- background:#ddd;
- }
- h2 {
- margin:5px;
- }
- table {
- border-collapse:collapse;
- background:#333;
- color:#BBB;
- }
- th {
- border-left:1px solid #000;
- border-right:1px solid #000;
- border-bottom:1px solid #000;
- color:#fe5;
- }
- #border {
- border-left:1px solid #000;
- border-right:1px solid #000;
- border-bottom:1px solid #000;
- }
- #border td {
- border-left:1px solid #000;
- border-right:1px solid #000;
- }
- </style>
- <?php
- $host = 'localhost';
- $user = 'root';
- $pass = '';
- $cdb = 'characters';
- $connect = mysql_connect($host,$user,$pass) or die('Нет подключения к базе данных');
- mysql_select_db ($cdb, $connect) or die(mysql_error());
- $sql = mysql_query("SELECT `character_achievement`.`guid` AS `guid`, SUM(`achievement_point`.`value`) AS `sum` FROM `character_achievement` INNER JOIN `achievement_point` ON `character_achievement`.`achievement`=`achievement_point`.`achievement` GROUP BY `character_achievement`.`guid` ORDER BY `sum` DESC LIMIT 100", $connect) or die(mysql_error());
- print "<h2 align=\"center\">Топ достижений</h2>
- <table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"800\"><tr>
- <th width=\"30\">№</th>
- <th>Имя</th>
- <th width=\"30\">Лвл</th>
- <th width=\"120\">Раса</th>
- <th width=\"120\">Класс</th>
- <th width=\"100\">Сторона</th>
- <th width=\"120\">Достижений</th>
- <th width=\"120\">Очков достижений</th>
- </tr></table>";
- $id = 1;
- while ($result = mysql_fetch_assoc($sql)){
- $guid = $result['guid'];
- $point = $result['sum'];
- $sql_count = mysql_query("SELECT COUNT(*) FROM `character_achievement` WHERE `guid` = $guid", $connect) or die(mysql_error());
- $result_count = mysql_result($sql_count,0);
- $sql_char = mysql_query("SET NAMES cp1251");
- $sql_char = mysql_query("SELECT * FROM `characters` WHERE `guid` = $guid", $connect) or die(mysql_error());
- $result_char = mysql_fetch_array($sql_char);
- $name = $result_char['name'];
- $level = $result_char['level'];
- if ($result_char['race'] == 1 || $result_char['race'] == 3 || $result_char['race'] == 4 || $result_char['race'] == 7 || $result_char['race'] == 11){
- $side = 'Альянс';
- $style_side = 'blue';
- }
- else{
- $side = 'Орда';
- $style_side = 'red';
- }
- switch ($result_char['race']){
- case 1: $race = 'Человек';break;
- case 2: $result_char['gender'] == 0 ? $race = 'Орк' : $race = 'Орчиха';break;
- case 3: $race = 'Дворф';break;
- case 4: $result_char['gender'] == 0 ? $race = 'Ночной эльф' : $race = 'Ночная эльфийка';break;
- case 5: $result_char['gender'] == 0 ? $race = 'Отрекшийся' : $race = 'Отрекшаяся';break;
- case 6: $race = 'Таурен';break;
- case 7: $race = 'Гном';break;
- case 8: $result_char['gender'] == 0 ? $race = 'Тролль' : $race = 'Троллиха';break;
- case 10: $result_char['gender'] == 0 ? $race = 'Эльф крови' : $race = 'Эльфийка крови';break;
- case 11: $result_char['gender'] == 0 ? $race = 'Дреней' : $race = 'Дренейка';break;
- }
- if ($result_char['class'] == 1){
- $class = 'Воин';
- $style_class = '#C79C6E';
- }
- if ($result_char['class'] == 2){
- $class = 'Паладин';
- $style_class = '#F58CBA';
- }
- if ($result_char['class'] == 3){
- $class = 'Охотник';
- $style_class = '#ABD473';
- }
- if ($result_char['class'] == 4){
- $class = 'Разбойник';
- $style_class = '#FFF569';
- }
- if ($result_char['class'] == 5){
- $class = 'Жрец';
- $style_class = '#FFFFFF';
- }
- if ($result_char['class'] == 6){
- $class = 'Рыцарь смерти';
- $style_class = '#C41F3B';
- }
- if ($result_char['class'] == 7){
- $class = 'Шаман';
- $style_class = '#0070DE';
- }
- if ($result_char['class'] == 8){
- $class = 'Маг';
- $style_class = '#69CCF0';
- }
- if ($result_char['class'] == 9){
- $class = 'Чернокнижник';
- $style_class = '#9482C9';
- }
- if ($result_char['class'] == 11){
- $class = 'Друид';
- $style_class = '#FF7D0A';
- }
- print "<table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"800\" id=\"border\"><tr>
- <td align=\"center\" width=\"30\">$id</td>
- <td align=\"center\">$name</td>
- <td align=\"center\" width=\"30\">$level</td>
- <td align=\"center\" width=\"120\">$race</td>
- <td align=\"center\" width=\"120\"><font color=\"$style_class\">$class</font></td>
- <td align=\"center\" width=\"100\"><font color=\"$style_side\">$side</font></td>
- <td align=\"center\" width=\"120\">$result_count</td>
- <td align=\"center\" width=\"120\">$point</td>
- </tr></table>";
- $id++;
- }
- mysql_close($connect);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement