diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2013-05-21 16:03:08 -0700 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2013-05-21 16:03:08 -0700 |
commit | a81858ef82af7469e843e2e6a84ca220330003e3 (patch) | |
tree | 9a2e9b3fccdb1ad5964b18593d2214ed1def3904 /do.php | |
parent | 329cc1f9b6657ce580b3a297e39a7cd259a62537 (diff) | |
download | pathery-a81858ef82af7469e843e2e6a84ca220330003e3.tar.xz |
Some code cleanup; fixed a $mydomain missing.
Diffstat (limited to 'do.php')
-rw-r--r-- | do.php | 43 |
1 files changed, 6 insertions, 37 deletions
@@ -123,7 +123,8 @@ if ($_GET['r'] == 'getpath') { // Enables the ability to discover an exact duplicate solution.
$solution = formSolution($_GET['solution']);
- $userID = $_SESSION['userID'] + 0;
+ $userID = 0;
+ if ($accepted) $userID = $_SESSION['userID'] + 0;
//valid mapID?
$mapID = $_GET['mapid'] + 0;
@@ -252,50 +253,20 @@ if ($_GET['r'] == 'getpath') { // return;
//} //x
- //TODO: Delete the below?
- //TODO: I changed this; note these changes before re-applying the above.
- //Challenge/Tutorial?
-/* if ($mapID <= 10 AND $_GET['isChallenge'] = 'true') {
- $json['error'][] = 'executed as a challenge';
-
- //This will allow me to give insentive to logging in.
- // So that they don't have to do the tutorial twice.
- if ($mapID == 5 && $moves == 75 && $accepted == false) {
- $_SESSION['preCompletedTutorial'] = true;
- $_SESSION['preCompletedTutorialNotified'] = false;
- }
- if ($accepted == false) {
- if ($debug == true) {
- echo json_encode($json);
- }
- exit;
- }
- //if ($accepted == false) die(json_encode($json));
- //TODO: Where's $paths coming from?
- getCompletedChallenges($userID, $mapID, $solution, $moves, $paths);
- //die(json_encode($json));
- }
- */
// --------- USER NOT LOGGED IN?
- if ($_SESSION['accepted'] !== 1) {
+ if (!$accepted) {
if ($moves >= ($_SESSION[$mapID.'moves'] + 0)) {
$_SESSION[$mapID.'moves'] = $moves;
$_SESSION[$mapID.'sol'] = $solution;
}
- return;
+ exit;
}
+ // ---------- NO GUESTS BEYOND THIS POINT
// ---------- CLOSING THE SESSION $_SESSION WILL NO LONGER WORK FOR WRITING
session_write_close();
- //Now that is done, we can easily do whatever we want - Like, send any emails that there might be.
- //TODO: Move to process.php!
- //include_once('./includes/emails.php');
- //SendQueuedEmail();
- $json['error'][] = 'user is logged in';
- // --------- USER LOGGED IN
-
//Is the map still valid to score on?
if (!isCurrentMap($mapID)) return;
@@ -340,9 +311,7 @@ if ($_GET['r'] == 'getpath') { $json['error'][] = "Involved data: ('$userID', '$mapID', '$solution', '$moves')";
// --------- APPLY ACHIEVEMENTS
-
- if ($checkcp)
- applyAchievements($userID, 1);
+ if ($checkcp) applyAchievements($userID, 1);
if ($checkcm) {
applyAchievements($userID, 2);
applyAchievements($userID, 3);
|