Advertisement
Guest User

Untitled

a guest
Jan 1st, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. <?php
  2. //configuration
  3. $db_host = ""; //your MySql Host
  4. $db_name = ""; //your MySql Database Name
  5. $db_user = ""; //your MySql username
  6. $db_pass = ""; //your MySql password
  7. $db_tablename = "leaderboard"; //your banlist table name
  8.  
  9. ?>
  10.  
  11. <!DOCTYPE html>
  12. <html lang="en">
  13. <head>
  14. <meta charset="utf-8">
  15. <meta name="viewport" content="width=device-width, initial-scale=1">
  16. <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  17. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
  18. <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  19. <style type="text/css">
  20. .body
  21. {
  22. padding: 0;
  23. margin: 0;
  24. }
  25. .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th
  26. {
  27. border-top: 1px solid !important;
  28. }
  29. th {
  30. background-color: #444444;
  31. color: white;
  32. }
  33. .spyimg{
  34. border: 4px solid grey;
  35. }
  36. .spyimg:hover{
  37. width: 250px;
  38. height 250px;
  39. }
  40. </style>
  41. </head>
  42. <body>
  43. <?php
  44. header('Content-Type: image/jpeg');
  45. $db = new mysqli($db_host, $db_user, $db_pass, $db_name);
  46.  
  47. if($db->connect_errno > 0){
  48. die('Unable to connect to database [' . $db->connect_error . ']');
  49. }
  50. $sql = "SELECT * FROM `".$db_tablename."` ORDER BY `kills` DESC";
  51.  
  52.  
  53. if(!$result = $db->query($sql)){
  54. die('There was an error running the query [' . $db->error . ']');
  55. }
  56.  
  57.  
  58. echo '<table class="table table-striped">
  59. <tr>
  60. <th>Character Name</th>
  61. <th>Ban Reason</th>
  62. <th>Ban Length</th>
  63. <th>Proof</th>
  64. <th>Banned On</th>
  65. </tr>';
  66.  
  67. while($row = $result->fetch_assoc()){
  68. $kilz = $row['kills'];
  69. $dethz = $row['deaths'];
  70. $kd = ($kilz / $dethz);
  71. if ($kilz == 0){
  72. $kd = "N/A";
  73. }
  74. echo '<tr>
  75. <td><a href="http://steamcommunity.com/profiles/'.$row['steamid'].'">'.$row['displayname'].'</a></td>
  76. <td>'.$row['kills'].'</td>
  77. <td>'.$row['deaths'].'</td>
  78. <td>'.$kd.'</td>
  79. </tr>';
  80. }
  81. echo '</table>';
  82. ?>
  83.  
  84. <hr />
  85. </body>
  86. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement