diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2013-02-17 03:00:27 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2013-02-17 03:00:27 -0800 |
commit | c4f988879356b3f5d54e6ef189e907540629c827 (patch) | |
tree | 57c97ed0fda6896d25429871fd5894648802bc1a /ajax/maps.ajax.php | |
parent | ebbafff46aec8d47159489b1b6a46e6ce1f71eb8 (diff) | |
download | pathery-c4f988879356b3f5d54e6ef189e907540629c827.tar.xz |
Map names
Diffstat (limited to 'ajax/maps.ajax.php')
-rw-r--r-- | ajax/maps.ajax.php | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/ajax/maps.ajax.php b/ajax/maps.ajax.php index a5d72f2..31c041c 100644 --- a/ajax/maps.ajax.php +++ b/ajax/maps.ajax.php @@ -1,16 +1,16 @@ <?
ob_start("ob_gzhandler");
-//CACHE HEADERS
include('../includes/mapclass.php');
include('../includes/maps.php');
-//RETURN MAP w/ CACHE HEADERS
+//Remove the ending .js
$tmp = explode(".", $_GET['mapid']);
$mapID = $tmp[0] * 1;
if (!is_int($mapID)) exit;
-$map = new map(getMapCode($mapID), $mapID);
+//$map = new map(getMapCode($mapID), $mapID);
+$map = getMapObjectByID($mapID);
//62 days
$expires = 62*24*60*60;
@@ -19,4 +19,24 @@ header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT'); header("Content-type: text/javascript");
echo json_encode($map);
+function getMapObjectByID($mapID) {
+ include_once('../includes/sqlEmbedded.php');
+ include_once('../includes/maps.php');
+ $sql = "SELECT `code`, `name`
+ FROM `maps`
+ WHERE `ID` = '$mapID'
+ ";
+ $result = mysql_query($sql);
+ if (mysql_num_rows($result) > 0) {
+ list($code, $name) = mysql_fetch_row($result);
+ $map = new map($code, $mapID);
+ $map->name = $name;
+ //$map->name = "bobs";
+ return $map;
+ }
+}
+
+
+
+
?>
\ No newline at end of file |