Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "<!--Code by Joseph Donat Bolton 1289478-->";
- $cache_file = 'atctable.cache';
- if (file_exists($cache_file) && (filemtime($cache_file) > (time() - 60 * 2 ))) {
- $tablerows = file_get_contents($cache_file);
- }
- else {
- $atcNAF = simplexml_load_file('http://api.vateud.net/online/atc/GM,GS,GQ,GO,GB,GV,GU,GL,GF,GG,DA,DT,GA,DF,DI,DG,DX,DB,DN,DR,HL,FT,HS,HA,HH,HD,HC,HK,FS.xml');
- foreach ($atcNAF as $controller):
- $xploded = explode('_', $controller->callsign);
- if (strlen($xploded[0]) == 4){
- if (in_array(end($xploded), array('DEL','GND','TWR', 'APP', 'DEP', 'CTR', 'FSS'), true) && $xploded[0] !== 'GULF'){
- $name = $controller->name;
- $frequency = $controller->frequency;
- $callsign = $controller->callsign;
- $row = "<tr> <td>$name</td> <td>$frequency MHz</td> <td>$callsign</td></tr>";
- $tablerows .= $row;
- }
- }
- endforeach;
- file_put_contents($cache_file, $tablerows, LOCK_EX);
- }
- if (!empty($tablerows)) {
- echo " <div class=\"panel margin-bottom-40\">
- <table class=\"table table-hover\">
- <thead>
- <tr>
- <th>Name</th>
- <th>Frequency</th>
- <th>Position</th>
- </tr>
- </thead>
- <tbody>
- $tablerows
- </tbody>
- </table>
- </div>
- ";
- }
- else {
- echo "<div class=\"row\">
- <div class=\"col-md-9 animated fadeInLeft\"><span>No controllers currently online!</span></div></div>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement