summaryrefslogtreecommitdiffstats
path: root/do.php
diff options
context:
space:
mode:
authorBlueRaja <BlueRaja.admin@gmail.com>2013-01-24 03:04:26 -0600
committerBlueRaja <BlueRaja.admin@gmail.com>2013-01-24 03:04:26 -0600
commitb6dc90e3f658a8201424aafec8e304c74d981022 (patch)
tree08440455657f7d657c6659ae41614bafbd8e0cbc /do.php
parent1e4045408872ac9bc83417f9c58ca740e54fff3d (diff)
downloadpathery-b6dc90e3f658a8201424aafec8e304c74d981022.tar.xz
Added a 'mapExpireTime' column to mapOfTheDay table, to simply a lot of SQL
Diffstat (limited to 'do.php')
-rw-r--r--do.php26
1 files changed, 6 insertions, 20 deletions
diff --git a/do.php b/do.php
index 1009a91..a43b4ee 100644
--- a/do.php
+++ b/do.php
@@ -372,30 +372,16 @@ die(json_encode($json));
function isCurrentMap($mapID) {
- // TODO: change methodology
include_once('./includes/sqlEmbedded.php');
- $sql = "SELECT maps.ID
+ $sql = "SELECT mapID
FROM `mapOfTheDay`
- LEFT JOIN `maps` ON maps.ID = `mapID`
- WHERE
- `mapID` = '$mapID' AND
- (
- (
- DATEDIFF(CURDATE(), mapOfTheDay.mapDate) < 1 AND
- `mapType` IN (1, 2, 3, 4)
- )
- OR
- (
- DATEDIFF(CURDATE(), mapOfTheDay.mapDate) < 2 AND
- `mapType` IN (5)
- )
- )
+ WHERE `mapID` = '$mapID'
+ AND mapExpireTime > NOW()
+ LIMIT 1
";
+
$result = mysql_query($sql) or die(mysql_error());
- if (mysql_num_rows($result) == 0)
- return false;
- else
- return true;
+ return (mysql_num_rows($result) != 0);
}
//Very simple, confirm that all targets are reachable.