예제 #1
0
파일: index.php 프로젝트: uhtoff/eCRF
$loggedIn = false;
$trial = new eCRF($page);
// Create trial object
if (isset($_SESSION['user']) && $_SESSION['user']) {
    // Add current user to trial object (if they exist)
    $user =& $_SESSION['user'];
    $loggedIn = $trial->addUser($user);
    // On adding user it checks to see if user has been expired and if not renews their last logon time
    if (!$loggedIn) {
        unset($_SESSION['user']);
        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');