Mercurial > hg > webaudioevaluationtool
comparison php/save.php @ 3120:53d701288da5
Create new php config to allow saves to be stored outside of web scope
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Wed, 18 Jul 2018 16:47:07 +0100 |
parents | 385bb2e03ab7 |
children | edd536f01e4b |
comparison
equal
deleted
inserted
replaced
3119:aa4503f8c630 | 3120:53d701288da5 |
---|---|
37 $update = false; | 37 $update = false; |
38 if (isset($_GET["update"])) { | 38 if (isset($_GET["update"])) { |
39 $update = $_GET["update"] == "update"; | 39 $update = $_GET["update"] == "update"; |
40 } | 40 } |
41 | 41 |
42 $saveLocation = getSaveLocation(); | |
43 | |
42 if ($update) { | 44 if ($update) { |
43 $filename = '../saves/update-'.$saveFilenamePrefix.$file_key.".xml"; | 45 $filename = $saveLocation.'update-'.$saveFilenamePrefix.$file_key.".xml"; |
44 } else { | 46 } else { |
45 $filename = '../saves/'.$saveFilenamePrefix.$file_key.".xml"; | 47 $filename = $saveLocation.$saveFilenamePrefix.$file_key.".xml"; |
46 } | 48 } |
47 | 49 |
48 if (!file_exists($filename)) { | 50 if (!file_exists($filename)) { |
49 die('<response state="error"><message>Could not find save</message></response>'); | 51 die('<response state="error"><message>Could not find save</message></response>'); |
50 } | 52 } |
142 // Return XML confirmation data | 144 // Return XML confirmation data |
143 $xml = '<response state="OK"><message>OK</message><file bytes="'.$wbytes.'">"'.$filename.'"</file></response>'; | 145 $xml = '<response state="OK"><message>OK</message><file bytes="'.$wbytes.'">"'.$filename.'"</file></response>'; |
144 echo $xml; | 146 echo $xml; |
145 | 147 |
146 if (!$update) { | 148 if (!$update) { |
147 unlink('../saves/update-'.$saveFilenamePrefix.$file_key.".xml"); | 149 unlink($saveLocation.'update-'.$saveFilenamePrefix.$file_key.".xml"); |
148 } | 150 } |
149 ?> | 151 ?> |