Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo '<table width="100%"';
- // error handler function
- function myErrorHandler($errno, $errstr, $errfile, $errline)
- {
- switch ($errno) {
- case E_USER_ERROR:
- echo '<b>My ERROR</b> [$errno] $errstr<br />n';
- echo ' Fatal error on line $errline in file $errfile';
- echo ', PHP ' . PHP_VERSION . ' (' . PHP_OS . ')<br />n';
- echo 'Aborting...<br />n';
- exit(1);
- break;
- case E_USER_WARNING:
- echo '<b>My WARNING</b> [$errno] $errstr<br />n';
- break;
- case E_USER_NOTICE:
- echo '<b>My NOTICE</b> [$errno] $errstr<br />n';
- break;
- default:
- //echo "Unknown error type: [$errno] $errstr $errline in
- $errfile;
- break;
- }
- /* Don't execute PHP internal error handler */
- return true;
- }
- // set to the user defined error handler
- $old_error_handler = set_error_handler("myErrorHandler");
- //OPEN UP THE VATSIM STATS FILE
- $row_count = 0;
- $color1 = "#F5F5F5";
- $color2 = "#FFFFFF";
- if(file_exists("C:\\nesto\\xampp\htdocs\scgvacc\status\data\status.txt")){
- $fp = fopen("C:\\nesto\\xampp\htdocs\scgvacc\status\data\status.txt", "r");
- while (!feof($fp))
- {
- $line = fgets($fp, 999);
- //Put the Callsign Prefixes in : e.g. if callsign = VTBB_CTR enter VTBB or
- if(preg_match('/^(LYBA|LYBE|LYPG|LYNI|LYTV|)_[A-Z0-9]*_*(TWR|APP|CTR)/',
- $line))
- {
- list($position, $cid, $name, $clienttype, $frequency,
- $latitude, $longitude, $altitude, $groundspeed, $planned_aircraft,
- $planned_tascruise, $planned_depairport, $planned_altitude,
- $planned_destairport, $server, $protrevision, $rating, $transponder,
- $facilitytype, $visualrange, $planned_revision, $planned_flighttype,
- $planned_deptime, $planned_actdeptime, $planned_hrsenroute,
- $planned_minenroute, $planned_hrsfuel, $planned_minfuel,
- $planned_altairport, $planned_remarks, $planned_route,
- $planned_depairport_lat, $planned_depairport_lon,
- $planned_destairport_lat,
- $planned_destairport_lon, $atis_message, $time_last_atis_received,
- $time_logon, $heading) = split(":", $line);
- if($rating == 1) { $rating = "Observer"; }
- if($rating == 2) { $rating = "Ground Controller"; }
- if($rating == 3) { $rating = "Tower Controller"; }
- if($rating == 4) { $rating = "Approach Controller"; }
- if($rating == 5) { $rating = "Controller"; }
- if($rating == 7) { $rating = "Senior Controller"; }
- if($rating == 8) { $rating = "Instructor"; }
- if($rating == 10) { $rating = "Senior Instructor"; }
- if($rating == 11) { $rating = "Supervisor"; }
- if($rating == 12) { $rating = "Administrator"; }
- $rowcolor = ($row_count % 2) ? $color1 : $color2;
- $newatis = str_replace('^§', '<br>', $atis_message);
- $newatis = str_replace("'", "", $newatis);
- $newatis = str_replace('"', "", $newatis);
- /* this is where the table and checking should go */
- $row_count++;
- }
- }
- echo '</table>';
- echo '<table width="200" align="center" cellpadding="2" cellspacing="0">';
- if($row_count == 0)
- {
- echo '<tr><td align="center"><br>There are no controllers
- online.</td></tr>';
- }
- else if($row_count == 1)
- {
- //MODIFY NEXT LINE WITH CORRECT ICAO FOR YOUR ARTCC/FIR
- echo '<tr><td align="center"><br><font size="1">Currently 1 SCGvACC
- Controller Online</font></td></tr>';
- }
- else
- {
- //MODIFY NEXT LINE WITH CORRECT ICAO FOR YOUR ARTCC/FIR
- echo '<tr><td align="center"><br><font size="1">Currently ';
- echo $row_count;
- echo " SCGvACC Controllers Online</font></td></tr>";
- }
- }
- echo '</table>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement