<div class="comments"> <span> <a href="info.php?id=<?php echo urlencode($hotel->id); ?> ">Edit Hotel Info</a> </span> </div> <div style="clear:both"></div> <div class="rooms"> <?php foreach ($rooms as $room) { ?> <?php $room_photo = RoomPhoto::find_photo_by_room($room->id); ?> <div class="room"> <h1><?php echo ucfirst(htmlentities($room->room_name)); ?> </h1> <?php if (!empty($room_photo)) { ?> <img src="../<?php echo $room_photo->image_path(); ?> "> <div class="float"> <span>Adults:<?php
$room = Room::find_by_id($_GET['id']); if (!$room) { redirect_to("login.php"); } if ($session->user_id != $room->hotel_id) { redirect_to("login.php"); } $count_photo = RoomPhoto::find_photo_by_room($room->id); $max_file_size = 1048567; $message1 = ""; $message2 = ""; $message3 = ""; $message4 = ""; if (isset($_POST['submit'])) { if (empty($count_photo)) { $room_photo = new RoomPhoto(); $room_photo->room_id = $room->id; $room_photo->attach_file($_FILES['upload_file']); if ($room_photo->save()) { redirect_to("hotel_page.php?id={$room->hotel_id}"); } else { $message1 = join("<br>", $room_photo->errors); } } else { $count_photo->attach_file($_FILES['upload_file']); if ($count_photo->update()) { redirect_to("hotel_page.php?id={$room->hotel_id}"); } else { $message1 = join("<br>", $count_photo->errors); } }
</div> <div id="slider"> </div><!-- end slider --> <div id="content"> <div class="wraper"> <h2>Explore our latest offers</h2> <div class="group-offers"> <?php foreach ($hotels as $hotel) { ?> <?php $found_hotel = Hotel::find_by_id($hotel->hotel_id); ?> <?php $room_photo = RoomPhoto::find_photo_by_room($hotel->room_id); ?> <div class="offer"> <?php if (!empty($room_photo)) { ?> <a href="page.php?id=<?php echo $hotel->hotel_id; ?> " class="hover-img"><img src="<?php echo $room_photo->image_path(); ?> " height="237px"></a> <?php } else { ?>