$processed = false; try { $dbConnection = DatabaseUtilities::getDatabaseConnection(); //Get the current user's ID and details. $memberID = LoginController::getLoggedInMemberID($dbConnection); if ($memberID == null) { header("Location: login.php"); exit; } else { $searchType = $_GET[SearchConstants::SEARCH_TYPE_INPUT_ID]; switch ($searchType) { case AdvertisementSearchConstants::QUICK_SEARCH_ID: $advertisementSearchResults = AdvertisementSearchController::searchAdvertisements($_GET[AdvertisementSearchConstants::FOR_INPUT_ID], $_GET[AdvertisementSearchConstants::POSITION_INPUT_ID], $_GET[LocationConstants::LOCATION_COUNTRY_INPUT_ID], $_GET[LocationConstants::LOCATION_STATE_INPUT_ID], $_GET[LocationConstants::LOCATION_CITY_INPUT_ID], $_GET[LocationConstants::LOCATION_REGION_INPUT_ID], $searchType, $_GET[SearchConstants::CURRENT_PAGE_ID], $_GET[SearchConstants::PAGING_AMOUNT_ID], $dbConnection); break; case AdvertisementSearchConstants::ADVANCED_SEARCH_ID: $advertisementSearchResults = AdvertisementSearchController::searchAdvertisementsAdvanced($_GET[AdvertisementSearchConstants::FOR_INPUT_ID], $_GET[AdvertisementSearchConstants::POSITION_INPUT_ID], $_GET[AdvertisementSearchConstants::GENRE_INPUT_ID], $_GET[AdvertisementSearchConstants::INSPIRATIONS_INPUT_ID], $_GET[AdvertisementSearchConstants::DURATION_INPUT_ID], $_GET[AdvertisementSearchConstants::EXPERIENCE_INPUT_ID], $_GET[AdvertisementSearchConstants::GENDER_INPUT_ID], $_GET[AdvertisementSearchConstants::AGE_INPUT_ID], $_GET[LocationConstants::LOCATION_COUNTRY_INPUT_ID], $_GET[LocationConstants::LOCATION_STATE_INPUT_ID], $_GET[LocationConstants::LOCATION_CITY_INPUT_ID], $_GET[LocationConstants::LOCATION_REGION_INPUT_ID], $searchType, $_GET[SearchConstants::CURRENT_PAGE_ID], $_GET[SearchConstants::PAGING_AMOUNT_ID], $dbConnection); break; } //If member details cannot be obtained, error if ($advertisementSearchResults != null) { $advertisementSearchParameters = $advertisementSearchResults->getVariable(SearchResults::SEARCH_PARAMETERS); $processed = true; } } } catch (Exception $ex) { $processed = false; } $dbConnection = null; if (!$processed) { ErrorUtilities::errorRedirect(ErrorConstants::GENERAL_ERROR); } else {