diff options
author | BlueRaja <BlueRaja.admin@gmail.com> | 2013-01-24 03:04:26 -0600 |
---|---|---|
committer | BlueRaja <BlueRaja.admin@gmail.com> | 2013-01-24 03:04:26 -0600 |
commit | b6dc90e3f658a8201424aafec8e304c74d981022 (patch) | |
tree | 08440455657f7d657c6659ae41614bafbd8e0cbc /do.php | |
parent | 1e4045408872ac9bc83417f9c58ca740e54fff3d (diff) | |
download | pathery-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.php | 26 |
1 files changed, 6 insertions, 20 deletions
@@ -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.
|