So where is? ... "; $wiprefix=""; $promptclobber=""; $isiPad = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'iPad'); if ($isiPad === false) { $isiPad = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'iPhone'); } if ($isiPad === false) { $isiPad = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'Android'); } if ($isiPad) { $wprefix=""; $wiprefix="Where? style=width:50px"; $anticprefix=" Clickaround"; $promptclobber=""; } $gprefix="http://www.rjmprogramming.com.au/HTMLCSS/world.html?lat=0000.0&long=0000.0&name=%20&lat2=0000.0&long2=0000.0&name2=%20&lat3=0000.0&long3=0000.0&name3=%20&lat4=0000.0&long4=0000.0&name4=%20&lat5=0000.0&long5=0000.0&name5=%20&lat6=0000.0&long6=0000.0&name6=%20&lat7=0000.0&long7=0000.0&name7=%20&lat8=0000.0&long8=0000.0&name8=%20&lat9=0000.0&long9=0000.0&name9=%20&lat10=0000.0&long10=0000.0&name10=¬hing="; $alat = 0.0; $along = 0.0; $proposed = ""; $prefix = "%20Airport"; $num = 3; if (isset($_GET['num'])) $num = $_GET['num']; function lastlook($pis) { global $cprefix, $anticprefix, $csuffix; if (strlen($_SERVER['QUERY_STRING']) == 0 || 2 == 2) { return str_replace($anticprefix, "", str_replace("", "\n var iss=' " . $cprefix . $wprefix . "Please select last value below ...'; parent.document.getElementById('siswi').value=''; if (1 == 2) { parent.document.getElementById('siswi').value=this.value; } } else if (this.value.indexOf(';') != -1) { parent.document.getElementById('siswi').innerHTML+=''; parent.document.getElementById('siswi').value=this.value; } else if (this.value != '') { parent.document.getElementById('mypiframe').src='intair.php?sofar=' + encodeURIComponent(this.value.replace(.replace('Where?','')); } \" + '\" type=text onclick=this.value=\"\" id=iswi value=" . $wiprefix . ">
" . $csuffix . "'; if (parent.document.getElementById('mya')) { if (!parent.document.getElementById('diswi')) { parent.document.getElementById('mya').innerHTML=''; var hones=parent.document.getElementsByTagName('h1'); if (hones.length != 0) { if (hones[0].innerHTML.indexOf('" . $cprefix . $csuffix . "') != -1) { hones[0].innerHTML=hones[0].innerHTML.replace('" . $cprefix . $csuffix . "',iss.replace('xq',encodeURIComponent(this.value))); } } } } \n ", $pis)); } return $pis; } function pre_great_circle_nodistance($ptalis, $pgnolis, $one, $two, $three, $four, $five, $six, $seven, $eight, $sanity) { global $alat; global $along; $alat = ($one + ($two / 60.00) + ($three / 3600.0)); $along = ($five + ($six / 60.00) + ($seven / 3600.0)); if ($one == 0 && $two == 0 && $three == 0 && $five == 0 && $six == 0 && $seven == 0) { return 0.0; } else { //echo "*" . $sanity . "+++" . $four . "---" . $eight . "*"; if ($four == "S" && $eight == "U") $alat = -($one + ($two / 60.00) + ($three / 3600.0)); if ($four == "S" && $eight == "U") $along = -($five + ($six / 60.00) + ($seven / 3600.0)); if ($four != "S" && $eight == "U") $alat = ($one + ($two / 60.00) + ($three / 3600.0)); if ($four != "S" && $eight == "U") $along = -($five + ($six / 60.00) + ($seven / 3600.0)); if ($four == "S" && $eight != "U") $alat = -($one + ($two / 60.00) + ($three / 3600.0)); if ($four == "S" && $eight != "U") $along = ($five + ($six / 60.00) + ($seven / 3600.0)); return 0.0; } } function pre_great_circle_distance($ptalis, $pgnolis, $one, $two, $three, $four, $five, $six, $seven, $eight, $sanity) { global $alat; global $along; $alat = ($one + ($two / 60.00) + ($three / 3600.0)); $along = ($five + ($six / 60.00) + ($seven / 3600.0)); if ($one == 0 && $two == 0 && $three == 0 && $five == 0 && $six == 0 && $seven == 0) { return -9.0; } else { //echo "*" . $sanity . "+++" . $four . "---" . $eight . "*"; if ($four == "S" && $eight == "U") $alat = -($one + ($two / 60.00) + ($three / 3600.0)); if ($four == "S" && $eight == "U") $along = -($five + ($six / 60.00) + ($seven / 3600.0)); if ($four != "S" && $eight == "U") $alat = ($one + ($two / 60.00) + ($three / 3600.0)); if ($four != "S" && $eight == "U") $along = -($five + ($six / 60.00) + ($seven / 3600.0)); if ($four == "S" && $eight != "U") $alat = -($one + ($two / 60.00) + ($three / 3600.0)); if ($four == "S" && $eight != "U") $along = ($five + ($six / 60.00) + ($seven / 3600.0)); return great_circle_distance($ptalis, $pgnolis, $alat, $along); } } function great_circle_distance($talis, $gnolis, $latis, $longis) { $ourdist=0.0; $rgnol=(($gnolis) * pi() / 180.0); $rtal=(($talis) * pi() / 180.0); $rlong=(($longis) * pi() / 180.0); $rlat=(($latis) * pi() / 180.0); $deltalong = abs(((($gnolis)-($longis)) * pi() / 180.0)); $acof = (sin($rtal) * sin($rlat)) + (cos($rtal) * cos($rlat) * cos($deltalong)); // via http://en.wikipedia.org/wiki/Great-circle_distance ... thanks $ourdist = (round((acos($acof) * 6371000.0) + 0.00001) * 100) / 100; return $ourdist; } $nsf = -9.0; $name = ""; $glat = 0.0; $glong = 0.0; $mindist = -9.0; if (isset($_GET['lat']) && isset($_GET['long'])) { $adb = @file_get_contents("GlobalAirportDatabase/GlobalAirportDatabase.txt"); $cols = explode(":", "0000 " . $adb); for ($j=0; $j<$num; $j++) { for ($i=0; $i= 12) { $distis = pre_great_circle_distance($_GET['lat'], $_GET['long'], $cols[$i + 5], $cols[$i + 6], $cols[$i + 7], $cols[$i + 8], $cols[$i + 9], $cols[$i + 10], $cols[$i + 11], $cols[$i + 12], $cols[$i + 0]); if ($distis >= 0.0 && $distis > $mindist && ($nsf < 0.0 || $distis < $nsf)) { $nsf = $distis; $name = $cols[$i + 1] . "/" . $cols[$i + 2] . "/" . $cols[$i + 3] . "/" . $cols[$i + 4]; $glat = $alat; $glong = $along; //echo $name . " " , $glat . " " . $glong . " " . $nsf . "\n"; } } } if ($glat != 0.0 || $glong != 0.0) { $proposed = str_replace("", "\n parent.document.getElementById('myiframe').src=parent.document.getElementById('myiframe').src + ',[" . round($glat, 4) . "," . round($glong, 4) . ",~Nearest" . $prefix . "%20on%20GlobalAirportDatabase%20" . round($nsf / 1000.0) . "km%20to%20" . $name . "~]'; \n" . "", $proposed); $prefix = (str_replace("%20Airport", "", $prefix) . "-"); $mindist = $nsf; $nsf = -9.0; $name = ""; $glat = 0.0; $glong = 0.0; $distis = 0.0; } } echo lastlook($proposed); } else if (isset($_GET['plot']) && 1 == 2) { $adb = @file_get_contents("GlobalAirportDatabase/GlobalAirportDatabase.txt"); $cols = explode(":", "0000 " . $adb); for ($i=0; $i= 12) { $distis = pre_great_circle_distance($_GET['lat'], $_GET['long'], $cols[$i + 5], $cols[$i + 6], $cols[$i + 7], $cols[$i + 8], $cols[$i + 9], $cols[$i + 10], $cols[$i + 11], $cols[$i + 12], $cols[$i + 0]); if ($distis >= 0.0 && ($nsf < 0.0 || $distis < $nsf)) { //$nsf = $distis; $name = $cols[$i + 1] . "/" . $cols[$i + 2] . "/" . $cols[$i + 3] . "/" . $cols[$i + 4]; $glat = $alat; $glong = $along; $proposed = str_replace("", "\n parent.document.getElementById('mya').title='" . $glat . "," . $glong . "'; parent.document.getElementById('mya').click(); \n" . "", $proposed); } echo lastlook($proposed); } } } else if (isset($_GET['sofar']) && 1 == 1) { $sih=""; $fnum=0; $adb = @file_get_contents("GlobalAirportDatabase/GlobalAirportDatabase.txt"); $cols = explode(":", "0000 " . $adb); //for ($j=0; $j<$num; $j++) { for ($i=0; $i= 12) { $distis = pre_great_circle_nodistance(0.0, 0.0, $cols[$i + 5], $cols[$i + 6], $cols[$i + 7], $cols[$i + 8], $cols[$i + 9], $cols[$i + 10], $cols[$i + 11], $cols[$i + 12], $cols[$i + 0]); if (1 == 1 || ($distis >= 0.0 && $distis > $mindist && ($nsf < 0.0 || $distis < $nsf))) { $nsf = $distis; $name = $cols[$i + 1] . "/" . $cols[$i + 2] . "/" . $cols[$i + 3] . "/" . $cols[$i + 4]; $glat = $alat; $glong = $along; //echo $name . " " , $glat . " " . $glong . " " . $nsf . "\n"; if ($alat != 0.0 || $along != 0.0) { if (strpos(("/" . strtoupper($name)), "/" . strtoupper(urldecode($_GET['sofar']))) !== false) { $fnum++; if ($fnum == 2) $sih=str_replace("Found this ...", "Found these ...", $sih); if ($sih == "") $sih=""; $sih .= ''; } else if (strpos(("" . strtoupper($name)), strtoupper(urldecode($_GET['sofar']))) !== false && strlen(urldecode($_GET['sofar'])) >= 4) { $fnum++; if ($fnum == 2) $sih=str_replace("Found this ...", "Found these ...", $sih); if ($sih == "") $sih=""; $sih .= ''; } } } } } //} echo ""; } else if (5 == 5) { echo ""; } ?>