//if there is already a session and it isn't a post - destroy the session we make sure we aren't using an old one. if(isset($PHPSESSID) & (!array_key_exists('_submit_check', $_POST))) { //$message = "
End of session ($PHPSESSID)."; session_start(); // Unset all of the session variables. $_SESSION = array(); } else { session_start(); } if (ini_get('register_globals')) { foreach ($_SESSION as $key=>$value) { if (isset($GLOBALS[$key])) unset($GLOBALS[$key]); } } $validCode='True'; include 'includes/user.inc.php'; include 'includes/full_browser.php'; $is_valid='No'; // If this is a new session, then the variable // $count will not be registered if (!isset($_SESSION['count']) & (!array_key_exists('_submit_check', $_POST))) { $_SESSION['count']=0; //calculate the time the page loaded $time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $pageTimeStart = $time; $page="login_page"; $_SESSION['pageTimeStart']=$pageTimeStart; $_SESSION['page']=$page; $count = 0; $start = time(); $_SESSION['start']=$start; } else { $count++; } session_regenerate_id(); $sessionId = session_id(); $pathprefix = ""; //check to see if we should allow any logins //$system_results=get_settings(); //$login_active = $system_results->fields['login_active']; if ((array_key_exists('_submit_check', $_POST))) { //make sure they have been input $email = $sessionId; $user_type='pos 100'; $os = browser_detection('os'); $os_number = browser_detection('os_number'); $browser_name = browser_detection('browser_name'); $browser_number = browser_detection('browser_number'); $ip=$_SERVER['REMOTE_ADDR']; $hostaddress = gethostbyaddr($ip); //user does not have an email address need to insert into db //$result= add_user_details($email,$rand_section,$user_type); $result=add_user_details($email,$rand_section,$user_type,$survey_id,$os,$os_number,$browser_name,$browser_number,$ip,$hostaddress,$referred,$sessionId); $result = search_user_email($email); $user_id = $result->fields['id']; //$username = $result->fields['username']; //register the id in the session $_SESSION['user_id']=$user_id; //$_SESSION['username']=$username; //update the timestamp when we login update_user_login_time($user_id); //redirect them to the ne page header("location: instructions.php"); }else{ //echo "
Error: User has already completed study.
"; } ?>