Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //configuration
- $db_host = ""; //your MySql Host
- $db_name = ""; //your MySql Database Name
- $db_user = ""; //your MySql username
- $db_pass = ""; //your MySql password
- $db_tablename = ""; //your banlist table name
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
- <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
- <style type="text/css">
- .body
- {
- padding: 0;
- margin: 0;
- }
- .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th
- {
- border-top: 1px solid !important;
- }
- th {
- background-color: #444444;
- color: white;
- }
- .spyimg{
- border: 4px solid grey;
- }
- .spyimg:hover{
- width: 250px;
- height 250px;
- }
- </style>
- </head>
- <body>
- <?php
- header('Content-Type: image/jpeg');
- $db = new mysqli($db_host, $db_user, $db_pass, $db_name);
- if($db->connect_errno > 0){
- die('Unable to connect to database [' . $db->connect_error . ']');
- }
- $sql = "SELECT * FROM `".$db_tablename."` ORDER BY `banTime` DESC";
- if(!$result = $db->query($sql)){
- die('There was an error running the query [' . $db->error . ']');
- }
- function convertToHumanReadableTime($seconds)
- {
- $ret = "";
- /*** get the days ***/
- $days = intval(intval($seconds) / (3600*24));
- if($days> 0)
- {
- $ret .= "$days days ";
- }
- /*** get the hours ***/
- $hours = (intval($seconds) / 3600) % 24;
- if($hours > 0)
- {
- $ret .= "$hours hours ";
- }
- /*** get the minutes ***/
- $minutes = (intval($seconds) / 60) % 60;
- if($minutes > 0)
- {
- $ret .= "$minutes minutes ";
- }
- /*** get the seconds ***/
- $seconds = intval($seconds) % 60;
- if ($seconds > 0) {
- $ret .= "$seconds seconds";
- }
- return $ret;
- }
- echo '<table class="table table-striped">
- <tr>
- <th>Character Name</th>
- <th>Ban Reason</th>
- <th>Ban Length</th>
- <th>Proof</th>
- <th>Banned On</th>
- </tr>';
- while($row = $result->fetch_assoc()){
- echo '<tr>
- <td><a href="http://steamcommunity.com/profiles/'.$row['steamId'].'">'.$row['charactername'].'</a></td>
- <td>'.$row['banMessage'].'</td>
- <td>'.convertToHumanReadableTime($row['banDuration']).'</td>
- <td><img src='.$row['spy'].' style="width:64px; height:64px;"></td>
- <td>'.date("m/d/Y", strtotime($row['banTime'])).'</td>
- </tr>';
- }
- echo '</table>';
- ?>
- <hr />
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement