From 2d290b23c402561ef30c1de665895c120dd79483 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Tue, 31 Jul 2012 22:34:08 -0700 Subject: Everything related to the scoreboard. New feedback page. Changed the speed of the pauses on checkpoints during a path animation. Changed how notifications are recieved. --- do.php | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'do.php') diff --git a/do.php b/do.php index 2bf6bb9..2a83751 100644 --- a/do.php +++ b/do.php @@ -5,6 +5,8 @@ include "includes/maps.php"; include "includes/db.inc.php"; include "includes/datas.php"; +$note = false; + //Auto login; include_once("globe.php"); if (!isset($_SESSION['accepted']) || $_SESSION['accepted'] <> 1) @@ -29,18 +31,39 @@ if (isset($_GET['act']) && $_GET['act'] == "getmap") { } } +// !! Depreciate? if (isset($_GET['checkachieve']) && $_GET['checkachieve'] == 'true' && $_SESSION['accepted'] == 1) { $json['notification'] = true; - $userID = $_SESSION['userID']; - //Located in includes/datas.php $note = getNotified($userID); - if ($note !== false) $json['notificationtext'] = $note; } +if ($_GET['r'] == 'reqScorePage') { + $mapID = $_GET['mapid'] + 0; + $page = $_GET['reqPage'] + 0; + if (!is_int($mapID) OR !is_int($page)) + return; + + //Include the notification text + $json = getScores($mapID, $page, 3); + $json['mapid'] = $mapID; + $json['page'] = $page; + + if ($_SESSION['accepted'] == 1) { + $userID = $_SESSION['userID']; + $note = getNotified($userID); + if ($note !== false) + $json['notificationtext'] = $note; + } + + $encoded = json_encode($json); + die($encoded); +} + + if ($_GET['r'] == 'getscores') { $mapID = $_GET['mapid'] + 0; if (!is_int($mapID)) @@ -59,12 +82,18 @@ if ($_GET['r'] == 'getsol') { $userID = $_SESSION['userID']; - if ($_SESSION['accepted'] == 1) +///// !! FIX FIX FIX FIX FIX FIX ////// + if ($_SESSION['accepted'] == 1) { $json = getSolution($userID, $mapID); - if (isset($_SESSION[$mapID.'sol']) AND $mysolution == '') { + if ($tmp['moves'] > $_SESSION[$mapID.'sol']) { + $json = $tmp; + } + } + if (isset($_SESSION[$mapID.'sol'])) { $json['solution'] = $_SESSION[$mapID.'sol']; $json['moves'] = $_SESSION[$mapID.'moves']; } + $json['mapid'] = $mapID; $encoded = json_encode($json); -- cgit v1.2.3