annotate save.php @ 1437:7b4f1f54404c

MUSHRA: Slider styling across browsers so easy to see. Sliders start grey and turn white when moved. Added mushra example test
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Fri, 18 Dec 2015 12:04:04 +0000
parents 4a0c4119e00d
children 2647dd909229 b5bf2f57187c 9ee921c8cdd3
rev   line source
nickjillings@1392 1 <?php
nickjillings@1392 2 header('Access-Control-Allow-Origin: *');
nickjillings@1392 3 header("Content-type: text/xml");
nickjillings@1392 4 $postText = file_get_contents('php://input');
nickjillings@1392 5 $sha1_hash = sha1($postText);
nickjillings@1392 6 $datetime = date('ymdHis');
nickjillings@1392 7 $xmlfile = "save".$datetime."-".$sha1_hash.".xml";
nickjillings@1392 8 $fileHandle = fopen("saves/".$xmlfile, 'w');
nickjillings@1392 9 if ($fileHandle == FALSE)
nickjillings@1392 10 {
nickjillings@1392 11 // Filehandle failed
nickjillings@1392 12 $xml = '<response state="error"><message>Could not open file</message></response>';
nickjillings@1392 13 echo $xml;
nickjillings@1392 14 return;
nickjillings@1392 15 }
nickjillings@1392 16 $wbytes = fwrite($fileHandle, $postText);
nickjillings@1392 17 if ($wbytes == FALSE)
nickjillings@1392 18 {
nickjillings@1392 19 // FileWrite failed
nickjillings@1392 20 $xml = '<response state="error"><message>Could not write file "saves/'.$xmlfile.'"</message></response>';
nickjillings@1392 21 echo $xml;
nickjillings@1392 22 return;
nickjillings@1392 23 }
nickjillings@1392 24 fclose($fileHandle);
nickjillings@1392 25
nickjillings@1392 26 // Return JSON confirmation data
nickjillings@1392 27 $xml = '<response state="OK"><message>OK</message><file bytes="'.$wbytes.'">"saves/'.$xmlfile.'"</file></response>';
nickjillings@1392 28 echo $xml;
nickjillings@1392 29 ?>