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">
- <link href='https://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet' 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;
- }
- img{
- transition: 1s;
- border-radius: 5px;
- }
- img:hover{
- transform: scale(3);
- position: absolute;
- border: .5px solid grey;
- border-radius: 0px;
- }
- tr:hover{
- font-weight: bold;
- font-size: 15px;
- }
- </style>
- </head>
- <body>
- <?php
- $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>Banned On</th>
- </tr>';
- while($row = $result->fetch_assoc()){
- $timz = $row['banDuration'];
- $time = convertToHumanReadableTime($row['banDuration']);
- $proof = '<img src="'.$row['spy'].'" style= width:64px;height:64px;/>';
- if ($timz == null){
- $time = "Permanent";
- }
- if ($timz == "0"){
- $time = "Permanent";
- }
- if ($timz > "999999"){
- $time = "Permanent";
- }
- echo '<tr>
- <td><a href="http://steamcommunity.com/profiles/'.$row['steamId'].'">'.$row['charactername'].'</a></td>
- <td>'.$row['banMessage'].'</td>
- <td>'.$time.'</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