sessionname); session_start(); // essential functions require_once "subs.php"; dbConnect(); // read SCOInstanceID $SCOInstanceID = $_POST['SCOInstanceID']; $data = json_decode ($_POST['data'],true); if (! is_array($data)) { $data = array($data); } // iterate through the data elements foreach ($data as $varname => $varvalue) { // save data to the 'scormvars' table writeElement($varname,$varvalue); // special cases - set appropriate values in the LMS tables when they are set by the course if ($varname == "cmi.core.score.raw") { setInLMS('TestScore',$varvalue); } if ($varname == "cmi.core.lesson_status") { setInLMS('Finished',$varvalue); } } mysqli_close($link); // return value to the calling program print "true"; ?>