$advertisementSearchResults = null;
$advertisementSearchParameters = null;
$memberID = null;
$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 AdvertisementBrowseConstants::ADVERTISEMENT_TYPE_SEARCH_ID:
                $advertisementSearchResults = AdvertisementSearchController::browseAdvertisementsByType($_GET[AdvertisementBrowseConstants::ADVERTISEMENT_TYPE_INPUT_ID], $searchType, $_GET[SearchConstants::CURRENT_PAGE_ID], $_GET[SearchConstants::PAGING_AMOUNT_ID], $dbConnection);
                break;
            case AdvertisementBrowseConstants::LOCATION_SEARCH_ID:
                $advertisementSearchResults = AdvertisementSearchController::browseAdvertisementByLocation($_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 ($advertisementSearchResults != null) {
            $advertisementSearchParameters = $advertisementSearchResults->getVariable(SearchResults::SEARCH_PARAMETERS);
            $processed = true;
        }
    }
} catch (Exception $ex) {
    $processed = false;
}
$dbConnection = null;
if (!$processed) {