Advertisement
Guest User

Untitled

a guest
Feb 16th, 2016
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.72 KB | None | 0 0
  1. <?php
  2. require('config.php');
  3.  
  4. function convert_steamid_community($steamid)
  5. {
  6. $id1 = substr(str_ireplace("STEAM_0:","",$steamid),2)*2;
  7. $id2 = substr(str_ireplace("STEAM_0:","",$steamid),0,1);
  8. $id = bcadd($id1 + $id2, '76561197960265728');
  9. return($id);
  10. }
  11.  
  12. $conn = new mysqli($host, $user, $pass, $dbname);
  13. mysqli_query($conn, "SET NAMES 'utf8'");
  14. if ($conn->connect_error)
  15. die("Connection failed: " . $conn->connect_error);
  16.  
  17. $sorting = isset($_GET['sort']) ? intval($_GET['sort']) : 33;
  18. $limit = isset($_GET['p']) ? intval($_GET['p']) : 0;
  19. $where = isset($_GET['q']) ? "WHERE name LIKE '%" . filter_var($_GET['q'], FILTER_SANITIZE_MAGIC_QUOTES) . "%'" : "";
  20.  
  21. $sortd="ASC";
  22. if($sorting > 10)
  23. {
  24. $sorting/=11;
  25. $sortd="DESC";
  26. }
  27. switch($sorting)
  28. {
  29. case 1:
  30. $sortr="name";
  31. break;
  32. case 2:
  33. $sortr="steamid";
  34. break;
  35. case 3:
  36. $sortr="time_played";
  37. break;
  38. default:
  39. $sortr="time_played";
  40. break;
  41. }
  42. $query = "SELECT * FROM $table $where ORDER BY $sortr $sortd LIMIT " . $limit * $users_per_page . ", $users_per_page";
  43. //echo "<!-- ". $query . "-->";
  44. $result = mysqli_query($conn, $query);
  45. ?>
  46. <!DOCTYPE html>
  47. <html xmlns="http://www.w3.org/1999/xhtml">
  48. <head>
  49. <meta http-equiv="Content-Type" content="text/html; charset=utf8" />
  50. <title>Player Time Tracker</title>
  51. <link href="style.css" rel="stylesheet" type="text/css" />
  52. </head>
  53. <body style="overflow-x: hidden;">
  54. <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>
  55. <h1>Player Time Tracker</h1>
  56. <table border="1">
  57. <thead>
  58. <tr>
  59. <th>
  60. <a href="?sort=<?php echo $sorting == 1 ? 11 : 1; ?>">
  61. Name
  62. </a>
  63. </th>
  64. <th>
  65. <a href="?sort=<?php echo $sorting == 2 ? 22 : 2; ?>">
  66. Steam ID
  67. </a>
  68. </th>
  69. <th>
  70. <a href="?sort=<?php echo $sorting == 3 ? 33 : 3; ?>">
  71. Time Played
  72. </a>
  73. </th>
  74. </tr>
  75. </thead>
  76. <tbody><?php
  77. while($row = $result->fetch_assoc())
  78. {
  79. $time = $row['time_played'];
  80. echo "
  81. <tr>
  82. <td>" . htmlentities($row['name']) . "</td>
  83. <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>
  84. <td>" . sprintf("%02d:%02d:%02d", floor($time / 3600), floor($time % 3600 / 60), $time % 3600 % 60) . "</td>
  85. </tr>";
  86. }
  87. mysql_close();
  88. ?>
  89.  
  90. <tr class="btnz">
  91. <td style="text-align: center;">
  92. <form>
  93. <input type="text" name="q" class="q" style="width: 67%;">
  94. <input type="submit" class="qbtn" value="Search" style="width: 30%;">
  95. </form>
  96. </td>
  97. <td colspan="2">
  98. <span style="float: right">
  99. <a href="?p=<?php echo intval($_GET['p'])+1;?>">
  100. Next Page
  101. </a>
  102. </span>
  103. <span style="float: left">
  104. <a href="?p=<?php echo intval($_GET['p'])-1;?>">
  105. Previous Page
  106. </a>
  107. </span>
  108. </td>
  109. </tr>
  110. </tbody>
  111. </table>
  112. <div class="copy">
  113. <strong>
  114. Copyright &copy; 2015
  115. </strong>
  116. <a href="http://namazso.eu">
  117. namazso
  118. </a>
  119. <strong>
  120. Design by
  121. </strong>
  122. <a href="http://djdavid98.eu">
  123. DJDavid98
  124. </a>
  125. </div>
  126. <div id="signature" style="display: none; position: absolute;"><img id="signature_img"></img></div>
  127. </body>
  128. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement