header("Location: {$redirect_uri}"); exit; } // Google user is logging in for the first time // Register the user $tempUser = array(); $tempUser['oauth_type'] = OAUTH_GOOGLE; $tempUser['oauth_id'] = $gUser['id']; $tempUser['email'] = $gUser['email']; $tempUser['first_name'] = $gUser['givenName']; $tempUser['last_name'] = isset($gUser['familyName']) ? $gUser['familyName'] : ''; $tempUser['gender'] = $gUser['gender'] == 'male' ? 1 : 0; // Google OAuth doesn't provide with location $_SESSION['location_received'] = false; // Register the user data into temporary table - // This data will later be moved to the main table after additional information has been obtained // Get HTML form to obtain additional information $registrar = new Registrar($db); if ($registrar->registerTempUser($tempUser)) { $registrar->getHTML(); } else { echo "<html><body><h3>Unexpected error</h3></body></html>"; } exit; } } else { header("Location: " . $google->getLoginURL()); exit; } header("Location: " . SITE_URL); exit;