header("Location:index.php?expire=1"); exit; } if (!isset($_GET['keepData']) && $trial->user->isLinked()) { $trial->addRecord(); $complete = $trial->checkComplete('core'); if (!$complete) { $trial->record->deleteAllData($user->getID(), 'Incomplete Randomisation', true); $_SESSION['error'] = "Your partially entered randomisation data has been deleted. Please note the new trial ID when you go to re-enter."; } $trial->user->unlinkRecord(); // Unlink user from any records } $trial->addRecord(); } $include = $trial->checkPageLogin($page); // Generate correct include file, assuming user has correct privilege if ($include == 'logout') { $loggedIn = $include = false; $_SESSION['message'] = "You have been successfully logged out."; header('Location:index.php'); exit; } $trial->writeHead($page); echo "<body>"; echo "<div id=\"wrap\""; if (is_null($page) || $page == 'logout') { echo " class=\"background\""; } echo ">"; $trial->writeNavBar();
throw new Exception("Your session has timed out, please log in again.", 1); } } else { throw new Exception("Your session has timed out, please log in again.", 1); } if (!$trial->addRecord()) { // Bind a record to the trial, if it fails then throw exception throw new Exception("No record is linked with this user, please try selecting a different record."); } if ($trial->user->isLocal()) { if ($trial->record->getCentre() != $trial->user->getCentre()) { // Ensure that a 'local' user isn't trying to manipulate someone else's record throw new Exception("You have tried to manipulate a record from another centre."); } } if ($trial->checkPageLogin($page)) { // Check that the user has the privilege to access this page switch ($_POST['request']) { case 'addFlag': $flag = $trial->addFlagInput($_POST); // Add form input to create a new flag if ($flag) { // If a new flag was produced, return it echo json_encode(array("message" => "Flag successfully added", "flag" => $flag)); } else { // Otherwise throw an error throw new Exception("Flag form not completely filled in, please try again."); } break; case 'clearFlag': $flag = new Flag($_POST['flag_id']);