diff options
Diffstat (limited to 'includes/datas.php')
-rw-r--r-- | includes/datas.php | 18 |
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; } /** |