$VAName="DAL";                        //* Enter your three letter VA
name
$downloadstatustime=86400;               //* Enter in seconds (for
status.txt file)
$downloadsatnetdatatime=120;            //* Enter in seconds (for
satnet-data.txt file)

$statusURL="http://usa-s1.vatsim.net/data/status.txt";;      //*change
the URL incase it changes in the future
$statusfilename="status.txt";
$satnetfilename="satnet-data.txt";

echo "<div align='center'>";

$smoditime = filemtime($statusfilename);
$scurrenttime = time();
$sdiftime = $scurrenttime - $smoditime;

if($sdiftime > $downloadstatustime)
   {
      if (!copy($statusURL, $statusfilename))
         {
            echo "Data Chaching Failed... Try A Different Server";
         }
   }

srand((double)microtime()*1000000);

$lines = file($statusfilename);
$datalinks=array();
$i=0;
$l_count = count($lines);
for($x = 0; $x< $l_count; $x++)
   {
       if(substr($lines[$x], 0, 4)=='url0')
         {
            $datalinks[]=substr($lines[$x],5,strlen($lines[$x])-6);
            $i=$i+1;
          }
    }

$moditime = filemtime($satnetfilename);
$currenttime = time();
$diftime = $currenttime - $moditime;

$randomdata=$datalinks[rand(0,2)];

if($diftime > $downloadsatnetdatatime)
   {
      if (!copy(rtrim($randomdata), $satnetfilename))
         {
            echo "Data Chaching Failed... Try A Different Server";
         }
   }

$num = 0;
$fp = fopen($satnetfilename, "r");
echo "<table width=280 border=1 align=right  RULES=NONE FRAME=BOX
bordercolor=#092A51 class=style2>";
echo "<tr>";
echo "<td colspan=4 bgcolor=#092A51 class=style5>";
echo "EastJet Pilots Online";
echo "</td>";
echo "</tr>";

        while (!feof($fp))
   {
       $line = fgets($fp, 999);
      if(preg_match('/^('.$VAName.')[A-Z0-9]/', $line))
           {
            list($callsign,$cid,$realname,$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,$QNH_iHg,$QNH_Mb) = split
(":", $line);
                        ?>
                        <script type="text/javascript">
                var lat_dept = "<? echo $planned_depairport_lat; ?>";
                var lon_dept = "<? echo $planned_depairport_lon; ?>";
                var lat_dest = "<? echo $planned_destairport_lat; ?>";
                var lon_dest = "<? echo $planned_destairport_lon; ?>";

                var callsign = "<? echo $callsign;?>";
                var realname = "<? echo $realname;?>";
                var latitude = "<? echo $latitude;?>";
                var longitude = "<? echo $longitude;?>";
//              if (latitude =="") {latitude = lat_dept;}
//              if (longitude =="") {longitude = lon_dept;}
                if (lat_dept =="") {lat_dept = latitude;}
                if (lon_dept =="") {lon_dept = longitude;}
                if (lat_dest =="") {lat_dest = latitude;}
                if (lon_dest =="") {lon_dest = longitude;}


                var dept = "<? echo $planned_depairport;?>";
                var ariv = "<? echo $planned_destairport;?>";
                var alt = "<? echo $altitude;?>";
                var route = "<? echo $planned_route;?>";
                var type = "<? echo $planned_aircraft;?>";

</script>
           <?
                     echo "<tr>";
            echo "<td width=61>";
            echo $callsign;
            echo "</td>";
            echo "<td width=100>";
            echo substr($realname,0,strlen($realname)-4);
            echo "</td>";
                        echo "<td width=50>";
                        echo $planned_depairport;
                        echo "</td>";
                        echo "<td width=50>";
                        echo $planned_destairport;
                        echo "</td>";
            echo "</tr>";
               $num = $num+1;
            }
     }

if($num==0)
   {
   }
echo "</table>";
echo "</div>";
?>

                <script src="http://maps.google.com/maps?
file=api&amp;v=2&amp;key=123"type="text/javascript"></script>
                 <script type="text/javascript">
//<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(
        document.getElementById("map"));
        map.addMapType(G_PHYSICAL_MAP);
                map.addControl(new GSmallMapControl());
       // map.enableScrollWheelZoom();
                map.addControl(new GMapTypeControl());
                map.setCenter(
        new GLatLng(38, -100), 3);
        map.setMapType(G_PHYSICAL_MAP);

   var Icon = new GIcon(G_DEFAULT_ICON);
   Icon.image = "/images/airplane.png";
   Icon.iconSize = new GSize(28, 28);
   Icon.iconAnchor = new GPoint(16, 32);

                function createMarker(point, text, title) {
          var marker = new GMarker(point,{title:title,icon:Icon});
                  var polyline = new GPolyline([new GLatLng(lat_dept, 
lon_dept), new
GLatLng(latitude, longitude), new GLatLng(lat_dest, lon_dest)],
"#ff0000", 1);
         map.addOverlay(polyline);
                        polyline.hide();

                  GEvent.addListener(marker, "click", function()
{marker.openInfoWindowHtml(text);if (polyline.isHidden()) {
                        polyline.show();
                        } else {
                        polyline.hide();
                        }
                                ;});
                  return marker;
                  return polyline;
        }
                var info = callsign.fontsize(4) + ' ' + type.fontsize(2) 
+'<br>'+
realname.fontsize(1) + '<br>'+' ALT ' + alt + 'ft<br>' + dept.bold() +
' to ' + ariv.bold() + '<br>' + route.fontsize(1);
                if (callsign == "") { info = "Nobody Online at This Time"; 
latitude
= 38;longitude = -100;lat_dest =38;lon_dest =-100;lat_dept
=38;lon_dept =-100;}
                var marker = createMarker(new GLatLng(latitude, longitude),info,
callsign);
                map.addOverlay(marker);
                                }
                                }
    //]]>
   </script>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to