Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 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. <link href='https://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet' type='text/css'>
  21. .body
  22. {
  23. padding: 0;
  24. margin: 0;
  25. }
  26. .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th
  27. {
  28. border-top: 1px solid !important;
  29. }
  30. th {
  31. background-color: #444444;
  32. color: white;
  33. }
  34. img{
  35. transition: 1s;
  36. border-radius: 5px;
  37. }
  38. img:hover{
  39. transform: scale(3);
  40. position: absolute;
  41. border: .5px solid grey;
  42. border-radius: 0px;
  43. }
  44. tr:hover{
  45. font-weight: bold;
  46. font-size: 15px;
  47. }
  48. </style>
  49. </head>
  50. <body>
  51. <?php
  52.  
  53. $db = new mysqli($db_host, $db_user, $db_pass, $db_name);
  54.  
  55. if($db->connect_errno > 0){
  56. die('Unable to connect to database [' . $db->connect_error . ']');
  57. }
  58. $sql = "SELECT * FROM `".$db_tablename."` ORDER BY `banTime` DESC";
  59.  
  60.  
  61. if(!$result = $db->query($sql)){
  62. die('There was an error running the query [' . $db->error . ']');
  63. }
  64.  
  65. function convertToHumanReadableTime($seconds)
  66. {
  67. $ret = "";
  68.  
  69. /*** get the days ***/
  70. $days = intval(intval($seconds) / (3600*24));
  71. if($days> 0)
  72. {
  73. $ret .= "$days days ";
  74. }
  75.  
  76. /*** get the hours ***/
  77. $hours = (intval($seconds) / 3600) % 24;
  78. if($hours > 0)
  79. {
  80. $ret .= "$hours hours ";
  81. }
  82.  
  83. /*** get the minutes ***/
  84. $minutes = (intval($seconds) / 60) % 60;
  85. if($minutes > 0)
  86. {
  87. $ret .= "$minutes minutes ";
  88. }
  89.  
  90. /*** get the seconds ***/
  91. $seconds = intval($seconds) % 60;
  92. if ($seconds > 0) {
  93. $ret .= "$seconds seconds";
  94. }
  95.  
  96. return $ret;
  97. }
  98.  
  99. echo '<table class="table table-striped">
  100. <tr>
  101. <th>Character Name</th>
  102. <th>Ban Reason</th>
  103. <th>Ban Length</th>
  104. <th>Banned On</th>
  105. </tr>';
  106.  
  107. while($row = $result->fetch_assoc()){
  108. $timz = $row['banDuration'];
  109. $time = convertToHumanReadableTime($row['banDuration']);
  110. $proof = '<img src="'.$row['spy'].'" style= width:64px;height:64px;/>';
  111. if ($timz == null){
  112. $time = "Permanent";
  113. }
  114. if ($timz == "0"){
  115. $time = "Permanent";
  116. }
  117. if ($timz > "999999"){
  118. $time = "Permanent";
  119. }
  120. echo '<tr>
  121. <td><a href="http://steamcommunity.com/profiles/'.$row['steamId'].'">'.$row['charactername'].'</a></td>
  122. <td>'.$row['banMessage'].'</td>
  123. <td>'.$time.'</td>
  124. <td>'.date("m/d/Y", strtotime($row['banTime'])).'</td>
  125. </tr>';
  126. }
  127. echo '</table>';
  128. ?>
  129.  
  130. <hr />
  131. </body>
  132. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement