Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Start a session
- if (session_id() == "")
- session_start();
- $config = include(__DIR__ . "/sql_config.php");
- $conn = mysqli_connect($config["sql_host"], $config["sql_username"], $config["sql_password"]);
- ((bool)mysqli_query($conn, "USE " . $config["sql_ch_database"])) or die('Could Not Connect to the Database! ' . mysqli_error());
- $sql = mysqli_query($connect, "SELECT * FROM `characters` WHERE `online` = 1";
- //$result = mysqli_query($conn, $sql);
- print "<h5 align=\"center\">Warsong x300 players online</h5><br><br><br>
- <table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"800\"><tr>
- <th width=\"30\">№</th>
- <th><h5>Имя</h5></th>
- <th width=\"120\"><h5>Уровень </h5></th>
- <th width=\"120\"><h5>Раса</h5></th>
- <th width=\"120\"><h5>Класс</h5></th>
- <th width=\"120\"><h5>Фракция</h5></th>
- <th width=\"250\"><h5></h5><br></th>
- </tr></table>";
- $id=1;
- while ($result = mysqli_fetch_array($sql))
- {
- if ($result['race'] == 1 || $result['race'] == 3 || $result['race'] == 4 || $result['race'] == 7 || $result['race'] == 11)
- {
- $side = '<img src="../images/icons/side-0.png">';
- $style_side = 'blue';
- }
- else
- {
- $side = '<img src="../images/icons/side-1.png">';
- $style_side = 'red';
- }
- switch ($result['race'])
- {
- case 1: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_human_male.gif">' : $race = '<img src="../images/icons/race_human_female.gif">';break;
- case 2: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_orc_female.gif">' : $race = '<img src="../images/icons/race_orc_female.gif">';break;
- case 3: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_dwarf_female.gif">' : $race = '<img src="../images/icons/race_dwarf_female.gif">';break;
- case 4: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_nightelf_female.gif">' : $race = '<img src="../images/icons/race_nightelf_female.gif">';break;
- case 5: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_undead_female.gif">' : $race = '<img src="../images/icons/race_undead_female.gif">';break;
- case 6: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_tauren_female.gif">' : $race = '<img src="../images/icons/race_tauren_female.gif">';break;
- case 7: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_gnome_female.gif">' : $race = '<img src="../images/icons/race_gnome_female.gif">';break;
- case 8: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_troll_female.gif">' : $race = '<img src="../images/icons/race_troll_female.gif">';break;
- case 10: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_bloodelf_male.gif">' : $race = '<img src="../images/icons/race_bloodelf_female.gif">';break;
- case 11: $result['gender'] == 0 ? $race = '<img src="../images/icons/race_draenei_female.gif">' : $race = '<img src="../images/icons/race_draenei_female.gif">';break;
- }
- if ($result['class'] == 1)
- {
- $class = '<img src="../images/icons/class_warrior.gif">';
- $style_class = '#C79C6E';
- }
- if ($result['class'] == 2)
- {
- $class = '<img src="../images/icons/class_paladin.gif">';
- $style_class = '#F58CBA';
- }
- if ($result['class'] == 3)
- {
- $class = '<img src="../images/icons/class_hunter.gif">';
- $style_class = '#ABD473';
- }
- if ($result['class'] == 4)
- {
- $class = '<img src="../images/icons/class_rogue.gif">';
- $style_class = '#FFF569';
- }
- if ($result['class'] == 5)
- {
- $class = '<img src="../images/icons/class_priest.gif">';
- $style_class = '#f2e7e5';
- }
- if ($result['class'] == 6)
- {
- $class = '<img src="../images/icons/class_deathknight.gif">';
- $style_class = '#C41F3B';
- }
- if ($result['class'] == 7)
- {
- $class = '<img src="../images/icons/class_shaman.gif">';
- $style_class = '#0070DE';
- }
- if ($result['class'] == 8)
- {
- $class = '<img src="../images/icons/class_mage.gif">';
- $style_class = '#69CCF0';
- }
- if ($result['class'] == 9)
- {
- $class = '<img src="../images/icons/class_warlock.gif">';
- $style_class = '#9482C9';
- }
- if ($result['class'] == 11)
- {
- $class = '<img src="../images/icons/class_druid.gif">';
- $style_class = '#FF7D0A';
- }
- $name = $result['name'];
- $level = $result['level'];
- if (!isset($zone))
- $zone = 'Twilight\'s Hammer';
- print "<table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"800\" id=\"border\"><tr>
- <td align=\"center\" width=\"30\"><h5>$id</h5></td>
- <td align=\"center\"><h5>$name</h5></td>
- <td align=\"center\" width=\"30\"><h5>$level</h5></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=\"250\"><h5>$zone</h5></td>
- </tr></table>";
- }
- if ($id <= 1)
- print "<br><br><br><br><p align=\"center\"><h5>No players online!</h5></p>";
- // Close the SQL connection
- mysqli_close($conn);
- // Close the session
- session_commit();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement