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 = "leaderboard"; //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 `kills` DESC";
- if(!$result = $db->query($sql)){
- die('There was an error running the query [' . $db->error . ']');
- }
- 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()){
- $kilz = $row['kills'];
- $dethz = $row['deaths'];
- $kd = ($kilz / $dethz);
- if ($kilz == 0){
- $kd = "N/A";
- }
- echo '<tr>
- <td><a href="http://steamcommunity.com/profiles/'.$row['steamid'].'">'.$row['displayname'].'</a></td>
- <td>'.$row['kills'].'</td>
- <td>'.$row['deaths'].'</td>
- <td>'.$kd.'</td>
- </tr>';
- }
- echo '</table>';
- ?>
- <hr />
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement