Exemple #1
0
        $partsession_id = $_POST['partsession_id'];
        //get the session
        $session = $_POST['session'];
        $exp_data = $_POST['exp_data'];
        //get the experimental data
        $exp_data = stripslashes($exp_data);
        //write the data to file
        $file = fopen($fullfilename, 'w+');
        fwrite($file, $exp_data);
        fclose($file);
        //save to database
        if ($exppart_id != 0) {
            if (!isset($session)) {
                $session = 0;
            }
            $data = array('xmldata' => $exp_data, 'exppart_id' => $exppart_id, 'partsession_id' => $partsession_id, 'session' => $session, 'filename' => $filename, 'IP' => $ip, 'user_agent' => $useragent);
            $results = $wpdb->insert('exp_result', $data, array('%s', '%s', '%s'));
            // update session to finished
            if ($current_user->user_login != 'participant') {
                $results = $wpdb->update('exp_partsession', array('finished' => 'yes'), array('partsession_id' => $partsession_id), array('%s'), array('%d'));
                $results = $wpdb->update('exp_partsession', array('session_run' => $session), array('partsession_id' => $partsession_id), array('%d'), array('%d'));
                $results = $wpdb->update('exp_expparticipant', array('cur_session' => $session + 1), array('exppart_id' => $exppart_id), array('%d'), array('%d'));
                if (check_finished($exppart_id)) {
                    $results = $wpdb->update('exp_expparticipant', array('finished' => 1), array('exppart_id' => $exppart_id), array('%d'), array('%d'));
                }
            }
        }
    }
} catch (Exception $e) {
    echo "error";
}
Exemple #2
0
if ($userObject->has_role('Staff') and check_staff_modules($moduleID, $userObject)) {
    // No further security checks.
} else {
    // Treat as student with extra security checks.
    // Check for additional password on the paper.
    check_paper_password($propertyObj->get_password(), $string, $mysqli);
    // Check time security.
    check_datetime($propertyObj->get_start_date(), $propertyObj->get_end_date(), $string, $mysqli);
    //Check room security.
    $low_bandwidth = check_labs($propertyObj->get_paper_type(), $propertyObj->get_labs(), $current_address, $propertyObj->get_password(), $string, $mysqli);
    // Check modules if the user is a student and the paper is not formative.
    $attempt = check_modules($userObject, $modIDs, $propertyObj->get_calendar_year(), $string, $mysqli);
    // Check for any metadata security restrictions.
    check_metadata($paperID, $userObject, $modIDs, $string, $mysqli);
    // Check if the student has clicked 'Finish'.
    check_finished($propertyObj, $userObject, $string, $mysqli);
}
// Get lab info used in log metadata.
$lab_factory = new LabFactory($mysqli);
if ($lab_object = $lab_factory->get_lab_based_on_client($current_address)) {
    $lab_name = $lab_object->get_name();
    $lab_id = $lab_object->get_id();
}
/*
* Set the default state
*/
$log_metadata = null;
$current_screen = 1;
$is_fire_alarm = (isset($_POST['fire_alarm']) and $_POST['fire_alarm'] == '1');
$summative_exam_session_started = false;
//lab timing stated by invigilators