function increment_transaction() { /* Increments transaction for session */ // increments transaction $newSeq = $_SESSION['transaction_num'] + 1; // updates transaction num for session edit_session(array('transaction' => $newSeq), true, 'override'); }
function processSurvey() { $_REQUEST['action'] = 'connect'; unset($_REQUEST['action']); unset($_REQUEST['prevPage']); integrityCheck(); //If you are using the scales, then these lines collapse multiple-item questions //into a single-item score //collapseScale('rps', 9); //collapseScale('nfc', 9); ksort($_REQUEST); edit_session($_REQUEST, false, 'post'); }
//This is the post-transaction offer page. // start session session_start(); include_once 'functions.php'; $sid = intval($_COOKIE['sid']); if (array_key_exists('pre_email', $_REQUEST)) { $email = htmlentities($_REQUEST['pre_email'], ENT_QUOTES); if (USE_MTURK) { $mturk_id = htmlentities($_REQUEST['pre_mturk_id'], ENT_QUOTES); } else { $mturk_id = false; } $age = intval($_REQUEST['pre_age']); $songId = intval($_REQUEST['songId']); $zip = '' . intval($_REQUEST['pre_zip']); edit_session(array('pre_email' => $email, 'sid' => $sid, 'pre_zip' => $zip, 'pre_mturk_id' => $mturk_id, 'pre_age' => $age, 'songId' => intval($_REQUEST['songId'])), false, 'pre'); } else { $email = get_from_session($sid, 'pre_email'); $songId = get_from_session($sid, 'songId', true); } //get the treatment and its properties for the current session $treatment = getTreatmentForSession($sid); $box_value = ''; // get $opt and $prepop based on code $group_code = $_SESSION['group_code']; // get $opt from code $opt = getOptionFromCode($group_code); // get prepop from code $prepop = getPrepopFromCode($group_code); if ($prepop == 'fill') { $box_value = htmlentities($email, ENT_QUOTES);
$workerId = 'test_mturk_id'; if (array_key_exists('treatmentId', $_REQUEST)) { $treatmentId = intval($_REQUEST['treatmentId']); } } if (array_key_exists('hitId', $_REQUEST)) { $hitId = $_REQUEST['hitId']; } if (array_key_exists('workerId', $_REQUEST)) { $workerId = $_REQUEST['workerId']; } //if($hitId && $workerId) if ($workerId) { $sid = enter_new_session($hitId, $workerId); if ($treatmentId > 0) { edit_session(array('treatment_id' => $treatmentId), false, 'override'); } if (!$sid) { die("You have already completed a task on this site. You may not participate multiple times. Sorry for the inconvenience."); } } else { die("This page can only be accessed through the Mechanical Turk HIT. Please accept the task and click the link to this page from there."); } } else { // Create new local session $sid = enter_new_session($hitId, $workerId); } } include_once 'redirector.php'; ?>
<?php session_start(); include_once 'functions.php'; $participantGroup = $_GET['participant_group']; // gets entered num $consent = $_GET['consent']; if ($consent) { edit_session(array('consent' => 'yes'), true, 'override'); setSessionGroup($participantGroup); redir('intro.php'); } else { redir('consent.php'); }
// EMAIL if (isset($_SESSION['mediaId'])) { // array of mediaId's that need to be sent $mediaToSend = $_SESSION['mediaId']; if (count($mediaToSend) > 0) { // there are some emails that need to be sent //echo "need to send ".count($mediaToSend)." emails</br>"; sendEmail(); } } if ($_SESSION['postEmail']) { $email = htmlentities($_SESSION['postEmail'], ENT_QUOTES); if (!has_seen_negative_option($sid)) { //first time submitting $newData = array('post_email' => $email, 'sid' => $sid, 'email_sent' => var_export($email_sent, true)); edit_session($newData, true, 'post'); } else { //record attempt to change recordCheater($sid, $email_sent ? "true" : "false"); } } function sendEmail() { global $sid; $to = getEmailForCurrentSession(); //from functions.php if ($to == 'undef') { $to = str_replace("'", '', $_SESSION['postEmail']); } $email_sent = true; foreach ($_SESSION['mediaId'] as $id => $mediaId) {
<?php //This file is the middleman for AJAX JQuery calls to access the php function edit_session include 'functions.php'; edit_session($_GET, true, 'look');