From a81858ef82af7469e843e2e6a84ca220330003e3 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Tue, 21 May 2013 16:03:08 -0700 Subject: Some code cleanup; fixed a $mydomain missing. --- do.php | 43 ++++++------------------------------------- 1 file changed, 6 insertions(+), 37 deletions(-) (limited to 'do.php') diff --git a/do.php b/do.php index 25a663d..41b1133 100644 --- a/do.php +++ b/do.php @@ -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); -- cgit v1.2.3