diff options
author | BlueRaja <BlueRaja.admin@gmail.com> | 2012-10-01 01:25:48 -0500 |
---|---|---|
committer | BlueRaja <BlueRaja.admin@gmail.com> | 2012-10-01 01:25:48 -0500 |
commit | 9da319e2a2bed9ea3fab92b4e6b799bb9eb16632 (patch) | |
tree | be4d2afabc42cfe7bb3c3db461971be90c8649a9 /do.php | |
parent | 499a426f500af74df562612675ebdb44bc465215 (diff) | |
download | pathery-9da319e2a2bed9ea3fab92b4e6b799bb9eb16632.tar.xz |
Fixed a few bugs with challenges, and added some debugging code (which still needs to be removed)
Diffstat (limited to 'do.php')
-rw-r--r-- | do.php | 38 |
1 files changed, 28 insertions, 10 deletions
@@ -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))
|