Mercurial > hg > webaudioevaluationtool
diff save.php @ 608:0256f3748b27 multiple-tests-concatenation
Merge
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sat, 12 Mar 2016 15:32:30 +0000 |
parents | 328f24798462 0794fefefbd8 |
children |
line wrap: on
line diff
--- a/save.php Fri Mar 11 16:49:47 2016 +0000 +++ b/save.php Sat Mar 12 15:32:30 2016 +0000 @@ -1,19 +1,12 @@ <?php - error_reporting(0); - try{ - date_default_timezone_get(); - } - catch(Exception $e){ - date_default_timezone_set('UTC'); // Sets to UTC if not specified anywhere in .ini - } + // error_reporting(0); $saveFilenamePrefix = isset($_GET['saveFilenamePrefix']) ? $_GET['saveFilenamePrefix'].'-' : ''; header('Access-Control-Allow-Origin: *'); header("Content-type: text/xml"); $postText = file_get_contents('php://input'); - $sha1_hash = sha1($postText); - $datetime = date('ymdHis'); - $xmlfile = $saveFilenamePrefix."save".$datetime."-".$sha1_hash.".xml"; - $fileHandle = fopen("saves/".$xmlfile, 'w'); + $file_key = $_GET['key']; + $filename = 'saves/'.$saveFilenamePrefix.'save-'.$file_key.".xml"; + $fileHandle = fopen($filename, 'w'); if ($fileHandle == FALSE) { // Filehandle failed @@ -25,13 +18,13 @@ if ($wbytes === FALSE) { // FileWrite failed - $xml = '<response state="error"><message>Could not write file "saves/'.$xmlfile.'"</message></response>'; + $xml = '<response state="error"><message>Could not write file "'.$filename.'"</message></response>'; echo $xml; return; } fclose($fileHandle); - // Return JSON confirmation data - $xml = '<response state="OK"><message>OK</message><file bytes="'.$wbytes.'">"saves/'.$xmlfile.'"</file></response>'; + // Return XML confirmation data + $xml = '<response state="OK"><message>OK</message><file bytes="'.$wbytes.'">"'.$filename.'"</file></response>'; echo $xml; -?> +?> \ No newline at end of file