$session = new Session();
if (!$session->isLogin) {
    redirect("../login.php");
}
$database = new Database();
$user = new User();
$hotel = new Hotel();
$location = new Location();
$media = new Media();
if (isset($_POST['submit'])) {
    $name = $database->escapeString($_POST['name']);
    $address = $database->escapeString($_POST['address']);
    $stars = $database->escapeString($_POST['stars']);
    $destination = $database->escapeString($_POST['location']);
    $description = $database->escapeString($_POST['description']);
    $hotel->setHotelName($name);
    $hotel->setAddress($address);
    $hotel->setStars($stars);
    $hotel->setDescription($description);
    $hotel->setCityId($destination);
    if (isset($_POST['hotelId'])) {
        $hotelId = $database->escapeString($_POST['hotelId']);
        $hotel->setHotelId($hotelId);
        $hotel->update($database);
    } else {
        $hotelId = $hotel->create($database);
    }
    if (count($_FILES) != 0) {
        $error = 0;
        $files = array();
        $uploaddir = "../images/hotels/large/";