<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Blog Details || Sai Protection Group</title>
    <meta name="title" content="Sai Protection Group | Professional Security Guard Services in India">
    <meta name="description" content="Sai Protection Group offers professional security guard services including industrial, corporate, residential, film set and event security. Trusted protection with trained and reliable security personnel across India.">
    <meta name="keywords" content="Sai Protection Group, security guard services, event security, industrial security, residential security, corporate security, film set security, private security agency, professional security guards, trained security personnel, safety and protection, 24x7 security services, security solutions India, security company Pune, armed security, unarmed security, commando security services">

    <!-- Open Graph / Facebook -->
    <meta property="og:type" content="website">
    <meta property="og:url" content="https://saiprotectiongroup.in/">
    <meta property="og:title" content="Sai Protection Group | Professional Security Guard Services in India">
    <meta property="og:description" content="Trusted security guard services for corporate, residential, industrial, events and film sets. Sai Protection Group ensures safety with trained and reliable personnel.">
    <meta property="og:image" content="https://saiprotectiongroup.in/images/2.jpeg">

    <!-- Twitter -->
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:url" content="https://saiprotectiongroup.in/">
    <meta name="twitter:title" content="Sai Protection Group | Professional Security Guard Services in India">
    <meta name="twitter:description" content="Reliable and professional security guard services for industries, corporates, residential societies, film sets and events across India.">
    <meta name="twitter:image" content="https://saiprotectiongroup.in/images/2.jpeg">
    <!-- favicon -->
    <link rel="icon" href="sglogo.png" sizes="20x20" type="image/png" />
    <!-- animate -->
    <link rel="stylesheet" href="assets/css/animate.css" />
    <!-- bootstrap -->
    <link rel="stylesheet" href="assets/css/bootstrap.min.css" />
    <!-- magnific popup -->
    <link rel="stylesheet" href="assets/css/magnific-popup.css" />
    <!-- owl carousel -->
    <link rel="stylesheet" href="assets/css/owl.carousel.min.css" />
    <!-- Nice Select -->
    <link rel="stylesheet" href="assets/css/nice-select.css">
    <!-- Slick Slider -->
    <link rel="stylesheet" href="assets/css/slick.css">
    <!-- fontawesome -->
    <link rel="stylesheet" href="assets/css/font-awesome.min.css" />
    <!-- iconmoon -->
    <link rel="stylesheet" href="assets/css/icomoon.css">
    <!-- Main Stylesheet -->
    <link rel="stylesheet" href="assets/css/style.css" />
    <!-- Responsive -->
    <link rel="stylesheet" href="assets/css/responsive.css" />
</head>

<style>
    .blog-single-content-wrap .thumbnail img {
    width: 100%;
}
</style>

