Ejemplo n.º 1
0
$processed = false;
try {
    $dbConnection = DatabaseUtilities::getDatabaseConnection();
    //Get the current user's ID and details.
    $memberID = LoginController::getLoggedInMemberID($dbConnection);
    //If the user is not logged in, redirect them to the login page.
    if ($memberID == null) {
        header("Location: login.php");
        exit;
    } else {
        //Check if an advertisement ID parameter has been passed.
        if (isset($_GET['advertisementID'])) {
            $advertisementID = $_GET['advertisementID'];
            if ($advertisementID != null) {
                //Get the advertisement details from the database.
                $advertisementDetails = AdvertisementController::getAdvertisement($memberID, $advertisementID, $dbConnection);
                if ($advertisementDetails != null) {
                    //Get the advertisement genre and position information.
                    $advertisementGenres = AdvertisementGenreController::getAdvertisementGenres($advertisementID, $dbConnection);
                    $advertisementPositions = AdvertisementPositiionController::getAdvertisementPositions($advertisementID, $dbConnection);
                    //Encrypt the current memberID, to be used in validation checks.
                    $memberIDEncrypted = EncryptionUtilities::encryptString($memberID);
                    $processed = true;
                }
            }
        }
    }
} catch (Exception $ex) {
    $processed = false;
}
//Close database connection