Fifth pass at adding key files
This commit is contained in:
52
site/googlemaps/coaches_xml.php
Normal file
52
site/googlemaps/coaches_xml.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
header("Content-type: text/xml");
|
||||
|
||||
require("phpsqlajax_dbinfo.php");
|
||||
|
||||
function parseToXML($htmlStr)
|
||||
{
|
||||
$xmlStr=str_replace('<','<',$htmlStr);
|
||||
$xmlStr=str_replace('>','>',$xmlStr);
|
||||
$xmlStr=str_replace('"','"',$xmlStr);
|
||||
$xmlStr=str_replace("'",''',$xmlStr);
|
||||
$xmlStr=str_replace("&",'&',$xmlStr);
|
||||
return $xmlStr;
|
||||
}
|
||||
|
||||
// Opens a connection to a MySQL server
|
||||
$connection=mysql_connect ($host, $username, $password);
|
||||
if (!$connection) {
|
||||
die('Not connected : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Set the active MySQL database
|
||||
$db_selected = mysql_select_db($database, $connection);
|
||||
if (!$db_selected) {
|
||||
die ('Can\'t use db : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Select all the rows in the markers table
|
||||
$query = "SELECT * FROM gforum_Coaches WHERE coach_lat <> 0 AND coach_lng <> 0";
|
||||
$result = mysql_query($query);
|
||||
if (!$result) {
|
||||
die('Invalid query: ' . mysql_error());
|
||||
}
|
||||
|
||||
// Start XML file, echo parent node
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
|
||||
echo '<markers>'.PHP_EOL;
|
||||
|
||||
// Iterate through the rows, printing XML nodes for each
|
||||
while ($row = @mysql_fetch_assoc($result)){
|
||||
// ADD TO XML DOCUMENT NODE
|
||||
echo '<marker';
|
||||
echo ' name="' . parseToXML($row['coach_name']) . '" ';
|
||||
echo 'lat="' . $row['coach_lat'] . '" ';
|
||||
echo 'lng="' . $row['coach_lng'] . '" ';
|
||||
echo '/>'.PHP_EOL;
|
||||
}
|
||||
|
||||
// End XML file
|
||||
echo '</markers>';
|
||||
|
||||
?>
|
52
site/googlemaps/fitters_xml.php
Normal file
52
site/googlemaps/fitters_xml.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
header("Content-type: text/xml");
|
||||
|
||||
require("phpsqlajax_dbinfo.php");
|
||||
|
||||
function parseToXML($htmlStr)
|
||||
{
|
||||
$xmlStr=str_replace('<','<',$htmlStr);
|
||||
$xmlStr=str_replace('>','>',$xmlStr);
|
||||
$xmlStr=str_replace('"','"',$xmlStr);
|
||||
$xmlStr=str_replace("'",''',$xmlStr);
|
||||
$xmlStr=str_replace("&",'&',$xmlStr);
|
||||
return $xmlStr;
|
||||
}
|
||||
|
||||
// Opens a connection to a MySQL server
|
||||
$connection=mysql_connect ($host, $username, $password);
|
||||
if (!$connection) {
|
||||
die('Not connected : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Set the active MySQL database
|
||||
$db_selected = mysql_select_db($database, $connection);
|
||||
if (!$db_selected) {
|
||||
die ('Can\'t use db : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Select all the rows in the markers table
|
||||
$query = "SELECT * FROM gforum_Fitters WHERE fitter_lat <> 0 AND fitter_lng <> 0";
|
||||
$result = mysql_query($query);
|
||||
if (!$result) {
|
||||
die('Invalid query: ' . mysql_error());
|
||||
}
|
||||
|
||||
// Start XML file, echo parent node
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
|
||||
echo '<markers>'.PHP_EOL;
|
||||
|
||||
// Iterate through the rows, printing XML nodes for each
|
||||
while ($row = @mysql_fetch_assoc($result)){
|
||||
// ADD TO XML DOCUMENT NODE
|
||||
echo '<marker';
|
||||
echo ' name="' . parseToXML($row['fitter_name']) . '" ';
|
||||
echo 'lat="' . $row['fitter_lat'] . '" ';
|
||||
echo 'lng="' . $row['fitter_lng'] . '" ';
|
||||
echo '/>'.PHP_EOL;
|
||||
}
|
||||
|
||||
// End XML file
|
||||
echo '</markers>';
|
||||
|
||||
?>
|
227
site/googlemaps/map_json.php
Normal file
227
site/googlemaps/map_json.php
Normal file
@ -0,0 +1,227 @@
|
||||
<?php
|
||||
|
||||
$db_host = "localhost";
|
||||
$db_user = "gt";
|
||||
$db_pass = 'dyBKmffRvvxMHfV8';
|
||||
$db_name = 'dev_slowtwitch';
|
||||
$is_live = true;
|
||||
|
||||
if ( $is_live ) {
|
||||
|
||||
$db_name = 'slowtwitch';
|
||||
$db_user = 'slowtwitch';
|
||||
$db_pass = 'k9volqlAcpq';
|
||||
$db_host = '192.168.1.10';
|
||||
|
||||
}
|
||||
|
||||
$db_tables = array(
|
||||
'coach' => 'gforum_Coaches',
|
||||
'retailer' => 'gforum_Retailers',
|
||||
'runshop' => 'gforum_Runshops',
|
||||
'race' => 'gforum_Triathlons',
|
||||
'fitter' => 'gforum_Fitters',
|
||||
'triclub' => 'gforum_Triclubs',
|
||||
'roadshow' => 'gforum_Roadshow'
|
||||
);
|
||||
|
||||
|
||||
if ( isset($_POST['action'] )) {
|
||||
|
||||
if ( $_POST["action"] == 'test' ) {
|
||||
connectdb( 'runshop' );
|
||||
|
||||
fetchJson( 'runshop' );
|
||||
|
||||
echo 'testing';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (is_ajax()) {
|
||||
if (isset($_POST["action"]) && !empty($_POST["action"])) { //Checks if action value exists
|
||||
$action = $_POST["action"];
|
||||
switch($action) { //Switch case for value of action
|
||||
case "test": return_json(); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Function to check if the request is an AJAX request
|
||||
function is_ajax() {
|
||||
|
||||
return isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
|
||||
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
|
||||
|
||||
}
|
||||
|
||||
function return_json(){
|
||||
$return = $_POST;
|
||||
|
||||
echo json_encode($return);
|
||||
}
|
||||
|
||||
function connectdb( $slug = null ) {
|
||||
|
||||
$data = array();
|
||||
|
||||
global $db_host, $db_user, $db_pass, $db_name;
|
||||
global $db_tables;
|
||||
|
||||
if ( $slug !== null && $db_tables[$slug] ) {
|
||||
|
||||
$table = $db_tables[$slug];
|
||||
|
||||
$mysqli = new mysqli( $db_host, $db_user, $db_pass, $db_name);
|
||||
if ( $mysqli->connect_errno ) {
|
||||
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") "
|
||||
. $mysqli->connect_error;
|
||||
}
|
||||
|
||||
// Select all the rows in the markers table
|
||||
$query = select_table( $slug );
|
||||
|
||||
/* Prepared statement, stage 1: prepare */
|
||||
if ( ! ($stmt = $mysqli->prepare( $query ) ) ) {
|
||||
echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Execute statement */
|
||||
if ( !$stmt->execute() ) {
|
||||
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get results */
|
||||
if ( !( $result = db_get_result( $stmt ) ) ) {
|
||||
echo "Getting result set failed: (" . $stmt->errno . ") " . $stmt->error;
|
||||
return;
|
||||
}
|
||||
|
||||
$id = $slug . '_id';
|
||||
$name = $slug . '_name';
|
||||
$lat = $slug . '_lat';
|
||||
$lng = $slug . '_lng';
|
||||
$info1 = $slug . '_address';
|
||||
$info2 = $slug . '_address_two';
|
||||
$info3= $slug . '_city';
|
||||
$info4 = $slug . '_state';
|
||||
$phone = $slug . '_phone';
|
||||
$email = $slug . '_email';
|
||||
$website = $slug . '_website';
|
||||
$details = '';
|
||||
|
||||
if ( $slug == 'coach')
|
||||
$details = '/coaches/individual.php?coach_id=';
|
||||
|
||||
if ( $slug == 'retailer')
|
||||
$details = '/retailers/individual.php?retailer_id=';
|
||||
|
||||
if ( $slug == 'fitter')
|
||||
$details = '/fitters/individual.php?fitter_id=';
|
||||
|
||||
if ( $slug == 'runshop')
|
||||
$details = '/runshops/individual.php?runshop_id=';
|
||||
|
||||
if ( $slug == 'triclub')
|
||||
$details = '/triclubs/individual.php?triclub_id=';
|
||||
|
||||
if ( $slug == 'roadshow' ) {
|
||||
$details = '/roadshow/individual.php?roadshow_id=';
|
||||
}
|
||||
|
||||
if ( $slug == 'race' ) {
|
||||
$name = 'name';
|
||||
$lat = 'lat';
|
||||
$lng = 'lng';
|
||||
$info1 = 'date';
|
||||
$info2 = 'swim';
|
||||
$info3 = 'bike';
|
||||
$info4 = 'run';
|
||||
$id = 'uid';
|
||||
$phone = 'phone';
|
||||
$email = 'email';
|
||||
$details = '/individual.php?uid=';
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Iterate through the rows, printing XML nodes for each
|
||||
while ( $row = array_shift( $result ) ) {
|
||||
|
||||
if ( $row[$lat] && $row[$lng] ) {
|
||||
$data[] = array(
|
||||
'category' => $slug,
|
||||
'name' => htmlentities ($row[$name]),
|
||||
'lat' => $row[$lat],
|
||||
'lng' => $row[$lng],
|
||||
'info1' => htmlentities ($row[$info1]),
|
||||
'info2' => htmlentities ($row[$info2]),
|
||||
'info3' => htmlentities ($row[$info3]),
|
||||
'info4' => htmlentities ($row[$info4]),
|
||||
'phone' => htmlentities ($row[$phone]),
|
||||
'email' => htmlentities ($row[$email]),
|
||||
'website' => htmlentities ($row[$website]),
|
||||
'details' => $details . $row[$id],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* explicit close recommended */
|
||||
$stmt->close();
|
||||
$mysqli->close();
|
||||
|
||||
} else {
|
||||
|
||||
$data = 'no data';
|
||||
|
||||
}
|
||||
|
||||
$data = json_encode( $data );
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
function select_table( $slug = null ) {
|
||||
|
||||
global $db_tables;
|
||||
$query = '';
|
||||
|
||||
if ( $slug !== null ) {
|
||||
|
||||
$table = $db_tables[$slug];
|
||||
|
||||
if ( $table ) {
|
||||
|
||||
if ( $slug == 'race' ) {
|
||||
$today = date('Y-m-d');
|
||||
$query ='SELECT * FROM ' . $table . ' WHERE date >= "' .$today . '"';
|
||||
} else {
|
||||
$query ='SELECT * FROM ' . $table . ' WHERE ' . $slug . '_lat <> 0 AND ' .$slug . '_lng <> 0';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
function db_get_result( $Statement ) {
|
||||
$RESULT = array();
|
||||
$Statement->store_result();
|
||||
for ( $i = 0; $i < $Statement->num_rows; $i++ ) {
|
||||
$Metadata = $Statement->result_metadata();
|
||||
$PARAMS = array();
|
||||
while ( $Field = $Metadata->fetch_field() ) {
|
||||
$PARAMS[] = &$RESULT[ $i ][ $Field->name ];
|
||||
}
|
||||
call_user_func_array( array( $Statement, 'bind_result' ), $PARAMS );
|
||||
$Statement->fetch();
|
||||
}
|
||||
return $RESULT;
|
||||
}
|
||||
|
||||
|
||||
?>
|
49
site/googlemaps/map_json_cache.php
Normal file
49
site/googlemaps/map_json_cache.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once('map_json.php');
|
||||
|
||||
if ( $_GET['fetch'] == 'all' ) {
|
||||
writeAllJson();
|
||||
}
|
||||
|
||||
|
||||
function fetchJson( $slug = null ) {
|
||||
|
||||
global $db_tables;
|
||||
|
||||
if ( $slug !== null ) {
|
||||
|
||||
$filename = $slug . '.json';
|
||||
$content = connectdb( $slug );
|
||||
|
||||
$json = array( $filename, $content );
|
||||
|
||||
return $json;
|
||||
}
|
||||
}
|
||||
|
||||
// $test = fetchJson( 'runshop' );
|
||||
|
||||
// writeJson( $test );
|
||||
|
||||
function writeJson( $json = array() ) {
|
||||
|
||||
$myfile = fopen( 'json/' . $json['0'], "w") or die("Unable to open file!" . $json['0']);
|
||||
|
||||
fwrite( $myfile, $json['1'] );
|
||||
fclose( $myfile );
|
||||
|
||||
echo $json['0'] . ' write complete ' . date('Y-m-d (D) g:m:s A T') . '<br/>';
|
||||
|
||||
}
|
||||
|
||||
function writeAllJson() {
|
||||
global $db_tables;
|
||||
foreach ( $db_tables as $slug => $table ) {
|
||||
$data = fetchJson( $slug );
|
||||
writeJson( $data );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
57
site/googlemaps/openwater_xml.php
Normal file
57
site/googlemaps/openwater_xml.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
header("Content-type: text/xml");
|
||||
|
||||
require("phpsqlajax_dbinfo.php");
|
||||
|
||||
//don't change unless you change this value in the db.
|
||||
$prefix = "gforum_";
|
||||
$main_table = "OpenWater";
|
||||
$field_lead = "openwater_";
|
||||
|
||||
function parseToXML($htmlStr)
|
||||
{
|
||||
$xmlStr=str_replace('<','<',$htmlStr);
|
||||
$xmlStr=str_replace('>','>',$xmlStr);
|
||||
$xmlStr=str_replace('"','"',$xmlStr);
|
||||
$xmlStr=str_replace("'",''',$xmlStr);
|
||||
$xmlStr=str_replace("&",'&',$xmlStr);
|
||||
return $xmlStr;
|
||||
}
|
||||
|
||||
// Opens a connection to a MySQL server
|
||||
$connection=mysql_connect ($host, $username, $password);
|
||||
if (!$connection) {
|
||||
die('Not connected : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Set the active MySQL database
|
||||
$db_selected = mysql_select_db($database, $connection);
|
||||
if (!$db_selected) {
|
||||
die ('Can\'t use db : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Select all the rows in the markers table
|
||||
$query = "SELECT ".$field_lead."name, ".$field_lead."lat, ".$field_lead."lng FROM ".$prefix.$main_table." WHERE ".$field_lead."lat <> 0 AND ".$field_lead."lng <> 0";
|
||||
$result = mysql_query($query);
|
||||
if (!$result) {
|
||||
die('Invalid query: ' . mysql_error());
|
||||
}
|
||||
|
||||
// Start XML file, echo parent node
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
|
||||
echo '<markers>'.PHP_EOL;
|
||||
|
||||
// Iterate through the rows, printing XML nodes for each
|
||||
while ($row = @mysql_fetch_assoc($result)){
|
||||
// ADD TO XML DOCUMENT NODE
|
||||
echo '<marker';
|
||||
echo ' name="' . parseToXML($row[''.$field_lead.'name']) . '" ';
|
||||
echo 'lat="' . $row[''.$field_lead.'lat'] . '" ';
|
||||
echo 'lng="' . $row[''.$field_lead.'lng'] . '" ';
|
||||
echo '/>'.PHP_EOL;
|
||||
}
|
||||
|
||||
// End XML file
|
||||
echo '</markers>';
|
||||
|
||||
?>
|
12
site/googlemaps/phpsqlajax_dbinfo.php
Normal file
12
site/googlemaps/phpsqlajax_dbinfo.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?PHP
|
||||
|
||||
if (eregi("phpsqlajax_dbinfo.php", $_SERVER['SCRIPT_NAME'])) {
|
||||
Header("Location: http://www.slowtwitch.com"); die();
|
||||
}
|
||||
|
||||
$username="slowtwitch";
|
||||
$password="k9volqlAcpq";
|
||||
$database="slowtwitch";
|
||||
$host="192.168.1.10";
|
||||
|
||||
?>
|
52
site/googlemaps/phpsqlajax_genxml2.php
Normal file
52
site/googlemaps/phpsqlajax_genxml2.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
header("Content-type: text/xml");
|
||||
|
||||
require("phpsqlajax_dbinfo.php");
|
||||
|
||||
function parseToXML($htmlStr)
|
||||
{
|
||||
$xmlStr=str_replace('<','<',$htmlStr);
|
||||
$xmlStr=str_replace('>','>',$xmlStr);
|
||||
$xmlStr=str_replace('"','"',$xmlStr);
|
||||
$xmlStr=str_replace("'",''',$xmlStr);
|
||||
$xmlStr=str_replace("&",'&',$xmlStr);
|
||||
return $xmlStr;
|
||||
}
|
||||
|
||||
// Opens a connection to a MySQL server
|
||||
$connection=mysql_connect ($host, $username, $password);
|
||||
if (!$connection) {
|
||||
die('Not connected : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Set the active MySQL database
|
||||
$db_selected = mysql_select_db($database, $connection);
|
||||
if (!$db_selected) {
|
||||
die ('Can\'t use db : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Select all the rows in the markers table
|
||||
$query = "SELECT * FROM gforum_Fitters WHERE fitter_lat <> 0 AND fitter_lng <> 0";
|
||||
$result = mysql_query($query);
|
||||
if (!$result) {
|
||||
die('Invalid query: ' . mysql_error());
|
||||
}
|
||||
|
||||
// Start XML file, echo parent node
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
|
||||
echo '<markers>'.PHP_EOL;
|
||||
|
||||
// Iterate through the rows, printing XML nodes for each
|
||||
while ($row = @mysql_fetch_assoc($result)){
|
||||
// ADD TO XML DOCUMENT NODE
|
||||
echo '<marker';
|
||||
echo ' name="' . parseToXML($row['fitter_name']) . '" ';
|
||||
echo 'lat="' . $row['fitter_lat'] . '" ';
|
||||
echo 'lng="' . $row['fitter_lng'] . '" ';
|
||||
echo '/>'.PHP_EOL;
|
||||
}
|
||||
|
||||
// End XML file
|
||||
echo '</markers>';
|
||||
|
||||
?>
|
69
site/googlemaps/phpsqlajax_map.htm
Normal file
69
site/googlemaps/phpsqlajax_map.htm
Normal file
@ -0,0 +1,69 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
|
||||
<title>Google Maps AJAX + mySQL/PHP Example</title>
|
||||
<script src="http://maps.google.com/maps?file=api&v=2&key=AIzaSyA13hZb_mE3Fx3KPevCWrQPERPykhiTIIw"
|
||||
type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
var iconRed = new GIcon();
|
||||
iconRed.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png';
|
||||
iconRed.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
|
||||
iconRed.iconSize = new GSize(12, 20);
|
||||
iconRed.shadowSize = new GSize(22, 20);
|
||||
iconRed.iconAnchor = new GPoint(6, 20);
|
||||
iconRed.infoWindowAnchor = new GPoint(5, 1);
|
||||
|
||||
var customIcons = [];
|
||||
customIcons["fitter"] = iconRed;
|
||||
|
||||
function load() {
|
||||
if (GBrowserIsCompatible()) {
|
||||
var map = new GMap2(document.getElementById("map"));
|
||||
map.addControl(new GSmallMapControl());
|
||||
map.addControl(new GMapTypeControl());
|
||||
map.setCenter(new GLatLng(40, -100), 3);
|
||||
|
||||
// Change this depending on the name of your PHP file
|
||||
GDownloadUrl("phpsqlajax_genxml2.php", function(data, responseCode) {
|
||||
//alert ("loading...");
|
||||
if(responseCode == 200) {
|
||||
var xml = GXml.parse(data);
|
||||
var markers = xml.documentElement.getElementsByTagName("marker");
|
||||
//alert ("Number of markers: "+markers.length);
|
||||
for (var i = 0; i < markers.length; i++) {
|
||||
var name = markers[i].getAttribute("name");
|
||||
var address = markers[i].getAttribute("address");
|
||||
var type = markers[i].getAttribute("type");
|
||||
var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
|
||||
parseFloat(markers[i].getAttribute("lng")));
|
||||
var marker = createMarker(point, name, address, type);
|
||||
map.addOverlay(marker);
|
||||
}
|
||||
} else if(responseCode == -1) {
|
||||
alert("Data request timed out. Please try later.");
|
||||
} else {
|
||||
alert("Request resulted in error. Check XML file is retrievable.");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function createMarker(point, name, address, type) {
|
||||
var marker = new GMarker(point, customIcons[type]);
|
||||
var html = "<b>" + name + "</b> <br/>" + address;
|
||||
GEvent.addListener(marker, 'click', function() {
|
||||
marker.openInfoWindowHtml(html);
|
||||
});
|
||||
return marker;
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="load()" onunload="GUnload()">
|
||||
<div id="map" style="width: 600px; height: 400px"></div>
|
||||
</body>
|
||||
</html>
|
52
site/googlemaps/retailers_xml.php
Normal file
52
site/googlemaps/retailers_xml.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
header("Content-type: text/xml");
|
||||
|
||||
require("phpsqlajax_dbinfo.php");
|
||||
|
||||
function parseToXML($htmlStr)
|
||||
{
|
||||
$xmlStr=str_replace('<','<',$htmlStr);
|
||||
$xmlStr=str_replace('>','>',$xmlStr);
|
||||
$xmlStr=str_replace('"','"',$xmlStr);
|
||||
$xmlStr=str_replace("'",''',$xmlStr);
|
||||
$xmlStr=str_replace("&",'&',$xmlStr);
|
||||
return $xmlStr;
|
||||
}
|
||||
|
||||
// Opens a connection to a MySQL server
|
||||
$connection=mysql_connect ($host, $username, $password);
|
||||
if (!$connection) {
|
||||
die('Not connected : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Set the active MySQL database
|
||||
$db_selected = mysql_select_db($database, $connection);
|
||||
if (!$db_selected) {
|
||||
die ('Can\'t use db : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Select all the rows in the markers table
|
||||
$query = "SELECT * FROM gforum_Retailers WHERE retailer_lat <> 0 AND retailer_lng <> 0";
|
||||
$result = mysql_query($query);
|
||||
if (!$result) {
|
||||
die('Invalid query: ' . mysql_error());
|
||||
}
|
||||
|
||||
// Start XML file, echo parent node
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
|
||||
echo '<markers>'.PHP_EOL;
|
||||
|
||||
// Iterate through the rows, printing XML nodes for each
|
||||
while ($row = @mysql_fetch_assoc($result)){
|
||||
// ADD TO XML DOCUMENT NODE
|
||||
echo '<marker';
|
||||
echo ' name="' . parseToXML($row['retailer_name']) . '" ';
|
||||
echo 'lat="' . $row['retailer_lat'] . '" ';
|
||||
echo 'lng="' . $row['retailer_lng'] . '" ';
|
||||
echo '/>'.PHP_EOL;
|
||||
}
|
||||
|
||||
// End XML file
|
||||
echo '</markers>';
|
||||
|
||||
?>
|
52
site/googlemaps/roadshow_xml.php
Normal file
52
site/googlemaps/roadshow_xml.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
header("Content-type: text/xml");
|
||||
|
||||
require("phpsqlajax_dbinfo.php");
|
||||
|
||||
function parseToXML($htmlStr)
|
||||
{
|
||||
$xmlStr=str_replace('<',' ',$htmlStr);
|
||||
$xmlStr=str_replace('>',' ',$xmlStr);
|
||||
$xmlStr=str_replace('"',' ',$xmlStr);
|
||||
$xmlStr=str_replace("'",'',$xmlStr);
|
||||
$xmlStr=str_replace("&",' and ',$xmlStr);
|
||||
return $xmlStr;
|
||||
}
|
||||
|
||||
// Opens a connection to a MySQL server
|
||||
$connection=mysql_connect ($host, $username, $password);
|
||||
if (!$connection) {
|
||||
die('Not connected : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Set the active MySQL database
|
||||
$db_selected = mysql_select_db($database, $connection);
|
||||
if (!$db_selected) {
|
||||
die ('Can\'t use db : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Select all the rows in the markers table
|
||||
$query = "SELECT * FROM gforum_Roadshow WHERE roadshow_lat <> 0 AND roadshow_lng <> 0";
|
||||
$result = mysql_query($query);
|
||||
if (!$result) {
|
||||
die('Invalid query: ' . mysql_error());
|
||||
}
|
||||
|
||||
// Start XML file, echo parent node
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
|
||||
echo '<markers>'.PHP_EOL;
|
||||
|
||||
// Iterate through the rows, printing XML nodes for each
|
||||
while ($row = @mysql_fetch_assoc($result)){
|
||||
// ADD TO XML DOCUMENT NODE
|
||||
echo '<marker';
|
||||
echo ' name="' . parseToXML($row['roadshow_name']) . '" ';
|
||||
echo 'lat="' . $row['roadshow_lat'] . '" ';
|
||||
echo 'lng="' . $row['roadshow_lng'] . '" ';
|
||||
echo '/>'.PHP_EOL;
|
||||
}
|
||||
|
||||
// End XML file
|
||||
echo '</markers>';
|
||||
|
||||
?>
|
52
site/googlemaps/runshops_xml.php
Normal file
52
site/googlemaps/runshops_xml.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
header("Content-type: text/xml");
|
||||
|
||||
require("phpsqlajax_dbinfo.php");
|
||||
|
||||
function parseToXML($htmlStr)
|
||||
{
|
||||
$xmlStr=str_replace('<','<',$htmlStr);
|
||||
$xmlStr=str_replace('>','>',$xmlStr);
|
||||
$xmlStr=str_replace('"','"',$xmlStr);
|
||||
$xmlStr=str_replace("'",''',$xmlStr);
|
||||
$xmlStr=str_replace("&",'&',$xmlStr);
|
||||
return $xmlStr;
|
||||
}
|
||||
|
||||
// Opens a connection to a MySQL server
|
||||
$connection=mysql_connect ($host, $username, $password);
|
||||
if (!$connection) {
|
||||
die('Not connected : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Set the active MySQL database
|
||||
$db_selected = mysql_select_db($database, $connection);
|
||||
if (!$db_selected) {
|
||||
die ('Can\'t use db : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Select all the rows in the markers table
|
||||
$query = "SELECT * FROM gforum_Runshops WHERE runshop_lat <> 0 AND runshop_lng <> 0";
|
||||
$result = mysql_query($query);
|
||||
if (!$result) {
|
||||
die('Invalid query: ' . mysql_error());
|
||||
}
|
||||
|
||||
// Start XML file, echo parent node
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
|
||||
echo '<markers>'.PHP_EOL;
|
||||
|
||||
// Iterate through the rows, printing XML nodes for each
|
||||
while ($row = @mysql_fetch_assoc($result)){
|
||||
// ADD TO XML DOCUMENT NODE
|
||||
echo '<marker';
|
||||
echo ' name="' . parseToXML($row['runshop_name']) . '" ';
|
||||
echo 'lat="' . $row['runshop_lat'] . '" ';
|
||||
echo 'lng="' . $row['runshop_lng'] . '" ';
|
||||
echo '/>'.PHP_EOL;
|
||||
}
|
||||
|
||||
// End XML file
|
||||
echo '</markers>';
|
||||
|
||||
?>
|
52
site/googlemaps/triathlons_xml.php
Normal file
52
site/googlemaps/triathlons_xml.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
header("Content-type: text/xml");
|
||||
|
||||
require("phpsqlajax_dbinfo.php");
|
||||
|
||||
function parseToXML($htmlStr)
|
||||
{
|
||||
$xmlStr=str_replace('<','<',$htmlStr);
|
||||
$xmlStr=str_replace('>','>',$xmlStr);
|
||||
$xmlStr=str_replace('"','"',$xmlStr);
|
||||
$xmlStr=str_replace("'",''',$xmlStr);
|
||||
$xmlStr=str_replace("&",'&',$xmlStr);
|
||||
return $xmlStr;
|
||||
}
|
||||
|
||||
// Opens a connection to a MySQL server
|
||||
$connection=mysql_connect ($host, $username, $password);
|
||||
if (!$connection) {
|
||||
die('Not connected : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Set the active MySQL database
|
||||
$db_selected = mysql_select_db($database, $connection);
|
||||
if (!$db_selected) {
|
||||
die ('Can\'t use db : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Select all the rows in the markers table
|
||||
$query = "SELECT * FROM gforum_Triathlons WHERE lat <> 0 AND lng <> 0";
|
||||
$result = mysql_query($query);
|
||||
if (!$result) {
|
||||
die('Invalid query: ' . mysql_error());
|
||||
}
|
||||
|
||||
// Start XML file, echo parent node
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
|
||||
echo '<markers>'.PHP_EOL;
|
||||
|
||||
// Iterate through the rows, printing XML nodes for each
|
||||
while ($row = @mysql_fetch_assoc($result)){
|
||||
// ADD TO XML DOCUMENT NODE
|
||||
echo '<marker';
|
||||
echo ' name="' . parseToXML($row['name']) . '" ';
|
||||
echo 'lat="' . $row['lat'] . '" ';
|
||||
echo 'lng="' . $row['lng'] . '" ';
|
||||
echo '/>'.PHP_EOL;
|
||||
}
|
||||
|
||||
// End XML file
|
||||
echo '</markers>';
|
||||
|
||||
?>
|
52
site/googlemaps/triclubs_xml.php
Normal file
52
site/googlemaps/triclubs_xml.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
header("Content-type: text/xml");
|
||||
|
||||
require("phpsqlajax_dbinfo.php");
|
||||
|
||||
function parseToXML($htmlStr)
|
||||
{
|
||||
$xmlStr=str_replace('<','<',$htmlStr);
|
||||
$xmlStr=str_replace('>','>',$xmlStr);
|
||||
$xmlStr=str_replace('"','"',$xmlStr);
|
||||
$xmlStr=str_replace("'",''',$xmlStr);
|
||||
$xmlStr=str_replace("&",'&',$xmlStr);
|
||||
return $xmlStr;
|
||||
}
|
||||
|
||||
// Opens a connection to a MySQL server
|
||||
$connection=mysql_connect ($host, $username, $password);
|
||||
if (!$connection) {
|
||||
die('Not connected : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Set the active MySQL database
|
||||
$db_selected = mysql_select_db($database, $connection);
|
||||
if (!$db_selected) {
|
||||
die ('Can\'t use db : ' . mysql_error());
|
||||
}
|
||||
|
||||
// Select all the rows in the markers table
|
||||
$query = "SELECT * FROM gforum_Triclubs WHERE triclub_lat <> 0 AND triclub_lng <> 0";
|
||||
$result = mysql_query($query);
|
||||
if (!$result) {
|
||||
die('Invalid query: ' . mysql_error());
|
||||
}
|
||||
|
||||
// Start XML file, echo parent node
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
|
||||
echo '<markers>'.PHP_EOL;
|
||||
|
||||
// Iterate through the rows, printing XML nodes for each
|
||||
while ($row = @mysql_fetch_assoc($result)){
|
||||
// ADD TO XML DOCUMENT NODE
|
||||
echo '<marker';
|
||||
echo ' name="' . parseToXML($row['triclub_name']) . '" ';
|
||||
echo 'lat="' . $row['triclub_lat'] . '" ';
|
||||
echo 'lng="' . $row['triclub_lng'] . '" ';
|
||||
echo '/>'.PHP_EOL;
|
||||
}
|
||||
|
||||
// End XML file
|
||||
echo '</markers>';
|
||||
|
||||
?>
|
Reference in New Issue
Block a user