<body>
    <div class="body-overlay" id="body-overlay"></div>
    
    <?php  
    include "header1.php";
    ?>

    <!-- breadcrumb area  -->
    <div class="breadcrumb-area margin-bottom-120">
        <div class="container custom-container">
            <div class="breadcrumb-inner">
                <h2 class="br-inner-title">Blog Details</h2>
                <ul class="breadcrumb-menu">
                    <li><img class="bullet-04" src="./assets/img/section-img/breadcrumb/home.svg" alt=""><a
                            href="#">home</a></li>
                    <li><img class="bullet-03" src="./assets/img/shapes/bullet.png" alt=""><a href="#">Blog Details</a></li>
                </ul>
            </div>
        </div>
    </div>
    <!-- breadcrumb area end -->

    <!-- blog Section Start Here -->
    <div class="blog-section-area">
        <div class="container">
            <div class="row">
            <?php
    include "db.php";

    if (isset($_GET['id']) && is_numeric($_GET['id'])) {
    $id = intval($_GET['id']);

    $query = "SELECT * FROM blogs WHERE id = $id LIMIT 1";
    $result = mysqli_query($conn, $query);

    if ($row = mysqli_fetch_assoc($result)) {
        ?>
        <div class="col-lg-8">
            <div class="blog-single-content-wrap main-blog-single">

                <div class="thumbnail">
                    <img src="./admin/blogs/<?php echo htmlspecialchars($row['image']); ?>" alt="blog">
                </div>

                <div class="post-meta-wrap">
                    <ul class="post-meta">
                        <li>
                            <span class="byline"> 
                                <a class="post-by url fn n" href="#">
                                    By Admin
                                </a>
                            </span>
                        </li>
                        <li>
                            <span class="posted-on">
                                <a href="#" rel="bookmark">
                                    <span class="entry-date published updated">
                                        <?php echo date("F j, Y", strtotime($row['created_at'])); ?>
                                    </span>
                                </a>
                            </span>
                        </li>
                    </ul>
                </div>

                <h2 class="title"><?php echo htmlspecialchars($row['title']); ?></h2>

                <div><?php echo $row['content']; ?></div>

            </div>
        </div>
        <?php
    } else {
        echo "<p>Blog not found.</p>";
    }
} else {
    echo "<p>Invalid blog ID.</p>";
}
?>

                <div class="col-lg-4">
                    <div class="widget-area">
                        
                        <div
                            class="widget widget_recent_posts wow animate__animated animate__fadeInRight animate__delay-1s">
                            <h4 class="widget-headline style-02">Recent Post</h4>
<?php
include "db.php";

$query = "SELECT * FROM blogs ORDER BY created_at DESC LIMIT 5";
$result = mysqli_query($conn, $query);
?>

<ul class="theme-recent-post-wrap">
    <?php while ($row = mysqli_fetch_assoc($result)) { ?>
        <li class="theme-recent-post-item">
            <div class="thumb">
                <a href="blog-details.php?id=<?php echo $row['id']; ?>">
                    <img src="./admin/blogs/<?php echo htmlspecialchars($row['image']); ?>" 
                         alt="<?php echo htmlspecialchars($row['title']); ?>">
                </a>
            </div>
            <div class="content">
                <span class="time">
                    <?php echo date("M d, Y", strtotime($row['created_at'])); ?>
                </span>
                <h4 class="title">
                    <a href="blog-details.php?id=<?php echo $row['id']; ?>">
                        <?php echo htmlspecialchars($row['title']); ?>
                    </a>
                </h4>
            </div>
        </li>
    <?php } ?>
</ul>

                        </div>
                        
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- blog Items Section Start Here -->

    <!-- footer area start -->
    <?php
    include "footer.php"
    ?>
    <!-- footer area end -->

    <!-- back to top area start -->
    <div class="back-to-top">
        <span class="back-top"><i class="fa fa-angle-up"></i></span>
    </div>
    <!-- back to top area end -->


    <script src="assets/js/jquery-3.6.0.min.js"></script>
    <!-- bootstrap -->
    <script src="assets/js/bootstrap.min.js"></script>
    <!-- magnific popup -->
    <script src="assets/js/jquery.magnific-popup.js"></script>
    <!-- wow -->
    <script src="assets/js/wow.min.js"></script>
    <!-- owl carousel -->
    <script src="assets/js/owl.carousel.min.js"></script>
    <!-- Nice Select -->
    <script src="assets/js/jquery.nice-select.js"></script>
    <!-- Slick Slider -->
    <script src="assets/js/slick.min.js"></script>
    <!-- isotop -->
    <script src="assets/js/isotope.pkgd.min.js"></script>
    <!-- isotop image load -->
    <script src="assets/js/imagesloaded.pkgd.min.js"></script>
    <!-- isotop image load -->
    <script src="assets/js/jQuery.Progressbar.js"></script>
    <!-- countdown -->
    <script src="assets/js/jquery.countdown.min.js"></script>
    <!-- main js -->
    <script src="assets/js/main.js"></script>
</body>

</html>