foreach ($password_reset_pairs as $i => $pair) { $q = isset($_POST[$pair['question']]) ? $_POST[$pair['question']] : null; $a = isset($_POST[$pair['answer']]) ? $_POST[$pair['answer']] : null; $password_reset_data[$i]['question'] = $q; $password_reset_data[$i]['answer'] = $a; if (empty($q) || empty($a)) { // Invalid responses addSessionAlert("Invalid password reset values for question {$i}"); $all_valid = false; } else { $a = hashSecurityAnswer($a); $loggedInUser->updatePasswordReset($pair['question'], $pair['answer'], $q, $a); } } if ($all_valid) { addSessionMessage("Password recovery questions updated!", 'success'); } if ($valid && $all_valid) { //THEY ARE CONSENTED, SET ACCOUNT ACTIVE $loggedInUser->setActive(); //REDIRECT TO THE DASHBOARD include "models/inc/surveys.php"; header("Location: dashboard/survey.php?url=" . urlencode($surveys[0]["survey_link"])); //survey link of first survey exit; } } $pg_title = "Account Setup | {$websiteName}"; $body_classes = "login register setup"; include "models/inc/gl_header.php"; ?>
$loggedInUser = new RedcapPortalUser($auth->new_user_id); } else { $errors[] = !empty($auth->error) ? $auth->error : 'Unknown error creating user'; } } else { //ADD THEIR EMAIL , NAME TO CONTACT DB $auth->createNewUser($password, FALSE); $reason = ""; if (!in_array($zip, $eligible_zips) && !array_key_exists($city, $city_zips)) { $reason = lang("ACCOUNT_NOT_IN_GEO"); } elseif (!$nextyear) { $reason = lang("ACCOUNT_TOO_NEW_GEO"); } elseif (!$oldenough || $actualage < 18) { $reason = lang("ACCOUNT_TOO_YOUNG"); } addSessionMessage(lang("ACCOUNT_NOT_YET_ELIGIBLE", array("")), "notice"); } //CLEAN UP unset($fname, $lname, $email, $zip, $city); } } // Add alerts to session for display foreach ($errors as $error) { addSessionAlert($error); } } elseif (!empty($_GET['activation']) && !empty($_GET['uid'])) { $uid = $_GET['uid']; $activation = $_GET['activation']; $newuser = new RedcapPortalUser($uid); if ($newuser->isEmailTokenValid($activation)) { //SET EMAIL = VERIFIED
$success_msg .= "Get the whole fruit basket!<br> <a class='takenext' href='{$nextlink}'>Take the next '" . $surveys[$index + 1]["instrument_label"] . "' survey now!</a>"; } else { $success_msg .= "Congratulations, you got the whole fruit basket! <br/>See how your data compares to others in your area."; } addSessionMessage($success_msg, "success"); } } } if (isset($_GET["survey_pause"])) { //IF NO URL PASSED IN THEN REDIRECT BACK $surveyid = $_GET["survey_pause"]; foreach ($surveys as $index => $instrument_event) { if ($instrument_event["instrument_name"] != $surveyid) { continue; } addSessionMessage("Come back later to complete the '" . $instrument_event["instrument_label"] . "' Survey.<br> And collect your reward : <span class='fruit " . $fruits[$index] . "'></span> Get the whole fruit basket!", "notice"); } } //FOR THE PIE CHART $health_behaviors_complete = false; $all_answers = array(); $graph_fields = array("core_walking_hr", "core_walking_min", "core_sitting_hr", "core_sitting_min"); foreach ($surveys as $index => $instrument_event) { if ($instrument_event["instrument_name"] !== "your_health_behaviors") { continue; } $all_answers = getUserAnswers(null, $graph_fields); $user_answers = array(); foreach ($graph_fields as $key) { if ($instrument_event["survey_complete"]) { $health_behaviors_complete = true;
function logout($message, $timeout = false) { //logIt("Logout called: $message / ".(int)$timeout, "DEBUG"); global $loggedInUser, $websiteUrl; if (isUserLoggedIn()) { $loggedInUser->log_entry[] = "Logged out"; $loggedInUser->updateUser(); $loggedInUser = NULL; } clearSession(); if (!empty($message)) { addSessionMessage($message); } if ($timeout == true) { setSessionRedirect($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']); } // Goto Login page but redirect back to original page after authentication $destination = $websiteUrl . "login.php"; header("Location: {$destination}"); exit; }
endSession(); break; case 'getSessionGestures': getSessionGestures(); break; case 'addSessionGesture': addSessionGesture(); break; case 'removeSessionGesture': removeSessionGesture(); break; case 'commitSessionGestures': commitSessionGestures(); break; case 'addSessionMessage': addSessionMessage(); break; case 'removeSessionMessage': removeSessionMessage(); break; case 'sendSessionMessages': sendSessionMessages(); break; case 'getUserGesturesAcc': getUserGesturesAcc(); break; case 'getAllGesturesAcc': getAllGesturesAcc(); break; case 'setVisualizationState': setVisualizationState();