Test for Manuel Lemos's PHP NetGeo class


GetAddressLocation($ip,$location)) { $longitude=doubleval($location["LONG"]); $latitude=doubleval($location["LAT"]); echo "

Your approximate location:

\n"; echo "
\n\n"; if(IsSet($location["CITY"]) || IsSet($location["STATE"]) || IsSet($location["COUNTRY"])) { echo "\n"; } echo "\n\n"; echo "
\n"; if(IsSet($location["CITY"])) echo "\n\n\n\n"; if(IsSet($location["STATE"])) echo "\n\n\n\n"; if(IsSet($location["COUNTRY"])) echo "\n\n\n\n"; echo "
City:".HtmlEntities(ucwords(strtolower($location["CITY"])))."
State:".HtmlEntities(ucwords(strtolower($location["STATE"])))."
Country:".HtmlEntities(strtolower($location["COUNTRY"]))."
\n
\n\n"; echo "\n\n\n\n"; echo "\n\n\n\n"; echo "
Longitude:".($longitude>=0.0 ? $longitude."° East" : (-$longitude)."° West")."
Latitude:".($latitude>=0.0 ? $latitude."° North" : (-$latitude)."° South")."
\n
\n"; $places=array( "Equator line"=>array($longitude,0.0), "Greenwich line"=>array(0.0,$latitude), "North Pole"=>array(0.0,90.0), "South Pole"=>array(0.0,-90.0), "PHP Classes site"=>array(-9.13,38.73) ); echo "

Distance to reference places in the world

\n"; echo "
\n\n\n\n\n\n\n"; for(Reset($places),$place=0;$place\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "
PlaceLongitudeLatitudeDistance
$name".($long>0 ? $long."° East" : ($long<0 ? (-$long)."° West" : "0°"))."".($lat>0 ? $lat."° North" : ($lat<0 ? (-$lat)."° South" : "0°"))."".intval($netgeo->CalculateDistance($longitude,$latitude,$long,$lat))." Km
\n"; } else { echo "

Sorry, could not determine your network location!

\n"; echo "

Error: ".$netgeo->error.".

\n"; } ?>
mlemos at acm dot org (Manuel Lemos)