Esempio n. 1
0
 $sHomePhone = FilterInput($_POST["HomePhone"]);
 $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";
 }
Esempio n. 2
0
RunQuery($sSQL);
$sSQL = "UPDATE family_fam SET fam_Latitude = -99 WHERE fam_Latitude = 0";
RunQuery($sSQL);
// ORDER BY fam_Latitude forces the -99 records to the top of the queue
$sSQL = "SELECT fam_ID, fam_Name, fam_Address1, fam_City, fam_State, fam_Zip, fam_Latitude, fam_Longitude ";
//$sSQL .= "FROM family_fam ORDER BY fam_Latitude";
// 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) {
Esempio n. 3
0
require "Include/Header.php";
require "Include/ReportFunctions.php";
$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 
Esempio n. 4
0
<?php

require "Include/Config.php";
require "Include/Functions.php";
require "Include/GeoCoder.php";
require "Include/Header.php";
$sSQL = "SELECT fam_ID, fam_Name, fam_Address1, fam_City, fam_State, fam_Zip from family_fam";
$rsFamilies = RunQuery($sSQL);
$myAddressLatLon = new AddressLatLon();
while ($aFam = mysql_fetch_array($rsFamilies)) {
    extract($aFam);
    $myAddressLatLon->SetAddress($fam_Address1, $fam_City, $fam_State, $fam_Zip);
    $ret = $myAddressLatLon->Lookup();
    if ($ret == 0) {
        echo "<p>" . $fam_Name, " Latitude " . $myAddressLatLon->GetLat() . " Longitude " . $myAddressLatLon->GetLon() . "</p>";
        $sSQL = "UPDATE family_fam SET fam_Latitude='" . $myAddressLatLon->GetLat() . "',fam_Longitude='" . $myAddressLatLon->GetLon() . "' WHERE fam_ID=" . $fam_ID;
        RunQuery($sSQL);
    } else {
        echo "<p>" . $fam_Name . ": " . $myAddressLatLon->GetError() . "</p>";
    }
    flush();
    ob_flush();
}