From 257e02d25a629a1b6d6fbb133b38b06dcfbc7777 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Thu, 21 Apr 2011 12:11:22 -0700 Subject: Support for shaped maps. A lot of additions and changes, specifically regarding how the map is pathed and generated. Removing some assumptions for actual code. --- app.php | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'app.php') diff --git a/app.php b/app.php index 9024184..c2db175 100644 --- a/app.php +++ b/app.php @@ -9,6 +9,86 @@ include "includes/datas.php"; //echo "working..."; +if ($_GET['act'] == "test") { + +//header('Content-Type: text/xml'); +header("Content-Type: text/plain"); + +if ($_POST['XMLRequest']) { + $string = $_POST['XMLRequest']; +} else { + $string = ' + + + + 5 + FiftyToo + 50 + + +'; +} + +$xml = simplexml_load_string($string); + +//echo $xml->APIRequest->SubmitScore->MapID; +//print_r ($xml); + + + + +$score = $xml->APIRequest[0]->SubmitScore[0]->Score; +$username = $xml->APIRequest[0]->SubmitScore[0]->Username; + +//echo $xml->getName() . "
"; +// foreach($xml->children() as $child) { +// echo $child->getName() . ": " . $child . "
"; +// } + + +//$score = 50; +$previousScore = 49; +$rank = 1; + +//Begin XML Response +$w = new XMLWriter(); +$w->openMemory(); +$w->startDocument('1.0','UTF-8'); +$w->startElement("BrainMazeAPI"); + $w->writeAttribute("version", "0.1"); + $w->startElement("APIResponse"); + $w->startElement("SubmitScore"); + $w->writeAttribute("result", "SUCCESS"); + + $w->startElement("rank"); + $w->text($rank); + $w->endElement(); + + $w->startElement("update"); + $w->text('true'); + $w->endElement(); + + $w->startElement("UsernameUsed"); + $w->text($username); + $w->endElement(); + + $w->startElement("SubmittedScore"); + $w->text($score); + $w->endElement(); + + $w->startElement("PreviousHighScore"); + $w->text($previousScore); + $w->endElement(); + + $w->endElement(); + $w->endElement(); +$w->endElement(); +echo $w->outputMemory(true); + +} + + + if ($_GET['act'] == "submit") { header('Content-Type: text/xml'); echo ' -- cgit v1.2.3