<?php
include('include/main.inc.php');
$actual_links = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$ex_links = explode("/", $actual_links);
$blog_href = explode(".", $ex_links[4]);
$blog_mix = str_ireplace("-", " ", $blog_href[0]);
$blog_name = ucwords($blog_mix);

$res_blog = $dbconn->query("select catID,catImage,blogDname,catName,blogDate,catDesc1,blog_written,pageTitle,pageDescription,pageKeywords from blog_tbl where catName = '$blog_name'");
if($res_blog->num_rows > 0){
$blog_details = $res_blog->fetch_assoc();

$res_web = $dbconn->query("Select * from admin_details where slno = '1'");
$web_details = $res_web->fetch_assoc();

$page_metatitle = ($blog_details['pageTitle']) ? $blog_details['pageTitle'] : $web_details['companyName'];
$page_metadesc = ($blog_details['pageDescription']) ? $blog_details['pageDescription'] : $web_details['companyName'];
$page_metakey = ($blog_details['pageKeywords']) ? $blog_details['pageKeywords'] : $web_details['companyName'];
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title><?= $page_metatitle; ?></title>
    <meta name="description" content="<?= $page_metadesc; ?>">
    <meta name="keywords" content="<?= $page_metakey; ?>" >
    <?php include "app_top.php"; ?>
</head>

<body>

    <?php include "app_header.php"; ?>

    <section class="heading_banner" style="background-image: url(<?= site_url; ?>/designer/images/blog-banner.webp)">
        <div class="container">
            <div class="row">
                <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-center">
                    <h1 class="cat_title"><?= $blog_details['blogDname']; ?></h1>
                    <div class="clearfix"></div>
                    <!--<div class="cat_title2">We Are Available For You</div>-->
                </div>
            </div>
        </div>
    </section>

    <div class="inner_breadcrumb hidden_xs">
        <div class="container">
            <div class="row">
                <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <ul class="breadcrumb">
                        <li><a href="<?= site_url; ?>" title="Home">Home</a></li>
                        <li><a href="<?= site_url; ?>/blog.htm" title="Blogs">Blogs</a></li>
                        <li class="active"><?= $blog_details['blogDname']; ?></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>


    <section class="blog_page">
        <div class="container">
        <div class="title"><?= $blog_details['blogDname']; ?></div>
        <div class="clearfix"></div>
            <div class="row">
                <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <div class="blog_left blog_details">
                        <ul>
                            <li><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                                    <path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"></path>
                                </svg> By: <?= $blog_details['blog_written']; ?></li>
                            <!--<li><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">-->
                            <!--        <path d="M10.854 7.146a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7.5 9.793l2.646-2.647a.5.5 0 0 1 .708 0z"></path>-->
                            <!--        <path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"></path>-->
                            <!--    </svg> <?= date('M d, Y', strtotime($blog_details['blogDate'])); ?></li>-->
                        </ul>

                        <div class="blog_details1">
                            <div class="blog_details_img">
                                <img src="<?= site_url.'/uploaded-files/blog/images/'.$blog_details['catImage']; ?>" alt="<?= $blog_details['blogDname']; ?>" title="<?= $blog_details['blogDname']; ?>">
                            </div>
                            <?= $blog_details['catDesc1']; ?>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <?php include "app_faq.php"; ?>
    <?php include "app_footer.php"; ?>
    <?php include "app_bottom.php"; ?>
</body>

</html>
<?php }else { 
header('location:'.site_url);
} ?>