Jump to content

Recommended Posts

Posted

need help with code to put up stats from a whazzup.txt file.

I have this info...and am not sure what to do with it....

<?

$whazzuptxt = "whazzup.txt";

//get file
 $file = file_get_contents('whazzup.txt');
//get clients
 preg_match('/!CLIENTS(.*?)!SERVERS/ms', $file, $results);
 $content = trim($results[1]);
 //get out \r\n so on
 $lines = preg_split('/(\015\012)|(\015)|(\012)/', $content);

 //filter for pilot and atc clients

 function filter ($value)
 {
   if (strpos($value, 'PILOT') !== false){
	return true;
}elseif(strpos($value, 'ATC') !== false){
	return true;
}else{
   return false;
}
 }
 $lines = array_filter($lines, 'filter');

 $br = "<br>";

 /get each line and decode line and give out line

  foreach ($lines as $index => $line)
  {
  list($callsign, $vid, $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_connected, $client_software_name, $client_software_version, $adminrating, $atc_or_pilotrating, $planned_altairport2, $planned_typeofflight, $planned_pob,$plane_hdg,$plane_onground) = explode(':', $line, 47);

echo "callsign: ".$callsign.$br;
echo "vid: ".$vid.$br;
echo "realname: ".$realname.$br;
echo "clienttype: ".$clienttype.$br;
echo "frequency: ".$frequency.$br;
echo "latitude: ".$latitude.$br;
echo "longitude: ".$longitude.$br;
echo "altitude: ".$altitude.$br;
echo "groundspeed: ".$groundspeed.$br;
echo "planned_aircraft: ".$planned_aircraft.$br;
echo "planned_tascruise: ".$planned_tascruise.$br;
echo "planned_depairport: ".$planned_depairport.$br;
echo "planned_altitude: ".$planned_altitude.$br;
echo "planned_destairport: ".$planned_destairport.$br;
echo "server: ".$server.$br;
echo "protrevision: ".$protrevision.$br;
echo "rating: ".$rating.$br;
echo "transponder: ".$transponder.$br;
echo "facilitytype: ".$facilitytype.$br;
echo "visualrange: ".$visualrange.$br;
echo "planned_revision: ".$planned_revision.$br;
echo "planned_flighttype: ".$planned_flighttype.$br;
echo "planned_deptime: ".$planned_deptime.$br;
echo "planned_actdeptime: ".$planned_actdeptime.$br;
echo "planned_hrsenroute: ".$planned_hrsenroute.$br;
echo "planned_minenroute: ".$planned_minenroute.$br;
echo "planned_hrsfuel: ".$planned_hrsfuel.$br;
echo "planned_minfuel: ".$planned_minfuel.$br;
echo "planned_altairport: ".$planned_altairport.$br;
echo "planned_remarks: ".$planned_remarks.$br;
echo "planned_route: ".$planned_route.$br;
echo "planned_depairport_lat: ".$planned_depairport_lat.$br;
echo "planned_depairport_lon: ".$planned_depairport_lon.$br;
echo "planned_destairport_lat: ".$planned_destairport_lat.$br;
echo "planned_destairport_lon: ".$planned_destairport_lon.$br;
echo "atis_message: ".$atis_message.$br;
echo "time_last_atis_received: ".$time_last_atis_received.$br;
echo "time_connected: ".$time_connected.$br;
echo "client_software_name: ".$client_software_name.$br;
echo "client_software_version: ".$client_software_version.$br;
echo "adminrating: ".$adminrating.$br;
echo "atc_or_pilotrating: ".$atc_or_pilotrating.$br;
echo "planned_altairport2: ".$planned_altairport2.$br;
echo "planned_typeofflight: ".$planned_typeofflight.$br;
echo "planned_pob: ".$planned_pob.$br;
echo "plane_hdg: ".$plane_hdg.$br;
echo "plane_onground: ".$plane_onground.$br;
echo "<br><br>";


}



?>


Do I make this a class ? or a module ? and then call it from a template ?

I am a bit lost.

Posted

it is indeed, are you familiar with it ?

Yes we use it on our server - http://www.flyakasky.com - We will be inviting other VAs that fly in the Alaska/ Canada area to join. It took us awhile to figure everything out. We don't use the code you mentioned, we have a custom made script.

Ypu can look on their website and search their forums.

Posted

Yes we use it on our server - http://www.flyakasky.com - We will be inviting other VAs that fly in the Alaska/ Canada area to join. It took us awhile to figure everything out. We don't use the code you mentioned, we have a custom made script.

Ypu can look on their website and search their forums.

Thanks, I found their script and it doesn't really do what I want it to. The download on the forum for the code doesn't work. We have our up and running (finally found some sct files). Just need to put some status stuff on the site. Would be interested in linking the two when we are both ready :)

Posted

Well, its up and running and live in its infant stages....(in terms of site coding)

Still lots to learn, I cant figure out how to grab the info from whazzup and turn it into an array for the class file....

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...