Mercurial > hg > webaudioevaluationtool
annotate keygen.php @ 1880:8d3c3634a9ff
Adding PHP Keygen
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Tue, 08 Mar 2016 14:35:51 +0000 |
parents | |
children | 0d6d7618f6da |
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@1880 | 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@1880 | 10 $xml_bad = "<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@1880 | 29 // Add start time |
nickjillings@1880 | 30 // Add IP Address information |
nickjillings@1880 | 31 return; |
nickjillings@1880 | 32 } else { |
nickjillings@1880 | 33 echo $xml_error; |
nickjillings@1880 | 34 return; |
nickjillings@1880 | 35 } |
nickjillings@1880 | 36 ?> |