<?php
    include('./all/config.php'); 


    if(isset($_GET['title']))
                {
                    $slug = mysqli_real_escape_string($con, $_GET['title']);
                    $meta_post = "SELECT slug, meta_title, meta_description, meta_keyword FROM posts WHERE slug = '$slug' AND status ='0' LIMIT 1";
                    $meta_run = mysqli_query($con, $meta_post);

                    if(mysqli_num_rows($meta_run) > 0)
                    {
                        $metaItem = mysqli_fetch_array($meta_run);

                        $page_title = $metaItem['meta_title'];
                        $meta_description = $metaItem['meta_description'];
                        $meta_keywords = $metaItem['meta_keyword'];
                  
                    }else{
                   
                        $page_title = "Post Page";
                        $meta_description = "FirstCash Category Post page description";
                        $meta_keywords = "FirstCash, MFS, SureCash, FSIBL, Mobile Finance, FSIB";
                    
                    }
                }  
                 else
                 {

                    $page_title = "Post Page";
                    $meta_description = "FirstCash Category Post page description";
                    $meta_keywords = "FirstCash, MFS, SureCash, FSIBL, Mobile Finance, FSIB";
               
                }


    include('./all/header.php');
     include('./all/navbar.php'); ?>

    <section data-bs-version="5.1" class="header12 cid-tyCfvuk4ue mbr-parallax-background" id="header12-k">
        <div class="container mt-5">

        <?php
                if(isset($_GET['title']))
                {
                    $slug = mysqli_real_escape_string($con, $_GET['title']);
                    $post = "SELECT * FROM posts WHERE slug = '$slug' AND status ='0' LIMIT 1";
                    $post_run = mysqli_query($con, $post);

                    if(mysqli_num_rows($post_run) > 0)
                    {
                        
                        foreach( $post_run as $postitem)
                        {
                            ?>
   
   <h1 class="mb-3 text-center" style="font-weight:bold;color:#2D3192;line-height:55px;"><?= $postitem['name_bn']; ?></h1>

                    <hr style="width:50%; margin-left:25% !important; margin-right:25% !important;" />
                            

                    <label>Date:<?=$postitem['date']?></label>
                    <!--<label>Author: </label>-->                  
                            
                    <div class="container box mb-5">
                    <?php if($postitem['image'] !=null): ?>
                        <img src="<?= base_url('uploads/posts/'.$postitem['image']) ?>" width="100" class="w-100" alt="<?= $postitem['name']; ?>">
                         
                    <?php endif;       ?>

                    <?= $postitem['description_bn']; ?>   
   


                    </div>        

                            <?php  

                        }

                    }
                    else
                    {
                        ?>
                        <h4>No Such Post Found</h4>
                        <?php

                    }

                }
                else{
                    ?>
                        <h4>No Such URL Found</h4>
                    <?php
                
                }




        ?>








        </div>

    </section>

    <?php include('./all/footer.php') ?>


</body>

</html>