Mercurial > hg > webaudioevaluationtool
annotate keygen.php @ 1910:46fe764580fb
Fixed Feature #1270. All interfaces (except ABX) support outside-reference.
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Tue, 22 Mar 2016 12:09:08 +0000 |
parents | 1d0936cfa1d4 |
children |
rev | line source |
---|---|
nickjillings@1880 | 1 <?php |
nickjillings@1880 | 2 // This checks the key sent by the JavaScript against the current bunch of saves |
nickjillings@1880 | 3 // XML Saves location - assumes it will be saves/ |
nickjillings@1882 | 4 $saves = glob("saves/*.xml"); |
nickjillings@1880 | 5 |
nickjillings@1880 | 6 $key_requested = $_GET['key']; |
nickjillings@1880 | 7 |
nickjillings@1880 | 8 $xml_good = "<response><state>OK</state><key>".$key_requested."</key></response>"; |
nickjillings@1880 | 9 $xml_bad = "<response><state>NO</state><key>".$key_requested."</key></response>"; |
nickjillings@1884 | 10 $xml_error = "<response><state>ERROR</state><key>".$key_requested."</key></response>"; |
nickjillings@1880 | 11 if (is_array($saves)) |
nickjillings@1880 | 12 { |
nickjillings@1880 | 13 foreach($saves as $filename) { |
nickjillings@1880 | 14 $xml_string = file_get_contents($filename, FILE_TEXT); |
nickjillings@1880 | 15 $xml_object = simplexml_load_string($xml_string); |
nickjillings@1880 | 16 if ($xml_object != false) { |
nickjillings@1880 | 17 if (isset($value['key'])) |
nickjillings@1880 | 18 { |
nickjillings@1880 | 19 if ($value['key'] == $key_requested) { |
nickjillings@1880 | 20 echo $xml_bad; |
nickjillings@1880 | 21 return; |
nickjillings@1880 | 22 } |
nickjillings@1880 | 23 } |
nickjillings@1880 | 24 } |
nickjillings@1880 | 25 } |
nickjillings@1880 | 26 echo $xml_good; |
nickjillings@1880 | 27 // TODO: |
nickjillings@1880 | 28 // Generate the XML Base file and save it |
nickjillings@1882 | 29 $doc_struct = new SimpleXMLElement('<waetresult/>'); |
nickjillings@1882 | 30 $doc_struct->addAttribute("key",$key_requested); |
nickjillings@1880 | 31 // Add start time |
nickjillings@1880 | 32 // Add IP Address information |
nickjillings@1882 | 33 // Save the file |
nickjillings@1882 | 34 $doc_struct->asXML("saves/save-".$key_requested.".xml"); |
nickjillings@1880 | 35 return; |
nickjillings@1880 | 36 } else { |
nickjillings@1880 | 37 echo $xml_error; |
nickjillings@1880 | 38 return; |
nickjillings@1880 | 39 } |
nickjillings@1880 | 40 ?> |