Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require('config.php');
- function convert_steamid_community($steamid)
- {
- $id1 = substr(str_ireplace("STEAM_0:","",$steamid),2)*2;
- $id2 = substr(str_ireplace("STEAM_0:","",$steamid),0,1);
- $id = bcadd($id1 + $id2, '76561197960265728');
- return($id);
- }
- $conn = new mysqli($host, $user, $pass, $dbname);
- mysqli_query($conn, "SET NAMES 'utf8'");
- if ($conn->connect_error)
- die("Connection failed: " . $conn->connect_error);
- $sorting = isset($_GET['sort']) ? intval($_GET['sort']) : 33;
- $limit = isset($_GET['p']) ? intval($_GET['p']) : 0;
- $where = isset($_GET['q']) ? "WHERE name LIKE '%" . filter_var($_GET['q'], FILTER_SANITIZE_MAGIC_QUOTES) . "%'" : "";
- $sortd="ASC";
- if($sorting > 10)
- {
- $sorting/=11;
- $sortd="DESC";
- }
- switch($sorting)
- {
- case 1:
- $sortr="name";
- break;
- case 2:
- $sortr="steamid";
- break;
- case 3:
- $sortr="time_played";
- break;
- default:
- $sortr="time_played";
- break;
- }
- $query = "SELECT * FROM $table $where ORDER BY $sortr $sortd LIMIT " . $limit * $users_per_page . ", $users_per_page";
- //echo "<!-- ". $query . "-->";
- $result = mysqli_query($conn, $query);
- ?>
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf8" />
- <title>Player Time Tracker</title>
- <link href="style.css" rel="stylesheet" type="text/css" />
- </head>
- <body style="overflow-x: hidden;">
- <script>function c(e){document.getElementById('signature_img').src = "http://steamsignature.com/profile/english/"+e+".png";document.getElementById('signature').style.display = 'block';}function d(){document.getElementById('signature').style.display = 'none';}var b={a:function(a){a=a||window.event;document.getElementById("signature").style.left=a.clientX+5+"px";document.getElementById("signature").style.top=a.clientY+5+window.pageYOffset+"px"}};window.onload=function(){document.body.onmousemove=b.a};</script>
- <h1>Player Time Tracker</h1>
- <table border="1">
- <thead>
- <tr>
- <th>
- <a href="?sort=<?php echo $sorting == 1 ? 11 : 1; ?>">
- Name
- </a>
- </th>
- <th>
- <a href="?sort=<?php echo $sorting == 2 ? 22 : 2; ?>">
- Steam ID
- </a>
- </th>
- <th>
- <a href="?sort=<?php echo $sorting == 3 ? 33 : 3; ?>">
- Time Played
- </a>
- </th>
- </tr>
- </thead>
- <tbody><?php
- while($row = $result->fetch_assoc())
- {
- $time = $row['time_played'];
- echo "
- <tr>
- <td>" . htmlentities($row['name']) . "</td>
- <td><a class='commlink' target='_blank' href='http://steamcommunity.com/profiles/" . convert_steamid_community($row['steamid']) . "' onmouseover='c(this.innerHTML)' onmouseout='d()'>" . convert_steamid_community($row['steamid']) . "</a></td>
- <td>" . sprintf("%02d:%02d:%02d", floor($time / 3600), floor($time % 3600 / 60), $time % 3600 % 60) . "</td>
- </tr>";
- }
- mysql_close();
- ?>
- <tr class="btnz">
- <td style="text-align: center;">
- <form>
- <input type="text" name="q" class="q" style="width: 67%;">
- <input type="submit" class="qbtn" value="Search" style="width: 30%;">
- </form>
- </td>
- <td colspan="2">
- <span style="float: right">
- <a href="?p=<?php echo intval($_GET['p'])+1;?>">
- Next Page
- </a>
- </span>
- <span style="float: left">
- <a href="?p=<?php echo intval($_GET['p'])-1;?>">
- Previous Page
- </a>
- </span>
- </td>
- </tr>
- </tbody>
- </table>
- <div class="copy">
- <strong>
- Copyright © 2015
- </strong>
- <a href="http://namazso.eu">
- namazso
- </a>
- <strong>
- Design by
- </strong>
- <a href="http://djdavid98.eu">
- DJDavid98
- </a>
- </div>
- <div id="signature" style="display: none; position: absolute;"><img id="signature_img"></img></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement