I'm not sure that'll help, as I'm positive it's how ?h is being handled. But I digress, I'll add in debugging echos and see if there's anything I'm failing to account for. I may have been unclear above, but if I change $_GET['h'] in the header to a k or anything else, the list of maps is viewable when I do ?h. Maybe the $_GET on the index is somehow clashing with the header? I've tried putting $ismap = isset($_GET['h']) in the same else if on the index with no change. I'll try it again though.
Code:
Code:
Google Tutorial
I created map_php because I needed to put stuff above the start of the HTML, such as the page title for the header.
Update:
Did not work. It was actually $ismap = TRUE. I ended up getting an undefined variable, $ismap, in the header. Put global before the variable and killed the whole thing. I could store it as a session variable, I suppose. See if that helps.
map_php.php wrote:
Code:
<?php
include_once('map_sql.php');
$mapdb = "**";
$maptables = "SHOW TABLES FROM $mapdb";
$mapresult = mysqli_query($mapcon, $maptables);
$latitude=null;
$longitude=null;
$user = "Alex";
// Set the sub title for the page
$header_title = " | Map";
// $_GET
if(isset($_GET['map'])) {$map = $_GET['map'];} else {$map = null;}
$map = preg_replace("/[^0-9]/", '', $map);
$map = htmlspecialchars($map);
$map ="$user$$map";
?>
map_script.php wrote:
Code:
<style type="text/css">
#map-canvas {
height: 500px;
width: 1000px;
margin: 0px;
padding: 10px
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
<script>
function initialize() {
var mapOptions = {
zoom: 10,
center: new google.maps.LatLng(37.3226668,-121.8924502,12),
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var myHike = [
<?php
if($map) {
$mapsql = "SELECT id, latitude, longitude FROM $map";
// Not MySQLi compliant?
# $sql = "SELECT * FROM (SELECT @row := @row +1 AS id, latitude, longitude FROM ( SELECT @row :=0) r, $map ) ranked WHERE id %120 =1"
$path = mysqli_query($mapcon,$mapsql) or die(mysqli_error($mapcon));
while($point = mysqli_fetch_assoc($path)) {
$row = $point["id"];
$lat = $point["latitude"];
$lon = $point["longitude"];
// Set this variable to adjust the frequence/accuracy of the path
## Data is usually in one second intervals
$time = 120;
if($row %$time == 0) {
// This is on two lines so I have a new line in the JS
echo("new google.maps.LatLng($lat, $lon),
");
}
}
}
?>
];
var hikePath = new google.maps.Polyline({
path: myHike,
geodesic: true,
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2
});
hikePath.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
I created map_php because I needed to put stuff above the start of the HTML, such as the page title for the header.
Update:
Quote:
I've tried putting $ismap = isset($_GET['h']) in the same else if on the index with no change. I'll try it again though.
Did not work. It was actually $ismap = TRUE. I ended up getting an undefined variable, $ismap, in the header. Put global before the variable and killed the whole thing. I could store it as a session variable, I suppose. See if that helps.