-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhotels.php
68 lines (63 loc) · 3.13 KB
/
hotels.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<section class="page-section bg-dark" id="home">
<div class="container">
<h2 class="text-center"></h2>
<div class="d-flex w-100 justify-content-center">
<hr class="border-warning" style="border:3px solid" width="15%">
</div>
<div class="w-100">
<?php<section class="page-section bg-dark" id="home">
<div class="container">
<h2 class="text-center"> hotels </h2>
<div class="d-flex w-100 justify-content-center">
<hr class="border-warning" style="border:3px solid" width="15%">
</div>
<div class="w-100">
<?php
$hotels = $conn->query("SELECT * FROM `hotels` order by rand() ");
while($row = $hotels->fetch_assoc() ):
$cover='';
if(is_dir(base_app.'uploads/hotel_'.$row['id'])){
$img = scandir(base_app.'uploads/hotel_'.$row['id']);
$k = array_search('.',$img);
if($k !== false)
unset($img[$k]);
$k = array_search('..',$img);
if($k !== false)
unset($img[$k]);
$cover = isset($img[2]) ? 'uploads/hotel_'.$row['id'].'/'.$img[2] : "";
}
$row['description'] = strip_tags(stripslashes(html_entity_decode($row['description'])));
$review = $conn->query("SELECT * FROM `rate_review1` where hotel_id='{$row['id']}'");
$review_count =$review->num_rows;
$rate = 0;
while($r= $review->fetch_assoc()){
$rate += $r['rate'];
}
if($rate > 0 && $review_count > 0)
$rate = number_format($rate/$review_count,0,"");
?>
<div class="card d-flex w-100 rounded-0 mb-3 package-item">
<img class="card-img-top" src="<?php echo validate_image($cover) ?>" alt="<?php echo $row['title'] ?>" height="200rem" style="object-fit:cover">
<div class="card-body">
<h5 class="card-title truncate-1"><?php echo $row['title'] ?></h5>
<div class=" w-100 d-flex justify-content-start">
<form action="">
<div class="stars stars-small">
<input class="star star-5" id="star-5" type="radio" name="star" <?php echo $rate == 5 ? "checked" : '' ?>/> <label class="star star-5" for="star-5"></label>
<input class="star star-4" id="star-4" type="radio" name="star" <?php echo $rate == 4 ? "checked" : '' ?>/> <label class="star star-4" for="star-4"></label>
<input class="star star-3" id="star-3" type="radio" name="star" <?php echo $rate == 3 ? "checked" : '' ?>/> <label class="star star-3" for="star-3"></label>
<input class="star star-2" id="star-2" type="radio" name="star" <?php echo $rate == 2 ? "checked" : '' ?>/> <label class="star star-2" for="star-2"></label>
<input class="star star-1" id="star-1" type="radio" name="star" <?php echo $rate == 1 ? "checked" : '' ?>/> <label class="star star-1" for="star-1"></label>
</div>
</form>
</div>
<div class="w-100 d-flex justify-content-between">
<span class="rounded-0 btn btn-flat btn-sm btn-primary"><i class="fa fa-tag"></i> <?php echo number_format($row['cost']) ?></span>
<a href="./?page=view_hotel&id=<?php echo md5($row['id']) ?>" class="btn btn-sm btn-flat btn-warning">View hotel <i class="fa fa-arrow-right"></i></a>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</section>