summaryrefslogtreecommitdiffstats
path: root/do.php
diff options
context:
space:
mode:
Diffstat (limited to 'do.php')
-rw-r--r--do.php38
1 files changed, 28 insertions, 10 deletions
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))