Mercurial > hg > webaudioevaluationtool
comparison save.php @ 1939:7c846e19725f
Merge
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Tue, 08 Mar 2016 14:44:14 +0000 |
parents | 94e57a566167 |
children | 83b439322229 |
comparison
equal
deleted
inserted
replaced
1938:fc813ed8c527 | 1939:7c846e19725f |
---|---|
1 <?php | 1 <?php |
2 error_reporting(0); | |
3 try{ | |
4 date_default_timezone_get(); | |
5 } | |
6 catch(Exception $e){ | |
7 date_default_timezone_set('UTC'); // Sets to UTC if not specified anywhere in .ini | |
8 } | |
2 header('Access-Control-Allow-Origin: *'); | 9 header('Access-Control-Allow-Origin: *'); |
3 header("Content-type: text/xml"); | 10 header("Content-type: text/xml"); |
4 $postText = file_get_contents('php://input'); | 11 $postText = file_get_contents('php://input'); |
5 $sha1_hash = sha1($postText); | 12 $sha1_hash = sha1($postText); |
6 $datetime = date('ymdHis'); | 13 $datetime = date('ymdHis'); |
12 $xml = '<response state="error"><message>Could not open file</message></response>'; | 19 $xml = '<response state="error"><message>Could not open file</message></response>'; |
13 echo $xml; | 20 echo $xml; |
14 return; | 21 return; |
15 } | 22 } |
16 $wbytes = fwrite($fileHandle, $postText); | 23 $wbytes = fwrite($fileHandle, $postText); |
17 if ($wbytes == FALSE) | 24 if ($wbytes === FALSE) |
18 { | 25 { |
19 // FileWrite failed | 26 // FileWrite failed |
20 $xml = '<response state="error"><message>Could not write file "saves/'.$xmlfile.'"</message></response>'; | 27 $xml = '<response state="error"><message>Could not write file "saves/'.$xmlfile.'"</message></response>'; |
21 echo $xml; | 28 echo $xml; |
22 return; | 29 return; |