Пример #1
0
$iGroupID = FilterInput($_GET["GroupID"], 'int');
// Read values from config table into local variables
// **************************************************
$sSQL = "SELECT cfg_name, IFNULL(cfg_value, cfg_default) AS value FROM config_cfg WHERE cfg_section='ChurchInfoReport'";
$rsConfig = mysql_query($sSQL);
// Can't use RunQuery -- not defined yet
if ($rsConfig) {
    while (list($cfg_name, $cfg_value) = mysql_fetch_row($rsConfig)) {
        ${$cfg_name} = $cfg_value;
    }
}
if ($nChurchLatitude == 0 || $nChurchLongitude == 0) {
    require "Include/GeoCoder.php";
    $myAddressLatLon = new AddressLatLon();
    // Try to look up the church address to center the map.
    $myAddressLatLon->SetAddress($sChurchAddress, $sChurchCity, $sChurchState, $sChurchZip);
    $ret = $myAddressLatLon->Lookup();
    if ($ret == 0) {
        $nChurchLatitude = $myAddressLatLon->GetLat();
        $nChurchLongitude = $myAddressLatLon->GetLon();
        $sSQL = "UPDATE config_cfg SET cfg_value='" . $nChurchLatitude . "' WHERE cfg_name=\"nChurchLatitude\"";
        RunQuery($sSQL);
        $sSQL = "UPDATE config_cfg SET cfg_value='" . $nChurchLongitude . "' WHERE cfg_name=\"nChurchLongitude\"";
        RunQuery($sSQL);
    }
}
?>

   <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?<?php 
echo $sGoogleMapKey ? "key={$sGoogleMapKey}&" : "";
?>
Пример #2
0
 $sWorkPhone = FilterInput($_POST["WorkPhone"]);
 $sCellPhone = FilterInput($_POST["CellPhone"]);
 $sEmail = FilterInput($_POST["Email"]);
 $bSendNewsLetter = isset($_POST["SendNewsLetter"]);
 $nLatitude = 0.0;
 $nLongitude = 0.0;
 if (array_key_exists("Latitude", $_POST)) {
     $nLatitude = FilterInput($_POST["Latitude"], "float");
 }
 if (array_key_exists("Longitude", $_POST)) {
     $nLongitude = FilterInput($_POST["Longitude"], "float");
 }
 //	if ($bHaveXML) {
 // Try to get Lat/Lon based on the address
 $myAddressLatLon = new AddressLatLon();
 $myAddressLatLon->SetAddress($sAddress1, $sCity, $sState, $sZip);
 $ret = $myAddressLatLon->Lookup();
 if ($ret == 0) {
     $nLatitude = $myAddressLatLon->GetLat();
     $nLongitude = $myAddressLatLon->GetLon();
 } else {
     $nLatitude = "NULL";
     $nLongitude = "NULL";
 }
 //	}
 if (is_numeric($nLatitude)) {
     $nLatitude = "'" . $nLatitude . "'";
 } else {
     $nLatitude = "NULL";
 }
 if (is_numeric($nLongitude)) {
Пример #3
0
// Need to come back and fix this someday. Server timeouts are a problem.
// It just takes too long to do a lookups for a large database.
// For now am limiting to 250 lookups.
$sLimit = 250;
$sSQL .= "FROM family_fam ORDER BY fam_Latitude LIMIT {$sLimit}";
$rsFamilies = RunQuery($sSQL);
// Return the -99 records back to 0
$sSQL = "UPDATE family_fam SET fam_Latitude = 0, fam_Longitude = 0 WHERE fam_Latitude = -99";
RunQuery($sSQL);
$myAddressLatLon = new AddressLatLon();
// If the users database is large this loop does not finish before something times out.
// This results in an ungraceful ending when $sLimit is large.
// At least the unknown coordinates are first in the queue.
while ($aFam = mysql_fetch_array($rsFamilies)) {
    extract($aFam);
    $myAddressLatLon->SetAddress($fam_Address1, $fam_City, $fam_State, $fam_Zip);
    $ret = $myAddressLatLon->Lookup();
    if ($ret == 0) {
        $sNewLatitude = $myAddressLatLon->GetLat();
        $sNewLongitude = $myAddressLatLon->GetLon();
        if ($sNewLatitude === NULL) {
            $sNewLatitude = 0;
        }
        // if a lookup returned zero skip this.  Don't overwrite with 0,0
        if ($sNewLatitude != 0) {
            echo "<p>" . $fam_Name, " Latitude " . $sNewLatitude . " Longitude " . $sNewLongitude . "</p>";
            $sSQL = "UPDATE family_fam SET fam_Latitude='" . $sNewLatitude . "',fam_Longitude='" . $sNewLongitude . "' WHERE fam_ID=" . $fam_ID;
            RunQuery($sSQL);
        }
    } else {
        echo "<p>" . $fam_Name . ": " . $myAddressLatLon->GetError() . "</p>";