<?
$debug 
$_REQUEST["debug"];
$call $_REQUEST["call"];

$call strtoupper($call);


require 
$_SERVER["DOCUMENT_ROOT"] . "/datamart/icon.php";
require 
$_SERVER["DOCUMENT_ROOT"] . "/world_config.php";

$db _open_mysql("aprs");

$sql sprintf("SELECT symbol_table,symbol_code,latitude,longitude FROM lastposition WHERE source='%s' LIMIT 1",$call);

$query mysql_query($sql,$db);

$record mysql_fetch_array($query);

if ( 
$debug ) {
    
printf("<PRE>\n");
    
printf("MySQL error: %s\n",htmlspecialchars(mysql_error($db)));
    
printf("SQL: %s\n\n",htmlspecialchars($sql));
    
printf("symbol table=%s symbol code=%s\n",$record["symbol_table"],$record["symbol_code"]);
    
printf("latitude=%s longitude=%s label=%s\n",$record["latitude"],$record["longitude"],$call);
    
printf("</PRE>\n");
    die(
"Done");
}

$_REQUEST["icon"] = get_icon_name($record["symbol_table"],$record["symbol_code"]);
$_REQUEST["lat"] = $record["latitude"];
$_REQUEST["lon"] = $record["longitude"];
$_REQUEST["label"] = $call;



if ( 
"" == $_REQUEST["lat"] || "" == $_REQUEST["lon"] ) {
    
header("Content-type: image/x-png");
    
passthru("cat not-available.png");
    exit(
1);
}


require 
"map.php";

?>