comparison keygen.php @ 1241:879b0b20b20c

WIP. Adding intermediate save options. Will require mass editing of save engine as it stands, so still WIP (note: this version will not work on python server).
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Wed, 09 Mar 2016 11:12:06 +0000
parents a54422902bbd
children 5b125fb39142
comparison
equal deleted inserted replaced
1240:33e684e3ea81 1241:879b0b20b20c
1 <?php 1 <?php
2 // This checks the key sent by the JavaScript against the current bunch of saves 2 // This checks the key sent by the JavaScript against the current bunch of saves
3 // XML Saves location - assumes it will be saves/ 3 // XML Saves location - assumes it will be saves/
4 $saves = glob("../saves/*.xml"); 4 $saves = glob("saves/*.xml");
5 5
6 $key_requested = $_GET['key']; 6 $key_requested = $_GET['key'];
7 7
8 $xml_good = "<response><state>OK</state><key>".$key_requested."</key></response>"; 8 $xml_good = "<response><state>OK</state><key>".$key_requested."</key></response>";
9 $xml_bad = "<response><state>NO</state><key>".$key_requested."</key></response>"; 9 $xml_bad = "<response><state>NO</state><key>".$key_requested."</key></response>";
24 } 24 }
25 } 25 }
26 echo $xml_good; 26 echo $xml_good;
27 // TODO: 27 // TODO:
28 // Generate the XML Base file and save it 28 // Generate the XML Base file and save it
29 $doc_struct = new SimpleXMLElement('<waetresult/>');
30 $doc_struct->addAttribute("key",$key_requested);
29 // Add start time 31 // Add start time
30 // Add IP Address information 32 // Add IP Address information
33 // Save the file
34 $doc_struct->asXML("saves/save-".$key_requested.".xml");
31 return; 35 return;
32 } else { 36 } else {
33 echo $xml_error; 37 echo $xml_error;
34 return; 38 return;
35 } 39 }