<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
	require_once "./lib/viewer_functions.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
 </head>
<body>

<?php

    $lat = "";
    $lon = "";

	$records = mysql_query_fetch_all_assoc("SELECT zipcode,city,((ACOS(SIN($lat * PI() / 180) * SIN(latitude * PI() / 180) + COS($lat * PI() / 180) * COS(latitude * PI() / 180) * COS(($lon - longitude) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS distance FROM {$TABLE_PREFIX}geocodage HAVING distance<='10' ORDER BY distance ASC");

	foreach ($records as $record) { 
		print "{$record['city']} ";
		print "{$record['zipcode']}, ";
	}

?>

</body>
</html>