From 9da319e2a2bed9ea3fab92b4e6b799bb9eb16632 Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Mon, 1 Oct 2012 01:25:48 -0500 Subject: Fixed a few bugs with challenges, and added some debugging code (which still needs to be removed) --- do.php | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'do.php') diff --git a/do.php b/do.php index 0cb1169..f55bd61 100644 --- a/do.php +++ b/do.php @@ -5,6 +5,12 @@ include "includes/maps.php"; include "includes/db.inc.php"; include "includes/datas.php"; +//FirePHP stuff - TODO: Delete +require_once('includes/FirePHPCore/FirePHP.class.php'); +ob_start(); +$firephp = FirePHP::getInstance(true); +//FirePHP stuff - TODO: Delete + $note = false; //Auto login; @@ -117,6 +123,7 @@ if ($_GET['r'] == 'getpath') { //valid mapID? $mapID = $_GET[mapid] + 0; if (!is_int($mapID)) return; + $firephp->log($mapID, "mapID"); //the first 10 ID's reserved for challenges & tutorial. if ($mapID > 10) @@ -193,6 +200,18 @@ if ($_GET['r'] == 'getpath') { $json['bestby'] = 'no one'; } + // --------- CONTINUE EXECUTION + + $firephp->log('Got this far'); + $firephp->log($_SESSION['accepted'], '$_SESSION["accepted"]'); + + //Challenge/Tutorial? + if ($_GET['isChallenge'] == 'true') { + $firephp->log('Calling challenges'); + $json['completedChallenges'] = getCompletedChallenges($userID, $mapID, $solution, $moves, $json['path']); + $firephp->log('Challenges called!'); + } + // --------- RUSH THE PATH BACK TO THE USER ignore_user_abort(true); $encoded = json_encode($json); @@ -200,10 +219,13 @@ if ($_GET['r'] == 'getpath') { header("Content-Length: " . mb_strlen($encoded)); echo $encoded; flush(); - - // --------- CONTINUE EXECUTION - - + + //TODO: Clean this up a bit + if ($_GET['isChallenge'] == 'true') + { + return; + } + // --------- USER NOT LOGGED IN? if ($_SESSION['accepted'] !== 1) { if ($moves >= ($_SESSION[$mapID.'moves'] + 0)) { @@ -212,13 +234,9 @@ if ($_GET['r'] == 'getpath') { } return; } + // --------- USER LOGGED IN - - //Challenge/Tutorial? - if ($_GET['isChallenge'] == 'true') { - checkForCompletedChallenges($userID, $mapID, $solution, $moves, $json['path']); - return; - } + $firephp->log('Got even farther'); //Is the map still valid to score on? if (!isCurrentMap($mapID)) -- cgit v1.2.3