summaryrefslogtreecommitdiffstats
path: root/includes/datas.php
diff options
context:
space:
mode:
authorBlueRaja <BlueRaja.admin@gmail.com>2012-10-01 21:12:59 -0500
committerBlueRaja <BlueRaja.admin@gmail.com>2012-10-01 21:12:59 -0500
commit6b490faf136fedaee9759a1b6164a90dcdb0f408 (patch)
treeb668c9e3703a2afb44c53881d487923463f796a8 /includes/datas.php
parent7a60127a4b17e74860a80a62cdfc53ca37cbff19 (diff)
downloadpathery-6b490faf136fedaee9759a1b6164a90dcdb0f408.tar.xz
Completed an ugly but functional draft of the challenge-listing page
Diffstat (limited to 'includes/datas.php')
-rw-r--r--includes/datas.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/includes/datas.php b/includes/datas.php
index e8d5871..fa8bfb0 100644
--- a/includes/datas.php
+++ b/includes/datas.php
@@ -947,7 +947,23 @@ function loadChallengesForMap($mapIdUnsanitized, $userIdUnsanitized)
*/
function loadChallengeListing($userIdUnsanitized)
{
- //TODO: Implement
+ $userID = mysql_escape_string($userIdUnsanitized);
+ $sql = "
+ SELECT maps.ID AS mapID, maps.challengeTier, maps.challengeName, challengeSolutions.dateSolved
+ FROM maps
+ INNER JOIN challenges ON maps.ID = challenges.mapID
+ LEFT JOIN challengeSolutions ON challenges.ID = challengeSolutions.challengeID
+ WHERE maps.isChallenge = 1 AND challenges.enabled = 1
+ AND (challengeSolutions.userID IS NULL OR challengeSolutions.userID = '$userID')
+ AND maps.challengeTier <= (SELECT challengeTier FROM users WHERE users.ID = '$userID')
+ ORDER BY maps.challengeTier, maps.challengeSuborder, challenges.ordering
+ ";
+
+ $result = mysql_query($sql);
+ echo mysql_error();
+ if (mysql_num_rows($result) >= 1)
+ return $result;
+ return NULL;
}
/**