diff php/keygen.php @ 2510:8536e978ab6f

Work for #158
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Mon, 24 Oct 2016 10:39:20 +0100
parents d26623bd65e0
children 177cbd750610
line wrap: on
line diff
--- a/php/keygen.php	Tue Oct 18 10:33:17 2016 +0100
+++ b/php/keygen.php	Mon Oct 24 10:39:20 2016 +0100
@@ -26,7 +26,12 @@
             }
         }
     }
-    echo $xml_good;
+    $filename = "saves/save-".$key_requested.".xml";
+    $fileHandle = fopen($filename, 'w');
+    if ($fileHandle == FALSE) {
+        echo $xml_error;
+    }
+    fclose($fileHandle);
     // TODO:
     //  Generate the XML Base file and save it
     $doc_struct = new SimpleXMLElement('<waetresult/>');
@@ -34,10 +39,11 @@
     //  Add start time
     //  Add IP Address information
     //  Save the file
-    $doc_struct->asXML("saves/save-".$key_requested.".xml");
+    $doc_struct->asXML($filename);
+    echo $xml_good;
     return;
 } else {
     echo $xml_error;
     return;
 }
-?>
\ No newline at end of file
+?>