Advertisement
Guest User

kills

a guest
Sep 11th, 2013
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.99 KB | None | 0 0
  1. <style>
  2. body {
  3.     margin: 0;
  4.     background:#ddd;
  5. }
  6. h2 {
  7.     margin:5px;
  8. }
  9. table {
  10.     border-collapse:collapse;
  11.     background:#333;
  12.     color:#BBB;
  13. }
  14. th {
  15.     border-left:1px solid #000;
  16.     border-right:1px solid #000;
  17.     border-bottom:1px solid #000;
  18.     color:#fe5;
  19. }
  20. #border {
  21.     border-left:1px solid #000;
  22.     border-right:1px solid #000;
  23.     border-bottom:1px solid #000;
  24. }
  25. #border td {
  26.     border-left:1px solid #000;
  27.     border-right:1px solid #000;   
  28. }
  29. </style>
  30. <?php
  31. $host = 'localhost';
  32. $user = 'root';
  33. $pass = '';
  34. $cdb = 'characters';
  35.  
  36. $connect = mysql_connect($host,$user,$pass) or die('Нет подключения к базе данных');
  37. mysql_select_db ($cdb, $connect) or die(mysql_error());
  38. $sql = mysql_query("SET NAMES cp1251");
  39. $sql = mysql_query("SELECT * FROM `characters` ORDER BY `totalKills` DESC LIMIT 100", $connect) or die(mysql_error());
  40. print "<h2 align=\"center\">Топ убийц</h2>
  41. <table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"800\"><tr>
  42. <th width=\"30\">№</th>
  43. <th>Имя</th>
  44. <th width=\"30\">Лвл</th>
  45. <th width=\"120\">Раса</th>
  46. <th width=\"120\">Класс</th>
  47. <th width=\"100\">Сторона</th>
  48. <th width=\"100\">Убийств сегодня</th>
  49. <th width=\"100\">Убийств всего</th>
  50. </tr></table>";
  51. $id = 1;
  52. while ($result = mysql_fetch_array($sql)){
  53.     $name = $result['name'];
  54.     $level = $result['level'];
  55.     $kills_today = $result['todayKills'];
  56.     $kills = $result['totalKills'];
  57.    
  58.     if ($result['race'] == 1 || $result['race'] == 3 || $result['race'] == 4 || $result['race'] == 7 || $result['race'] == 11){
  59.         $side = 'Альянс';
  60.         $style_side = 'blue';
  61.     }
  62.     else{
  63.         $side = 'Орда';
  64.         $style_side = 'red';
  65.     }
  66.    
  67.     switch ($result['race']){
  68.         case 1: $race = 'Человек';break;    
  69.         case 2: $result['gender'] == 0 ? $race = 'Орк' : $race = 'Орчиха';break;          
  70.         case 3: $race = 'Дворф';break;
  71.         case 4: $result['gender'] == 0 ? $race = 'Ночной эльф' : $race = 'Ночная эльфийка';break;
  72.         case 5: $result['gender'] == 0 ? $race = 'Отрекшийся' : $race = 'Отрекшаяся';break;
  73.         case 6: $race = 'Таурен';break;
  74.         case 7: $race = 'Гном';break;
  75.         case 8: $result['gender'] == 0 ? $race = 'Тролль' : $race = 'Троллиха';break;
  76.         case 10: $result['gender'] == 0 ? $race = 'Эльф крови' : $race = 'Эльфийка крови';break;
  77.         case 11: $result['gender'] == 0 ? $race = 'Дреней' : $race = 'Дренейка';break;
  78.     }
  79.        
  80.     if ($result['class'] == 1){
  81.         $class = 'Воин';
  82.         $style_class = '#C79C6E';
  83.     }
  84.     if ($result['class'] == 2){
  85.         $class = 'Паладин';
  86.         $style_class = '#F58CBA';
  87.     }
  88.     if ($result['class'] == 3){
  89.         $class = 'Охотник';
  90.         $style_class = '#ABD473';
  91.     }
  92.     if ($result['class'] == 4){
  93.         $class = 'Разбойник';
  94.         $style_class = '#FFF569';
  95.     }
  96.     if ($result['class'] == 5){
  97.         $class = 'Жрец';
  98.         $style_class = '#FFFFFF';
  99.     }
  100.     if ($result['class'] == 6){
  101.         $class = 'Рыцарь смерти';
  102.         $style_class = '#C41F3B';
  103.     }
  104.     if ($result['class'] == 7){
  105.         $class = 'Шаман';
  106.         $style_class = '#0070DE';
  107.     }
  108.     if ($result['class'] == 8){
  109.         $class = 'Маг';
  110.         $style_class = '#69CCF0';
  111.     }
  112.     if ($result['class'] == 9){
  113.         $class = 'Чернокнижник';
  114.         $style_class = '#9482C9';
  115.     }
  116.     if ($result['class'] == 11){
  117.         $class = 'Друид';
  118.         $style_class = '#FF7D0A';
  119.     }
  120.        
  121.     print "<table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"800\" id=\"border\"><tr>
  122.     <td align=\"center\" width=\"30\">$id</td>
  123.     <td align=\"center\">$name</td>
  124.     <td align=\"center\" width=\"30\">$level</td>
  125.     <td align=\"center\" width=\"120\">$race</td>
  126.     <td align=\"center\" width=\"120\"><font color=\"$style_class\">$class</font></td>
  127.     <td align=\"center\" width=\"100\"><font color=\"$style_side\">$side</font></td>
  128.     <td align=\"center\" width=\"100\">$kills_today</td>
  129.     <td align=\"center\" width=\"100\">$kills</td>
  130.     </tr></table>";
  131. $id++;
  132. }
  133. mysql_close($connect);
  134. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement