Hi all again!
Since i have no idea how to implement phpVMS into my site, i was wondering can someone help me with original FsACARS scripts, as they are easiest for me to install on site. It is work by hand in relation with phpVMS which is automated and perfectly assembled, but my lack of knowledge is frustrating me so...here is gmap script, take a look and tell me why it wouldnt show on site...
Code :
<?php
/*
!!!A QUICK NOTE!!!
Some of the database fields may have changed and you will need to alter them to your
database.
Remember to backup your database before you make any changes or you will regret it.
You will need to have a registered Google Map key which you can get for free from
http://www.google.com/apis/maps/.'>http://www.google.com/apis/maps/.
You will need to know your database structure with username and password details.
I have made db connection easy but you can edit it as your coding levels suit. Ideally
You should have a link to the db connection but that is entirely up to you.
Anyway, hope this helps you in working out how to use google maps on your VA.
Cheers
Steph.
*/
/* CHANGE THESE LINES TO YOUR DETAILS */
/* make connection to database */
$hostreal_name = "localhost";
$userreal_name = "***";
$pw = "***";
$dbreal_name = "***";
// Remember, you need to register with Google Map to get a valid registration key.
// This key must be placed where I have put "###UR_KEY_HERE###" located in the <script src=> tag below.
?>
<head>
<!--
Place you google map key in the line below over the "###UR_KEY_HERE###" text
If you do not have a key this will not work. You can obtain a key from http://www.google.com/apis/maps/
-->
<script src="http://maps.google.com/maps?file=api&v=1&key=MAP KEY HERE!!!" type="text/javascript"></script>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body class="content">
<div id="map" style="width: 750px; height: 500px; z-index:1; left: 138px;"> </div>
<script type="text/javascript">
// This is the google map part
// Thes map settings are set to show Australia, so you will
// need to change co ordinates to suit your needs.
//<![CDATA[
//Center map on Alice Springs
var map = new GMap(document.getElementById("map"));
//$GMap->setMapType('G_HYBRID_TYPE');
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
// Alice Springs
// LAT LON
// S2348'08.57 E13353'12.16
map.centerAndZoom(new GPoint(15.532080078125, 44.770059260080004), 11);
map.setMapType(G_SATELLITE_TYPE);
// Palo Alto
// LAT LON
// N3727'40.03 W12206'54.16
//map.centerAndZoom(new GPoint(-122.1419, 37.4419), 4);
// Creates a marker whose info window displays the given number
function createMarker(point, number, $callsign)
{
var marker = new GMarker(point, $callsign);
// Show this markers index in the info window when it is clicked
var html = number;
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
return marker;
};
<?php
$link = mysql_connect("$hostreal_name", "$userreal_name", "$pw") or die("Could not connect: " . mysql_error());
mysql_selectdb("$dbreal_name",$link) or die ("Can't use dbmapserver : " . mysql_error());
$result = mysql_query("SELECT * FROM positions WHERE last_update > DATE_SUB( NOW() , INTERVAL 5 MINUTE )", $link);
if (!$result)
{
echo "no results ";
}
while($row = mysql_fetch_array($result))
{
// This is the data displayed in the google map text box when you click on a pilot name
$info = "Pilot: ".$row['pilot_num'] . "<br>" . "From: " . $row['depAptICAO'] ." To: " . $row['destAptICAO'] . "<br>" . "Online: " . $row['Online'] . "<br>" . "GS: " . $row['gs'] . "<br>" . "ALT: " . $row['alt'] . "<br>" . "ETA: " . $row['timeDestApt'];
echo "var point = new GPoint(" . $row['lon'] . "," . $row['lat'] . ");n";
echo "var marker = createMarker(point, '" . $info . "');n";
echo "map.addOverlay(marker);n";
echo "n";
}
mysql_close($link);
?>
//]]>
</script>
<div id="Layer1" style="position:absolute; width:800px; height:600px; z-index:1; left: 150px; top: 510px;">
<?php
$cont = 1;
/* mysql error */
if (!$result) {
print "Error - Database Connection.";
$cont = 0;
}
if ($cont) {
if (mysql_numrows($result) == 0) {
print "No current flights<br><br><br>";
} else {
print "<table align=left>";
print "<tr>";
print "<td bgcolor=#000080 height=12 align=center><font face=Verdana color=#FFFFFF size=1><b>Pilot</b></font></td>";
print "<td bgcolor=#000080 height=12 align=center><font face=Verdana color=#FFFFFF size=1><b>Flight#</b></font></td>";
print "<td bgcolor=#000080 height=12 align=center><font face=Verdana color=#FFFFFF size=1><b>From/To</b></font></td>";
print "<td bgcolor=#000080 height=12 align=center><font face=Verdana color=#FFFFFF size=1><b>Dist. from Ori.</b></font></td>";
print "<td bgcolor=#000080 height=12 align=center><font face=Verdana color=#FFFFFF size=1><b>Dist. to Dest.</b></font></td>";
print "<td bgcolor=#000080 height=12 align=center><font face=Verdana color=#FFFFFF size=1><b>Alt</b></font></td>";
print "<td bgcolor=#000080 height=12 align=center><font face=Verdana color=#FFFFFF size=1><b>GS</b></font></td>";
print "<td bgcolor=#000080 height=12 align=center><font face=Verdana color=#FFFFFF size=1><b>ETE</b></font></td>";
print "<td bgcolor=#000080 height=12 align=center><font face=Verdana color=#FFFFFF size=1><b>STATUS</b></font></td>";
print "<td bgcolor=#000080 height=12 align=center><font face=Verdana color=#FFFFFF size=1><b>Online</b></font></td>";
print "</tr>";
$phase_colors = array();
$phase_colors[0] = "color=#FFFFFF"; // Disconnected from ACARS - White
$phase_colors[1] = "color=#CCCCCC"; // Boarding - Gray
$phase_colors[2] = "color=#FF00FF"; // Taxi From Gate - Purple
$phase_colors[3] = "color=#0000FF"; // Departing - Blue
$phase_colors[4] = "color=#00FFFF"; // Climbing - Cyan
$phase_colors[5] = "color=#00FF00"; // Cruising - Green
$phase_colors[6] = "color=#FFFF00"; // Descending - Yellow
$phase_colors[7] = "color=#FF8800"; // Landed - Orange
$phase_colors[8] = "color=#FF0000"; // Taxi To Gate - Red
$phase_colors[9] = "color=#FFFFFF"; // Arrived at Gate - White
$phase_msgs = array();
$phase_msgs[0] = "Disconnected";
$phase_msgs[1] = "Boarding";
$phase_msgs[2] = "Taxi From Gate";
$phase_msgs[3] = "Departing";
$phase_msgs[4] = "Enroute";
$phase_msgs[5] = "Enroute";
$phase_msgs[6] = "Descending";
$phase_msgs[7] = "Landed";
$phase_msgs[8] = "Taxi To Gate";
$phase_msgs[9] = "Arrived At Gate";
$number = mysql_numrows($result);
for ($i=0; $i < $number; $i++) {
$pnum = mysql_result($result,$i,"pilot_num");
$alt = mysql_result($result,$i,"alt");
$gs = mysql_result($result,$i,"gs");
$callsign = mysql_result($result,$i,"IATA");
$dep = mysql_result($result,$i,"depAptICAO");
$depreal_name = mysql_result($result,$i,"depapt");
$dest = mysql_result($result,$i,"destAptICAO");
$destreal_name = mysql_result($result,$i,"destapt");
$distOrig = mysql_result($result,$i,"disDepApt");
$distDest = mysql_result($result,$i,"disDestApt");
$ETA = mysql_result($result,$i,"timeDestApt");
$phase = mysql_result($result,$i,"phase");
$Online = mysql_result($result,$i,"online");
print "<tr>";
print "<td width=30 height=12 align=center><font face=Verdana color=#000080 size=1>ACV$pnum</font></td>";
print "<td width=60 height=12 align=center><font face=Verdana color=#000080 size=1>$callsign</font></td>";
print "<td width=100 height=12 align=center><font face=Verdana color=#000080 size=1>$dep TO $dest</font></td>";
print "<td width=60 height=12 align=center><font face=Verdana color=#000080 size=1>$distOrig</font></td>";
print "<td width=60 height=12 align=center><font face=Verdana color=#000080 size=1>$distDest</font></td>";
print "<td width=60 height=12 align=center><font face=Verdana color=#000080 size=1>$alt</font></td>";
print "<td width=30 height=12 align=center><font face=Verdana color=#000080 size=1>$gs</font></td>";
print "<td width=60 height=12 align=center><font face=Verdana color=#000080 size=1>$ETA</font></td>";
print "<td bgcolor=#000000 width=150 height=12 align=center><font face=Verdana ".$phase_colors[$phase]." size=1><b>".$phase_msgs[$phase]."</b></font></td>";
print "</tr>";
}
}
}
?>
</div>
</body>