Hey Guys,
I am currently program at a Trackingsystem, but I have a problem. We use in our airline kACARS only. For the Tracker, I have to change the "kACARS_Free.php" Module that, when kACARS send the liveupdate, these data also insert into a second table called "tracker_daten".
Here the Code from liveupdate only. Rest of the code is default:
<?php
case 'liveupdate':
$pilotid = PilotData::parsePilotID($xml->verify->pilotID);
$lat = str_replace(",", ".", $xml->liveupdate->latitude);
$lon = str_replace(",", ".", $xml->liveupdate->longitude);
# Get the distance remaining
$depapt = OperationsData::GetAirportInfo($xml->liveupdate->depICAO);
$arrapt = OperationsData::GetAirportInfo($xml->liveupdate->arrICAO);
$dist_remain = round(SchedulesData::distanceBetweenPoints(
$lat, $lon, $arrapt->lat, $arrapt->lng));
# Estimate the time remaining
if($xml->liveupdate->groundSpeed > 0)
{
$Minutes = round($dist_remain / $xml->liveupdate->groundSpeed * 60);
$time_remain = self::ConvertMinutes2Hours($Minutes);
}
else
{
$time_remain = '00:00';
}
// Start Trackingrecord
$pid = $pilotid;
$flug = $xml->liveupdate->slightNumber;
$acrf = $xml->liveupdate->registration;
// $lat
// $lon
$alt = $xml->liveupdate->altitude;
$gs = $xml->liveupdate->groundSpeed;
$dep = $xml->liveupdate->depICAO;
$arr = $xml->liveupdate->arrICAO;
$rte = $xml->liveupdate->route;
$deptime = $xml->liveupdate->depTime;
$eindeutige_flugnummer = $pid.$flug.$dep.$arr.$deptime;
$md5id = md5($eindeutige_flugnummer);
$sql = "INSERT INTO tracker_daten ('pilot', 'flug', 'acrf', 'lat', 'lon', 'alt', 'gs', 'dep', 'arr', 'rte', 'deptime', 'md5id') VALUES ('$pid', '$flug', '$acrf', '$lat', '$lon', '$alt', '$gs', '$dep', '$arr', $rte', '$deptime', '$md5id')";
$go = mysql_query($sql);
// End Trackingrecord
$fields = array(
'pilotid' =>$pilotid,
'flightnum' =>$xml->liveupdate->flightNumber,
'pilotname' =>'',
'aircraft' =>$xml->liveupdate->registration,
'lat' =>$lat,
'lng' =>$lon,
'heading' =>$xml->liveupdate->heading,
'alt' =>$xml->liveupdate->altitude,
'gs' =>$xml->liveupdate->groundSpeed,
'depicao' =>$xml->liveupdate->depICAO,
'arricao' =>$xml->liveupdate->arrICAO,
'deptime' =>$xml->liveupdate->depTime,
'arrtime' =>'',
'route' =>$xml->liveupdate->route,
'distremain' =>$dist_remain,
'timeremaining' =>$time_remain,
'phasedetail' =>$xml->liveupdate->status,
'online' =>'',
'client' =>'FlyHigh.acars',
);
#$this->log("UpdateFlightData: \n".print_r($fields, true), 'kacars');
ACARSData::UpdateFlightData($pilotid, $fields);
break;
The problem now is: MySQL-Table "tracker_daten" is stil empty, but "acarsdata"-table become new data.
Can you help me?