Mercurial > hg > webaudioevaluationtool
comparison save.php @ 607:328f24798462 multiple-tests-concatenation
working, hacked together.
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 11 Mar 2016 16:49:47 +0000 |
parents | 6833d8c2b52e |
children | 0256f3748b27 |
comparison
equal
deleted
inserted
replaced
583:6833d8c2b52e | 607:328f24798462 |
---|---|
1 <?php | 1 <?php |
2 error_reporting(0); | 2 error_reporting(0); |
3 try{ | 3 try{ |
4 date_default_timezone_get(); | 4 date_default_timezone_get(); |
5 } | 5 } |
6 catch(Exception $e){ | 6 catch(Exception $e){ |
7 date_default_timezone_set('UTC'); // Sets to UTC if not specified anywhere in .ini | 7 date_default_timezone_set('UTC'); // Sets to UTC if not specified anywhere in .ini |
8 } | 8 } |
9 $saveFilenamePrefix = isset($_GET['saveFilenamePrefix']) ? $_GET['saveFilenamePrefix'].'-' : ''; | |
9 header('Access-Control-Allow-Origin: *'); | 10 header('Access-Control-Allow-Origin: *'); |
10 header("Content-type: text/xml"); | 11 header("Content-type: text/xml"); |
11 $postText = file_get_contents('php://input'); | 12 $postText = file_get_contents('php://input'); |
12 $sha1_hash = sha1($postText); | 13 $sha1_hash = sha1($postText); |
13 $datetime = date('ymdHis'); | 14 $datetime = date('ymdHis'); |
14 $xmlfile = "save".$datetime."-".$sha1_hash.".xml"; | 15 $xmlfile = $saveFilenamePrefix."save".$datetime."-".$sha1_hash.".xml"; |
15 $fileHandle = fopen("saves/".$xmlfile, 'w'); | 16 $fileHandle = fopen("saves/".$xmlfile, 'w'); |
16 if ($fileHandle == FALSE) | 17 if ($fileHandle == FALSE) |
17 { | 18 { |
18 // Filehandle failed | 19 // Filehandle failed |
19 $xml = '<response state="error"><message>Could not open file</message></response>'; | 20 $xml = '<response state="error"><message>Could not open file</message></response>'; |