Advertisement
Guest User

Untitled

a guest
Jan 1st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 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 = ""; //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 `banTime` DESC";
  51.  
  52.  
  53. if(!$result = $db->query($sql)){
  54. die('There was an error running the query [' . $db->error . ']');
  55. }
  56.  
  57. function convertToHumanReadableTime($seconds)
  58. {
  59. $ret = "";
  60.  
  61. /*** get the days ***/
  62. $days = intval(intval($seconds) / (3600*24));
  63. if($days> 0)
  64. {
  65. $ret .= "$days days ";
  66. }
  67.  
  68. /*** get the hours ***/
  69. $hours = (intval($seconds) / 3600) % 24;
  70. if($hours > 0)
  71. {
  72. $ret .= "$hours hours ";
  73. }
  74.  
  75. /*** get the minutes ***/
  76. $minutes = (intval($seconds) / 60) % 60;
  77. if($minutes > 0)
  78. {
  79. $ret .= "$minutes minutes ";
  80. }
  81.  
  82. /*** get the seconds ***/
  83. $seconds = intval($seconds) % 60;
  84. if ($seconds > 0) {
  85. $ret .= "$seconds seconds";
  86. }
  87.  
  88. return $ret;
  89. }
  90.  
  91. echo '<table class="table table-striped">
  92. <tr>
  93. <th>Character Name</th>
  94. <th>Ban Reason</th>
  95. <th>Ban Length</th>
  96. <th>Proof</th>
  97. <th>Banned On</th>
  98. </tr>';
  99.  
  100. while($row = $result->fetch_assoc()){
  101. echo '<tr>
  102. <td><a href="http://steamcommunity.com/profiles/'.$row['steamId'].'">'.$row['charactername'].'</a></td>
  103. <td>'.$row['banMessage'].'</td>
  104. <td>'.convertToHumanReadableTime($row['banDuration']).'</td>
  105. <td><img src='.$row['spy'].' style="width:64px; height:64px;"></td>
  106. <td>'.date("m/d/Y", strtotime($row['banTime'])).'</td>
  107. </tr>';
  108. }
  109. echo '</table>';
  110. ?>
  111.  
  112. <hr />
  113. </body>
  114. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement