Converted queries in: - functions.php: * getTripCount() - Hardcoded query * getAvailableSpaces() - Two queries using $trip_id parameter (HIGH PRIORITY) - blog.php: * Main blog list query - Hardcoded 'published' status - course_details.php: * Driver training courses query - Hardcoded course type - driver_training.php: * Future driver training dates query - Hardcoded course type - events.php: * Upcoming events query - Hardcoded date comparison - index.php: * Featured trips query - Hardcoded published status All queries now use proper parameter binding via prepared statements. Next: Convert remaining 15+ safe hardcoded queries for consistency.
225 lines
12 KiB
PHP
225 lines
12 KiB
PHP
<?php
|
|
$headerStyle = 'light';
|
|
include_once('header.php') ?>
|
|
|
|
<style>
|
|
.image {
|
|
width: 400px;
|
|
/* Set your desired width */
|
|
height: 350px;
|
|
/* Set your desired height */
|
|
overflow: hidden;
|
|
/* Hide any overflow */
|
|
display: block;
|
|
/* Ensure proper block behavior */
|
|
}
|
|
|
|
.image img {
|
|
width: 100%;
|
|
/* Image scales to fill the container */
|
|
height: 100%;
|
|
/* Image scales to fill the container */
|
|
object-fit: cover;
|
|
/* Fills the container while maintaining aspect ratio */
|
|
object-position: top;
|
|
/* Aligns the top of the image with the top of the container */
|
|
display: block;
|
|
/* Prevents inline whitespace issues */
|
|
|
|
|
|
}
|
|
</style><?php
|
|
$pageTitle = 'Blogs';
|
|
$breadcrumbs = [['Home' => 'index.php']];
|
|
require_once('components/banner.php');
|
|
?>
|
|
|
|
|
|
<!-- Blog List Area start -->
|
|
<section class="blog-list-page py-100 rel z-1">
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-lg-8">
|
|
<?php
|
|
// Query to retrieve data from blogs table
|
|
$stmt = $conn->prepare("SELECT blog_id, title, date, category, image, description, author, members_only, link FROM blogs WHERE status = ? ORDER BY date DESC");
|
|
$stmt->bind_param("s", $status = 'published');
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($result->num_rows > 0) {
|
|
// Loop through each row
|
|
while ($row = $result->fetch_assoc()) {
|
|
$blog_id = $row['blog_id'];
|
|
$title = $row['title'];
|
|
$date = $row['date'];
|
|
$category = $row['category'];
|
|
$image = $row['image'];
|
|
$description = $row['description'];
|
|
$author = $row['author'];
|
|
$blog_author = $row['author'];
|
|
$members_only = $row['members_only'];
|
|
if ($members_only) {
|
|
if (!isset($_SESSION['user_id'])) {
|
|
$blog_link = "login.php";
|
|
$button_hover = "Members Only";
|
|
$icon = "fa-lock";
|
|
} else {
|
|
if (getUserMemberStatus($_SESSION['user_id'])) {
|
|
$blog_link = $row['link'];
|
|
$button_hover = "Read More";
|
|
$icon = "fa-arrow-right";
|
|
} else {
|
|
$blog_link = "#";
|
|
$button_hover = "Members Only";
|
|
$icon = "fa-lock";
|
|
}
|
|
}
|
|
} else {
|
|
$blog_link = $row['link'];
|
|
$button_hover = "Read More";
|
|
$icon = "fa-arrow-right";
|
|
}
|
|
|
|
// Output the HTML structure with dynamic data
|
|
echo '
|
|
<div class="blog-item style-three" data-aos="fade-up" data-aos-duration="1500" data-aos-offset="50">
|
|
<div class="image">
|
|
<img style="border-radius:20px;" src="assets/images/blog/' . $blog_id . '/' . $image . '" alt="Blog List">
|
|
</div>
|
|
<div class="content">
|
|
<a href="blog.php" class="category">' . $category . '</a>
|
|
<h5><a href="' . $blog_link . '">' . $title . '</a></h5>
|
|
<ul class="blog-meta">
|
|
<li><i class="far fa-calendar-alt"></i> <a href="#">' . $date . '</a></li>
|
|
<li><i class="far fa-user"></i> ' . getFullName($author) . '</li>
|
|
</ul>
|
|
<p>' . $description . '</p>
|
|
<a href="' . $blog_link . '" style="width:100%;" class="theme-btn style-two style-three">
|
|
<span style="width:100%;" data-hover="'.$button_hover.'">Read More</span>
|
|
<i class="fal '.$icon.'"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
';
|
|
}
|
|
} ?>
|
|
|
|
|
|
<!-- <ul class="pagination pt-15 flex-wrap" data-aos="fade-up" data-aos-duration="1500" data-aos-offset="50">
|
|
<li class="page-item disabled">
|
|
<span class="page-link"><i class="far fa-chevron-left"></i></span>
|
|
</li>
|
|
<li class="page-item active">
|
|
<span class="page-link">
|
|
1
|
|
<span class="sr-only">(current)</span>
|
|
</span>
|
|
</li>
|
|
<li class="page-item"><a class="page-link" href="#">2</a></li>
|
|
<li class="page-item"><a class="page-link" href="#">3</a></li>
|
|
<li class="page-item"><a class="page-link" href="#">...</a></li>
|
|
<li class="page-item">
|
|
<a class="page-link" href="#"><i class="far fa-chevron-right"></i></a>
|
|
</li>
|
|
</ul> -->
|
|
</div>
|
|
<div class="col-lg-4 col-md-8 col-sm-10 rmt-75">
|
|
<div class="blog-sidebar">
|
|
|
|
<div class="widget widget-search" data-aos="fade-up" data-aos-duration="1500" data-aos-offset="50">
|
|
<form action="#" class="default-search-form">
|
|
<input type="text" placeholder="Search" required="">
|
|
<button type="submit" class="searchbutton far fa-search"></button>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- <div class="widget widget-category" data-aos="fade-up" data-aos-duration="1500" data-aos-offset="50">
|
|
<h5 class="widget-title">Category</h5>
|
|
<ul class="list-style-three">
|
|
<li><a href="blog.html">Adventure</a></li>
|
|
<li><a href="blog.html">Hiking & Trekking</a></li>
|
|
<li><a href="blog.html">Cycling Tours</a></li>
|
|
<li><a href="blog.html">Family Tours</a></li>
|
|
<li><a href="blog.html">Mountain Hiking</a></li>
|
|
<li><a href="blog.html">Rafting Excursion</a></li>
|
|
<li><a href="blog.html">Coastal Paragliding</a></li>
|
|
</ul>
|
|
</div> -->
|
|
|
|
<!-- <div class="widget widget-news" data-aos="fade-up" data-aos-duration="1500" data-aos-offset="50">
|
|
<h5 class="widget-title">Recent News</h5>
|
|
<ul>
|
|
<li>
|
|
<div class="image">
|
|
<img src="assets/images/widgets/news1.jpg" alt="News">
|
|
</div>
|
|
<div class="content">
|
|
<h6><a href="blog-details.html">Unique Destinations an tolded Stories ways</a></h6>
|
|
<span class="date"><i class="far fa-calendar-alt"></i> 25 Feb 2024</span>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<div class="image">
|
|
<img src="assets/images/widgets/news2.jpg" alt="News">
|
|
</div>
|
|
<div class="content">
|
|
<h6><a href="blog-details.html">Immersive Experiences from Around Globe</a></h6>
|
|
<span class="date"><i class="far fa-calendar-alt"></i> 25 Feb 2024</span>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<div class="image">
|
|
<img src="assets/images/widgets/news3.jpg" alt="News">
|
|
</div>
|
|
<div class="content">
|
|
<h6><a href="blog-details.html">Journey to Inspire Your Next Adventure</a></h6>
|
|
<span class="date"><i class="far fa-calendar-alt"></i> 25 Feb 2024</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div> -->
|
|
|
|
<div class="widget widget-gallery" data-aos="fade-up" data-aos-duration="1500" data-aos-offset="50">
|
|
<h5 class="widget-title">Gallery</h5>
|
|
<div class="gallery">
|
|
<?php
|
|
$folder = 'assets/images/blog/1/';
|
|
$files = glob($folder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
|
shuffle($files); // Randomize the order
|
|
|
|
foreach ($files as $file) {
|
|
echo '<a href="' . $file . '" style="width: 110px; height: 110px; overflow: hidden; display: inline-block; margin: 2px;">';
|
|
echo '<img src="' . $file . '" alt="Gallery" style="width: 100%; height: 100%; object-fit: cover; display: block;">';
|
|
echo '</a>';
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="widget widget-cta" data-aos="fade-up" data-aos-duration="1500" data-aos-offset="50">
|
|
<div class="content text-white">
|
|
<span class="h6">Explore The World</span>
|
|
<h3>Become a Member</h3>
|
|
<a href="membership.php" class="theme-btn style-two bgc-secondary">
|
|
<span data-hover="Explore Now">Join Now</span>
|
|
<i class="fal fa-arrow-right"></i>
|
|
</a>
|
|
</div>
|
|
<div class="image">
|
|
<img src="assets/images/logos/weblogo.png" alt="CTA">
|
|
</div>
|
|
<div class="cta-shape"><img src="assets/images/widgets/cta-shape.png" alt="Shape"></div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<!-- Blog List Area end -->
|
|
|
|
|
|
<?php include_once("insta_footer.php"); ?>
|