diff options
author | BlueRaja <BlueRaja.admin@gmail.com> | 2012-10-01 21:12:59 -0500 |
---|---|---|
committer | BlueRaja <BlueRaja.admin@gmail.com> | 2012-10-01 21:12:59 -0500 |
commit | 6b490faf136fedaee9759a1b6164a90dcdb0f408 (patch) | |
tree | b668c9e3703a2afb44c53881d487923463f796a8 /includes/datas.php | |
parent | 7a60127a4b17e74860a80a62cdfc53ca37cbff19 (diff) | |
download | pathery-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.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; } /** |