Advertisement
Guest User

Untitled

a guest
May 27th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.43 KB | None | 0 0
  1.             <?php
  2.  
  3.                 // Start a session
  4.                 if (session_id() == "")
  5.                     session_start();
  6.    
  7.                 $config = include(__DIR__ . "/sql_config.php");
  8.  
  9.                 $conn = mysqli_connect($config["sql_host"], $config["sql_username"], $config["sql_password"]);
  10.                
  11.                 ((bool)mysqli_query($conn, "USE " . $config["sql_ch_database"])) or die('Could Not Connect to the Database! ' . mysqli_error());
  12.                
  13.                 $sql = mysqli_query($connect, "SELECT * FROM `characters` WHERE `online` = 1";
  14.                
  15.                 //$result = mysqli_query($conn, $sql);
  16.  
  17.                             print "<h5 align=\"center\">Warsong x300 players online</h5><br><br><br>
  18.                            <table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"800\"><tr>
  19.                            <th width=\"30\">№</th>
  20.                            <th><h5>Имя</h5></th>
  21.                            <th width=\"120\"><h5>Уровень </h5></th>
  22.                            <th width=\"120\"><h5>Раса</h5></th>
  23.                            <th width=\"120\"><h5>Класс</h5></th>
  24.                            <th width=\"120\"><h5>Фракция</h5></th>
  25.                            <th width=\"250\"><h5></h5><br></th>
  26.                            </tr></table>";
  27.                            
  28.                             $id=1;
  29.                             while ($result = mysqli_fetch_array($sql))
  30.                             {
  31.                                 if ($result['race'] == 1 || $result['race'] == 3 || $result['race'] == 4 || $result['race'] == 7 || $result['race'] == 11)
  32.                                 {
  33.                                     $side = '<img src="../images/icons/side-0.png">';
  34.                                     $style_side = 'blue';
  35.                                 }
  36.                                 else
  37.                                 {
  38.                                     $side = '<img src="../images/icons/side-1.png">';
  39.                                     $style_side = 'red';
  40.                                 }
  41.  
  42.                                 switch ($result['race'])
  43.                                 {
  44.                                     case 1: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_human_male.gif">' : $race = '<img src="../images/icons/race_human_female.gif">';break;
  45.                                     case 2: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_orc_female.gif">' : $race = '<img src="../images/icons/race_orc_female.gif">';break;
  46.                                     case 3: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_dwarf_female.gif">' : $race = '<img src="../images/icons/race_dwarf_female.gif">';break;
  47.                                     case 4: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_nightelf_female.gif">' : $race = '<img src="../images/icons/race_nightelf_female.gif">';break;
  48.                                     case 5: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_undead_female.gif">' : $race = '<img src="../images/icons/race_undead_female.gif">';break;
  49.                                     case 6: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_tauren_female.gif">' : $race = '<img src="../images/icons/race_tauren_female.gif">';break;
  50.                                     case 7: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_gnome_female.gif">' : $race = '<img src="../images/icons/race_gnome_female.gif">';break;
  51.                                     case 8: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_troll_female.gif">' : $race = '<img src="../images/icons/race_troll_female.gif">';break;
  52.                                     case 10: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_bloodelf_male.gif">' : $race = '<img src="../images/icons/race_bloodelf_female.gif">';break;
  53.                                     case 11: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_draenei_female.gif">' : $race = '<img src="../images/icons/race_draenei_female.gif">';break;
  54.                                 }
  55.  
  56.                                 if ($result['class'] == 1)
  57.                                 {
  58.                                     $class = '<img src="../images/icons/class_warrior.gif">';
  59.                                     $style_class = '#C79C6E';
  60.                                 }
  61.                                 if ($result['class'] == 2)
  62.                                 {
  63.                                     $class = '<img src="../images/icons/class_paladin.gif">';
  64.                                     $style_class = '#F58CBA';
  65.                                 }
  66.                                 if ($result['class'] == 3)
  67.                                 {
  68.                                     $class = '<img src="../images/icons/class_hunter.gif">';
  69.                                     $style_class = '#ABD473';
  70.                                 }
  71.                                 if ($result['class'] == 4)
  72.                                 {
  73.                                     $class = '<img src="../images/icons/class_rogue.gif">';
  74.                                     $style_class = '#FFF569';
  75.                                 }
  76.                                 if ($result['class'] == 5)
  77.                                 {
  78.                                     $class = '<img src="../images/icons/class_priest.gif">';
  79.                                     $style_class = '#f2e7e5';
  80.                                 }
  81.                                 if ($result['class'] == 6)
  82.                                 {
  83.                                     $class = '<img src="../images/icons/class_deathknight.gif">';
  84.                                     $style_class = '#C41F3B';
  85.                                 }
  86.                                 if ($result['class'] == 7)
  87.                                 {
  88.                                     $class = '<img src="../images/icons/class_shaman.gif">';
  89.                                     $style_class = '#0070DE';
  90.                                 }
  91.                                 if ($result['class'] == 8)
  92.                                 {
  93.                                     $class = '<img src="../images/icons/class_mage.gif">';
  94.                                     $style_class = '#69CCF0';
  95.                                 }
  96.                                 if ($result['class'] == 9)
  97.                                 {
  98.                                     $class = '<img src="../images/icons/class_warlock.gif">';
  99.                                     $style_class = '#9482C9';
  100.                                 }
  101.                                 if ($result['class'] == 11)
  102.                                 {
  103.                                     $class = '<img src="../images/icons/class_druid.gif">';
  104.                                     $style_class = '#FF7D0A';
  105.                                 }
  106.  
  107.  
  108.                                 $name = $result['name'];
  109.                                 $level = $result['level'];
  110.  
  111.                                 if (!isset($zone))
  112.                                 $zone = 'Twilight\'s Hammer';
  113.  
  114.                                 print "<table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"800\" id=\"border\"><tr>
  115.                                <td align=\"center\" width=\"30\"><h5>$id</h5></td>
  116.                                <td align=\"center\"><h5>$name</h5></td>
  117.                                <td align=\"center\" width=\"30\"><h5>$level</h5></td>
  118.                                <td align=\"center\" width=\"120\">$race</td>
  119.                                <td align=\"center\" width=\"120\"><font color=\"$style_class\">$class</font></td>
  120.                                <td align=\"center\" width=\"100\"><font color=\"$style_side\">$side</font></td>
  121.                                <td align=\"center\" width=\"250\"><h5>$zone</h5></td>
  122.                                </tr></table>";
  123.                             }
  124.                             if ($id <= 1)
  125.                                 print "<br><br><br><br><p align=\"center\"><h5>No players online!</h5></p>";
  126.                 // Close the SQL connection
  127.                 mysqli_close($conn);
  128.  
  129.                 // Close the session
  130.                 session_commit();
  131.             ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement