Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $table = $_GET['t'];
- if (!isset($table))
- die('Table not set.');
- if (!isset($_SERVER["HTTP_CF_CONNECTING_IP"]))
- die('Invalid session.');
- $current_ms = round(microtime(true) * 1000.0);
- $expiration_ms = (float)(30 * 86400000); //30 days
- foreach (glob('tables/*.txt') as $file) {
- $file_name = basename($file, '.txt');
- $creation_ms = floatval($file_name);
- if ($current_ms - $creation_ms >= $expiration_ms)
- unlink($file);
- else if ($table == $file_name)
- $lines = file($file);
- }
- if (!isset($lines))
- die('Table not found.');
- $header = json_decode($lines[0], true);
- if (isset($header['required_ip']) && $header['required_ip'] !== $_SERVER["HTTP_CF_CONNECTING_IP"])
- die('Access denied.');
- $entries = json_decode($lines[1], true);
- ?>
- <head>
- <script type="text/javascript" src="deps/jquery-3.2.1.min.js"></script>
- <link rel="stylesheet" type="text/css" href="deps/jquery.dataTables.css?v=229">
- <script type="text/javascript" charset="utf8" src="deps/jquery.dataTables.min.js"></script>
- </head>
- <body>
- <div style="text-align:center;"><img src="https://www.runite.io/_main/img/logo.png"/></div>
- <div class="spinner">
- <div class="bounce1"></div>
- <div class="bounce2"></div>
- <div class="bounce3"></div>
- </div>
- <div class="container hidden">
- <h3><?php echo $header['title']; ?></h3>
- <table id="runite_table" class="display">
- <thead>
- <tr>
- <?php
- foreach ($entries[0] as $key => $value) {
- echo '<th>' . $key . '</th>';
- }
- ?>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach ($entries as $entry) {
- echo '<tr>';
- foreach ($entry as $e) {
- echo '<td>' . $e . '</td>';
- }
- echo '</tr>';
- }
- ?>
- </tbody>
- </table>
- </div>
- <script>
- $(document).ready(function () {
- $('#runite_table').DataTable();
- $('.spinner').addClass('hidden');
- $('.container').removeClass('hidden');
- });
- </script>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement