fatal_error('Error: Runway ' . $rwyidentquery . ' is invalid for ' . $icao);
}
//============================================================
// BUFFER AND HEADER INFORMATION
//============================================================
$mime_type = 'image/png';
$extension = '.png';
$s_end_buffer_size = 4096;
// check for GD support
if (!function_exists('ImageCreate')) {
    fatal_error('Error: Server does not support PHP image generation');
}
//============================================================
// GET METEOROLOGICAL INFORMATION
//============================================================
$metar = loadMETAR($icao);
$aptinfo = getAirportInfo($icao);
$metardata = metarParse($metar);
$winddir = $metardata['winddirection'];
$dmg = $aptinfo['DMG'];
//============================================================
// IMAGE CREATION AND PROPERTIES
//============================================================
$image = imagecreatetruecolor($image_width, $image_height);
//imageantialias($image, true);
imagealphablending($image, true);
//============================================================
// COLOR ALLOCATION
//============================================================
$bg_white = ImageColorAllocate($image, 255, 255, 255);
$bg_black = ImageColorAllocate($image, 0, 0, 0);
<?php

include "func_mysqlexec.php";
include "func_weather.php";
$apticao = $_REQUEST["icao"];
$wxmes = $_REQUEST["wx"];
if ($wxmes == "metar") {
    echo loadMETAR($apticao);
} else {
    if ($wxmes == "taf") {
        echo loadTAF($apticao);
    } else {
        if ($wxmes == "name") {
            change_db($sqlconn, $navdatabase);
            $query = "SELECT Name FROM airports WHERE ICAO='" . $apticao . "'";
            $query = mysqlexec($sqlconn, $query);
            $name = @mysql_result($query, 0, "Name");
            if ($name) {
                echo $name;
            } else {
                echo "<b>(not found)</b>";
            }
            change_db($sqlconn, $rfedatabase);
        } else {
            if ($wxmes == "acft") {
                $query = "SELECT name FROM nav_aircrafts WHERE icao='" . $apticao . "' ORDER BY id LIMIT 1";
                $query = mysqlexec($sqlconn, $query);
                $name = @mysql_result($query, 0, "name");
                if ($name) {
                    echo $name;
                } else {