comparison save.php @ 589:055f9763fada Dev_main

Session now performs intermediate saves on each advanceState trigger (page completions, survey completions). Specification projectReturn now "local" for presentation saving
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Wed, 09 Mar 2016 12:41:26 +0000
parents 6833d8c2b52e
children 0794fefefbd8
comparison
equal deleted inserted replaced
587:0d6d7618f6da 589:055f9763fada
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 header('Access-Control-Allow-Origin: *'); 9 header('Access-Control-Allow-Origin: *');
10 header("Content-type: text/xml"); 10 header("Content-type: text/xml");
11 $postText = file_get_contents('php://input'); 11 $postText = file_get_contents('php://input');
12 $sha1_hash = sha1($postText); 12 $file_key = $_GET['key'];
13 $datetime = date('ymdHis'); 13 $filename = "saves/save-".$file_key.".xml";
14 $xmlfile = "save".$datetime."-".$sha1_hash.".xml"; 14 $fileHandle = fopen($filename, 'w');
15 $fileHandle = fopen("saves/".$xmlfile, 'w');
16 if ($fileHandle == FALSE) 15 if ($fileHandle == FALSE)
17 { 16 {
18 // Filehandle failed 17 // Filehandle failed
19 $xml = '<response state="error"><message>Could not open file</message></response>'; 18 $xml = '<response state="error"><message>Could not open file</message></response>';
20 echo $xml; 19 echo $xml;