69 lines
1.3 KiB
PHP
69 lines
1.3 KiB
PHP
<?php
|
|
|
|
/* $Id: group_album_file.php 161 2009-04-28 21:14:59Z john $ */
|
|
|
|
$page = "general";
|
|
include "header.php";
|
|
function general()
|
|
{
|
|
global $user, $database;
|
|
|
|
|
|
?>
|
|
|
|
<p id="demo">Click the button to get your coordinates:</p>
|
|
<button onclick="getLocation()">Try It</button>
|
|
|
|
<div id="zips"></div>
|
|
<script>
|
|
function loadXMLDoc(lat, long)
|
|
{
|
|
var xmlhttp;
|
|
|
|
if (window.XMLHttpRequest)
|
|
{// code for IE7+, Firefox, Chrome, Opera, Safari
|
|
xmlhttp=new XMLHttpRequest();
|
|
}
|
|
else
|
|
{// code for IE6, IE5
|
|
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
|
}
|
|
xmlhttp.onreadystatechange=function()
|
|
{
|
|
|
|
if (xmlhttp.readyState==4 && xmlhttp.status==200)
|
|
{
|
|
|
|
|
|
document.getElementById("zips").innerHTML=xmlhttp.responseText;
|
|
|
|
}
|
|
}
|
|
|
|
xmlhttp.open("GET","grabzips1.php?lat="+lat+"&long="+long,true);
|
|
|
|
|
|
xmlhttp.send();
|
|
|
|
}
|
|
var x=document.getElementById("demo");
|
|
function getLocation()
|
|
{
|
|
if (navigator.geolocation)
|
|
{
|
|
navigator.geolocation.watchPosition(showPosition);
|
|
}
|
|
else{x.innerHTML="Geolocation is not supported by this browser.";}
|
|
}
|
|
function showPosition(position)
|
|
{
|
|
x.innerHTML="Latitude: " + position.coords.latitude +
|
|
"<br>Longitude: " + position.coords.longitude;
|
|
|
|
loadXMLDoc(position.coords.latitude, position.coords.longitude);
|
|
}
|
|
</script>
|
|
<?
|
|
}
|
|
include "footer.php";
|
|
?>
|