require_once 'pgp_functions.php'; $dbh; localConn(); // HELPER FUNCTION: Insert new user response from pretask page function add_pi1_row($userResponse) { global $dbh; $query = "INSERT INTO privacy_index1 VALUES (DEFAULT,?,?,?,?,?,?,?,?)"; return $result = prepared_query($dbh, $query, $userResponse); } // PROCESS DATA $id = $_SESSION["user"]; $ip = $_SERVER["REMOTE_ADDR"]; //documented PHP var if (!empty($_POST)) { $pi1Response = getUserResponse($_POST); $pi1Response = array_merge(array($id), $pi1Response); //fix array //echo count($pi1Response); // Time stuff $start_time = $_SESSION["pi1_start_time"]; $pi1_time = time() - $start_time; array_push($pi1Response, $pi1_time); echo count($pi1Response); $_SESSION['pi1_time'] = $pi1_time; //for later //echo "got here"; // Filter out used ip's //$ipUsed = filter_var($ip, FILTER_VALIDATE_IP) ? ip_exists($ip) : true; //more concise 'if' clause //if (!$ipUsed) { add_pi1_row($pi1Response);
*/ // PROCESS DATA $type = $_SESSION["vis"]; $user = $_SESSION["user"]; $ip = $_SERVER["REMOTE_ADDR"]; // Filter out used ip's //$ipUsed = filter_var($ip, FILTER_VALIDATE_IP) ? ip_exists($ip) : true; //more concise 'if' clause // Update data if (!empty($_POST)) { // Time stuff $start_time = $_SESSION["vis_start_time"]; $vis_time = time() - $start_time; $_SESSION['vis_time'] = $vis_time; //for later // Fix array length for prepared query $userResponse = array_merge(array($type), getUserResponse($_POST)); echo count($userResponse) . "<br>"; array_pop($userResponse); //I DON'T NEED THIS FOR ANYTHING ELSE???? I DON'T UNDERSTAND?????? $userResponse = array_merge(array($user), $userResponse); echo count($userResponse) . "<br>"; $userResponse = array_merge($userResponse, array($vis_time)); echo count($userResponse); //if(!$ipUsed) { add_vis_row($userResponse); //adds new response to vis table // Update time spent $vis_id = mysql_insert_id(); //documented php function // Populate the user table //$get_user = fetch_row(find_user($user));
$dbh; localConn(); /* HELPER FUNCTIONS */ //Insert new user response from pretask page function add_privacyQ_row($userResponse) { global $dbh; $query = "INSERT INTO privacyQ VALUES (DEFAULT,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; return $result = prepared_query($dbh, $query, $userResponse); } // PROCESS DATA $user = $_SESSION["user"]; $ip = $_SERVER["REMOTE_ADDR"]; //$ipUsed = filter_var($ip, FILTER_VALIDATE_IP) ? ip_exists($ip) : true; if (!empty($_POST)) { $privacyResponse = getUserResponse($_POST); echo count($privacyResponse); array_pop($privacyResponse); //remove submit echo count($privacyResponse); $privacyResponse = array_merge(array($user), $privacyResponse); // Time stuff $start_time = $_SESSION["privacy_start_time"]; $privacy_time = time() - $start_time; array_push($privacyResponse, $privacy_time); $_SESSION['privacy_time'] = $privacy_time; //for later //if (!$ipUsed) { echo count($privacyResponse); add_privacyQ_row($privacyResponse); $privacy_id = mysql_insert_id();
$dbh; localConn(); /* HELPER FUNCTIONS */ //Insert new user response from pretask page function add_efficacy_row($userResponse) { global $dbh; $query = "INSERT INTO efficacy_scale VALUES (DEFAULT,?,?,?,?,?,?,?,?,?,?,?,?)"; return $result = prepared_query($dbh, $query, $userResponse); } // PROCESS DATA $user = $_SESSION["user"]; $ip = $_SERVER["REMOTE_ADDR"]; //$ipUsed = filter_var($ip, FILTER_VALIDATE_IP) ? ip_exists($ip) : true; if (!empty($_POST)) { $efficacyResponse = getUserResponse($_POST); $efficacyResponse = array_merge(array($user), $efficacyResponse); // Time stuff $start_time = $_SESSION["es_start_time"]; $es_time = time() - $start_time; array_push($efficacyResponse, $es_time); $_SESSION['es_time'] = $es_time; //for later //if (!$ipUsed) { add_efficacy_row($efficacyResponse); $es_id = mysql_insert_id(); //documented php function // Populate the user table $get_user = fetch_row(find_user($user)); $update_user = "******"; prepared_query($dbh, $update_user, array($es_id, $user));
$dbh; localConn(); /* HELPER FUNCTIONS */ //Insert new user response from pretask page function add_pretask_row($userResponse) { global $dbh; $query = "INSERT INTO pretaskQ VALUES (DEFAULT,?,?,?,?,?,?,?,?)"; return $result = prepared_query($dbh, $query, $userResponse); } // PROCESS DATA $user = $_SESSION["user"]; $ip = $_SERVER["REMOTE_ADDR"]; //$ipUsed = filter_var($ip, FILTER_VALIDATE_IP) ? ip_exists($ip) : true; if (!empty($_POST)) { $pretaskResponse = getUserResponse($_POST); $pretaskResponse = array_merge(array($user), $pretaskResponse); // Time stuff $start_time = $_SESSION["pretask_start_time"]; $pretask_time = time() - $start_time; array_push($pretaskResponse, $pretask_time); $_SESSION['pretask_time'] = $pretask_time; //for later //if (!$ipUsed) { add_pretask_row($pretaskResponse); $pretask_id = mysql_insert_id(); //documented php function // Populate the user table $get_user = fetch_row(find_user($user)); $update_user = "******"; prepared_query($dbh, $update_user, array($pretask_id, $user));
return $result = prepared_query($dbh, $query, $userResponse); } /* // Return demographic id function find_demo_row($dem_id) { global $dbh; $query = "SELECT * FROM NEW_DEMOGRAPHS WHERE dem_id=?"; return $result = prepared_query($dbh, $query, array($dem_id)); } */ // PROCESS DATA $user = $_SESSION["user"]; $ip = $_SERVER["REMOTE_ADDR"]; //$ipUsed = filter_var($ip, FILTER_VALIDATE_IP) ? ip_exists($ip) : true; if (!empty($_POST)) { $demographResponse = getUserResponse($_POST); array_pop($demographResponse); //I DON'T NEED THIS FOR ANYTHING ELSE???? I DON'T UNDERSTAND?????? $demographResponse = array_merge(array($user), $demographResponse); // Time stuff $start_time = $_SESSION["demograph_start_time"]; $demo_time = time() - $start_time; array_push($demographResponse, $demo_time); //if (!$ipUsed) { add_demo_row($demographResponse); $demo_id = mysql_insert_id(); //documented php function // Populate the user table //$get_user = fetch_row(find_user($user)); //$get_demo = fetch_row(find_demo_row($user['demo_id'])); $total_time = $_SESSION['pi1_time'] + $_SESSION['pi2_time'] + $_SESSION['pi3_time'] + $_SESSION['es_time'] + $_SESSION['pretask_time'] + $_SESSION['vis_time'] + $_SESSION['privacy_time'] + $demo_time;