From 6b490faf136fedaee9759a1b6164a90dcdb0f408 Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Mon, 1 Oct 2012 21:12:59 -0500 Subject: Completed an ugly but functional draft of the challenge-listing page --- includes/datas.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'includes/datas.php') 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; } /** -- cgit v1.2.3