From d028f04c2213bb03af98ba5e9357ae18b9ae2a65 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Tue, 23 Apr 2013 02:23:26 -0700 Subject: 404 for non-existing maps. --- .htaccess | 1 - ajax/maps.ajax.php | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.htaccess b/.htaccess index f300bce..4ee5960 100644 --- a/.htaccess +++ b/.htaccess @@ -17,7 +17,6 @@ RewriteRule (.*) http://www.mazetd.4xg.net/$1 [R,L] RewriteRule ^([a-z]+)$ /index\.php?page=$1 [QSA,NC] # GetMap Re-write -RewriteRule ^map/(.*)$ /ajax/maps\.ajax\.php?mapid=$1 [QSA,NC] RewriteRule ^a/map/(.*)$ /ajax/maps\.ajax\.php?mapid=$1 [QSA,NC] RewriteRule ^a/mapsbydate/(.*)$ /ajax/maps\.ajax\.php?getmapidsbydate=$1 [QSA,NC] diff --git a/ajax/maps.ajax.php b/ajax/maps.ajax.php index 25fbbf8..4919fb9 100644 --- a/ajax/maps.ajax.php +++ b/ajax/maps.ajax.php @@ -19,6 +19,10 @@ if (isset($_GET['mapid'])) { $mapID = $tmp[0] * 1; if (!is_int($mapID)) exit; $map = getMapObjectByID($mapID); + if ($map == null) { + header("Status: 404 Not Found"); + exit; + } sendCacheHeaders(); echo json_encode($map); exit; @@ -44,6 +48,7 @@ function getMapObjectByID($mapID) { $result = mysql_query($sql); if (mysql_num_rows($result) > 0) { list($code, $name, $mapExpireTime) = mysql_fetch_row($result); + if ($code == '') return null; $map = new map($code, $mapID); $map->name = $name; $map->dateExpires = strtotime($mapExpireTime); -- cgit v1.2.3