Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. <?php
  2. $table = $_GET['t'];
  3. if (!isset($table))
  4. die('Table not set.');
  5.  
  6. if (!isset($_SERVER["HTTP_CF_CONNECTING_IP"]))
  7. die('Invalid session.');
  8.  
  9. $current_ms = round(microtime(true) * 1000.0);
  10. $expiration_ms = (float)(30 * 86400000); //30 days
  11. foreach (glob('tables/*.txt') as $file) {
  12. $file_name = basename($file, '.txt');
  13. $creation_ms = floatval($file_name);
  14. if ($current_ms - $creation_ms >= $expiration_ms)
  15. unlink($file);
  16. else if ($table == $file_name)
  17. $lines = file($file);
  18. }
  19. if (!isset($lines))
  20. die('Table not found.');
  21. $header = json_decode($lines[0], true);
  22. if (isset($header['required_ip']) && $header['required_ip'] !== $_SERVER["HTTP_CF_CONNECTING_IP"])
  23. die('Access denied.');
  24. $entries = json_decode($lines[1], true);
  25. ?>
  26. <head>
  27. <script type="text/javascript" src="deps/jquery-3.2.1.min.js"></script>
  28. <link rel="stylesheet" type="text/css" href="deps/jquery.dataTables.css?v=229">
  29. <script type="text/javascript" charset="utf8" src="deps/jquery.dataTables.min.js"></script>
  30. </head>
  31. <body>
  32. <div style="text-align:center;"><img src="https://www.runite.io/_main/img/logo.png"/></div>
  33. <div class="spinner">
  34. <div class="bounce1"></div>
  35. <div class="bounce2"></div>
  36. <div class="bounce3"></div>
  37. </div>
  38. <div class="container hidden">
  39. <h3><?php echo $header['title']; ?></h3>
  40. <table id="runite_table" class="display">
  41. <thead>
  42. <tr>
  43. <?php
  44. foreach ($entries[0] as $key => $value) {
  45. echo '<th>' . $key . '</th>';
  46. }
  47. ?>
  48. </tr>
  49. </thead>
  50. <tbody>
  51. <?php
  52. foreach ($entries as $entry) {
  53. echo '<tr>';
  54. foreach ($entry as $e) {
  55. echo '<td>' . $e . '</td>';
  56. }
  57. echo '</tr>';
  58. }
  59. ?>
  60. </tbody>
  61. </table>
  62. </div>
  63. <script>
  64. $(document).ready(function () {
  65. $('#runite_table').DataTable();
  66. $('.spinner').addClass('hidden');
  67. $('.container').removeClass('hidden');
  68. });
  69. </script>
  70. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement