<?php
include("admin/connection.php");
function path()
{
    return 'https://ndwemake.com/';
}
// meta tag


$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
// echo $actual_link;exit;
$host = $_SERVER['HTTP_HOST'];
$currentURL = $_SERVER['REQUEST_URI'];


if (strpos($currentURL, 'index') !== false) {
    $redirectURL = 'https://ndwemake.com/'; // Change this URL to your desired destination
    header('Location: ' . $redirectURL);
    // exit;
}

$query = "SELECT * FROM meta_tag WHERE url='$actual_link'  ";
$meta_all = mysqli_query($con, $query);
$metaRow = mysqli_fetch_array($meta_all);
?>
<?php
$query = "SELECT * FROM `header` LIMIT 1";
$sql = mysqli_query($con, $query);
$row = mysqli_fetch_assoc($sql);
?>

<!doctype html>
<html class="no-js" lang="zxx">

<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">

    <title><?php echo isset($metaRow['meta_title']) ? $metaRow['meta_title'] : 'ND WE MAKE'; ?></title>
    <meta name="author" content="themeholy">
    <meta name="description" content="<?php echo isset($metaRow['description']) ? htmlspecialchars(strip_tags($metaRow['description'])) : 'Default site description.'; ?>">
    <meta name="keywords" content="<?php echo isset($metaRow['meta_key']) ? $metaRow['meta_key'] : 'Default, Keywords'; ?>">
    <meta name="robots" content="INDEX,FOLLOW">

    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="shortcut icon" href="<?php path() ?>/assets/img/favicons/favicon.png" />

    <link rel="manifest" href="<?php path() ?>/assets/img/favicons/manifest.json">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="msapplication-TileImage" content="<?php path() ?>/assets/img/favicons/ms-icon-144x144.png">
    <meta name="theme-color" content="#ffffff">


    <meta name="google-site-verification" content="G55UGcpQuWPNMCULU9LQmlb7ZxTQitlBll4nfmFIR1o" />
    <link rel="preconnect" href="<?php path() ?>/https://fonts.googleapis.com/">
    <link rel="preconnect" href="<?php path() ?>/https://fonts.gstatic.com/">
    <link
        href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&amp;family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&amp;display=swap"
        rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
    <link rel="stylesheet" href="<?php path() ?>/assets/css/app.min.css">
    <link rel="stylesheet" href="<?php path() ?>/assets/css/fontawesome.min.css">
    <link rel="stylesheet" href="<?php path() ?>/assets/css/style.css">


    <!-- Google tag (gtag.js) -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-VPKH9XRD6G"></script>
    <script>
        window.dataLayer = window.dataLayer || [];

        function gtag() {
            dataLayer.push(arguments);
        }
        gtag('js', new Date());

        gtag('config', 'G-VPKH9XRD6G');
    </script>




</head>

<body class="home-2">

    <div class="th-menu-wrapper">
        <div class="th-menu-area text-center"><button class="th-menu-toggle"><i class="fal fa-times"></i></button>
            <div class="mobile-logo"><a href="<?php path() ?>/index.php"><img
                        src="<?php path(); ?>/admin/assets/images/slider/<?php echo $row['logo']; ?>" alt="Piller-html"
                        style="height: 65px;"></a></div>
            <div class="th-mobile-menu">
                <ul>
                    <!-- Home -->
                    <li><a href="<?php echo path(); ?>index">Home</a></li>

                    <!-- About -->
                    <li><a href="<?php echo path(); ?>about">About Us</a></li>

                    <!-- UPVC Doors (dynamic) -->
                    <?php
                    $ser = mysqli_query($con, "SELECT * FROM `upvc_door`");
                    if ($ser && mysqli_num_rows($ser) > 0) {
                    ?>
                        <li class="menu-item-has-children">
                            <a href="#">UPVC Doors</a>
                            <ul class="sub-menu">
                                <?php while ($rowd = mysqli_fetch_array($ser)) {
                                    $title = $rowd['title'];
                                    $slug  = $rowd['slug'];
                                ?>
                                    <li>
                                        <a href="<?php echo path(); ?>/upvc-door/<?php echo urlencode($slug); ?>">
                                            <?php echo htmlspecialchars($title); ?>
                                        </a>
                                    </li>
                                <?php } ?>
                            </ul>
                        </li>
                    <?php } ?>

                    <!-- UPVC Windows (dynamic) -->
                    <?php
                    $ser = mysqli_query($con, "SELECT * FROM `upvc_window`");
                    if ($ser && mysqli_num_rows($ser) > 0) {
                    ?>
                        <li class="menu-item-has-children">
                            <a href="#">UPVC Window</a>
                            <ul class="sub-menu">
                                <?php while ($roww = mysqli_fetch_array($ser)) {
                                    $title = $roww['title'];
                                    $slug  = $roww['slug'];
                                ?>
                                    <li>
                                        <a href="<?php echo path(); ?>/upvc-windows/<?php echo urlencode($slug); ?>">
                                            <?php echo htmlspecialchars($title); ?>
                                        </a>

                                    </li>
                                <?php } ?>
                            </ul>
                        </li>
                    <?php } ?>

                    <!-- Aluminium Systems (dynamic) -->
                    <?php
                    $ser = mysqli_query($con, "SELECT * FROM `aluminium`");
                    if ($ser && mysqli_num_rows($ser) > 0) {
                    ?>
                        <li class="menu-item-has-children">
                            <a href="<?php echo path(); ?>/aluminium-product">Aluminium Systems</a>
                            <ul class="sub-menu">
                                <?php while ($rowa = mysqli_fetch_array($ser)) {
                                    $title = $rowa['title'];
                                    $slug  = $rowa['slug'];
                                ?>
                                    <li>
                                        <a href="<?php echo path(); ?>/aluminium-product/<?php echo urlencode($slug); ?>">
                                            <?php echo htmlspecialchars($title); ?>
                                        </a>
                                    </li>
                                <?php } ?>
                            </ul>
                        </li>
                    <?php } ?>

                    <!-- Home & Interior Solutions (kept as-is with query params) -->
                    <!-- <li class="menu-item-has-children">
            <a href="#">Home Decor</a>
            <ul class="sub-menu">
                <li><a href="<?php echo path(); ?>/homedecor.php?section=kitchen-wardrobe">Kitchen Wardrobe &amp; TV Cabinet</a></li>
                <li><a href="<?php echo path(); ?>/homedecor.php?section=residential-doors">Residential &amp; Commercial Doors</a></li>
                <li><a href="<?php echo path(); ?>/homedecor.php?section=home-automation">Home Automation</a></li>
            </ul>
        </li> -->

                    <?php
                    $top = mysqli_query($con, "SELECT * FROM tbl_top_category ORDER BY t_id ASC");

                    if (mysqli_num_rows($top) > 0) {
                    ?>
                        <li class="menu-item-has-children">
                            <a href="#">Home Decor</a>
                            <ul class="sub-menu">

                                <?php while ($roww = mysqli_fetch_assoc($top)) {

                                    $cat_name = htmlspecialchars($roww['cat_name'], ENT_QUOTES, 'UTF-8');
                                    $slug     = urlencode($roww['slug']);
                                ?>
                                    <li>
                                        <a href="<?php echo path(); ?>homedecor/<?php echo $slug; ?>">
                                            <?php echo $cat_name; ?>
                                        </a>
                                    </li>
                                <?php } ?>

                            </ul>
                        </li>
                    <?php } ?>




                    <!-- Architecture & Design Services -->
                    <li class="menu-item-has-children">
                        <a href="#">Architecture</a>
                        <ul class="sub-menu">
                            <li><a href="#">Interior Design Service</a></li>
                            <li><a href="#">Architectural Planning</a></li>
                            <li><a href="#">Collaboration &amp; Builder Support</a></li>
                        </ul>
                    </li>

                    <!-- Gallery -->
                    <li class="menu-item-has-children"><a href="#">Gallery</a>
                        <ul class="sub-menu">
                            <li><a href="<?php echo path(); ?>/gallery">Images</a></li>
                            <li><a href="<?php echo path(); ?>/video">Videos</a></li>
                        </ul>
                    </li>

                    <!-- Blog & Contact -->
                    <li><a href="<?php echo path(); ?>blog">Blog</a></li>
                    <li><a href="<?php echo path(); ?>contact">Contact Us</a></li>
                </ul>
            </div>
        </div>
    </div>


    <header class="th-header header-default">
        <div class="header-top">
            <div class="container th-container3">
                <div class="row justify-content-center justify-content-lg-between align-items-center gy-2">
                    <div class="col-auto d-none d-lg-block">
                        <div class="header-links">
                            <ul>
                                <?php
                                $fullEmail = $row['email'] ?? '';
                                $firstEmailOnly = explode('<br', $fullEmail)[0];
                                $firstEmailOnly = explode(',', $firstEmailOnly)[0];
                                $firstEmailOnly = trim(strip_tags($firstEmailOnly));
                                ?>
                                <li>
                                    <i class="fa-solid fa-envelope"></i> <a
                                        href="mailto:<?php echo htmlspecialchars($firstEmailOnly); ?>">
                                        <?php echo htmlspecialchars($firstEmailOnly); ?></a>
                                </li>

                                <?php
                                $fullPhone = $row['phone'] ?? '';
                                $firstPhoneOnly = explode(',', $fullPhone)[0];
                                $cleanTel = preg_replace('/\D/', '', $firstPhoneOnly);
                                ?>
                                <li><i class="fa-solid fa-phone"></i>
                                    <a
                                        href="tel:+91<?php echo $cleanTel; ?>"><?php echo htmlspecialchars(trim($firstPhoneOnly)); ?></a>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="col-auto">
                        <div class="header-links">
                            <ul>
                                <li>
                                    <div class="th-social">
                                        <a target="_blank" href="https://www.facebook.com/profile.php?id=61582407537916"><i class="fab fa-facebook-f"></i></a>
                                        <a target="_blank" href="https://www.instagram.com/wemake.windows?igsh=MTI1Zzk1NXhrZDZvMA=="><i class="fa-brands fa-instagram"></i></a>
                                        <!--<a target="_blank"  href="https://www.twitter.com/"><i class="fa-brands fa-x-twitter"></i></a>-->
                                        <a target="_blank" href="https://www.linkedin.com/company/109294363/admin/dashboard/"><i class="fab fa-linkedin-in"></i></a>
                                        <a target="_blank" href="https://www.youtube.com/"><i class="fa-brands fa-youtube"></i></a>
                                    </div>
                                </li>
                                <li class="lang-wrapper">
                                    <div class="btn-group justify-content-center">
                                        <a href="ndwemake.pdf" class="th-btn style2 pill"
                                            download style="color: white;">
                                            <i class="fa fa-download me-2" aria-hidden="true"></i> Download Brochure
                                        </a>
                                    </div>

                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="sticky-wrapper">

            <div class="menu-area">
                <div class="container th-container3">
                    <div class="row align-items-center justify-content-between">
                        <div class="col-auto">
                            <div class="header-logo">
                                <a href="<?php echo path(); ?>">
                                    <img src="<?php echo path(); ?>/admin/assets/images/slider/<?php echo htmlspecialchars($row['logo']); ?>"
                                        alt="Piller-html">
                                </a>
                            </div>
                        </div>

                        <div class="col-auto">
                            <nav class="main-menu d-none d-lg-inline-block">
                                <ul>

                                    <li><a href="<?php echo path(); ?>index">Home</a></li>
                                    <li><a href="<?php echo path(); ?>about">About Us</a></li>

                                    <!-- uPVC Doors & Windows parent -->
                                    <li class="menu-item-has-children"><a href="<?php echo path(); ?>/">uPVC Doors &amp; Windows</a>
                                        <ul class="sub-menu">

                                            <!-- UPVC Doors -->
                                            <li class="menu-item-has-children"><a href="#">UPVC Doors</a>
                                                <ul class="sub-menu">
                                                    <?php
                                                    $door_query = mysqli_query($con, "SELECT title, slug FROM upvc_door ORDER BY id ASC");
                                                    if ($door_query && mysqli_num_rows($door_query) > 0) {
                                                        while ($door = mysqli_fetch_assoc($door_query)) {
                                                            $dTitle = htmlspecialchars($door['title']);
                                                            $dSlug  = urlencode($door['slug']);
                                                            echo '<li><a href="' . path() . '/upvc-door/' . $dSlug . '">' . $dTitle . '</a></li>';
                                                        }
                                                    } else {
                                                        echo '<li><a href="#">No Doors Found</a></li>';
                                                    }
                                                    ?>
                                                </ul>
                                            </li>

                                            <!-- UPVC Windows -->
                                            <li class="menu-item-has-children"><a href="#">UPVC Windows</a>
                                                <ul class="sub-menu">
                                                    <?php
                                                    $window_query = mysqli_query($con, "SELECT title, slug FROM upvc_window ORDER BY id ASC");
                                                    if ($window_query && mysqli_num_rows($window_query) > 0) {
                                                        while ($window = mysqli_fetch_assoc($window_query)) {
                                                            $wTitle = htmlspecialchars($window['title']);
                                                            $wSlug  = urlencode($window['slug']);
                                                            echo '<li><a href="' . path() . '/upvc-windows/' . $wSlug . '">' . $wTitle . '</a></li>';
                                                        }
                                                    } else {
                                                        echo '<li><a href="#">No Windows Found</a></li>';
                                                    }
                                                    ?>
                                                </ul>
                                            </li>

                                        </ul>
                                    </li>

                                    <!-- Aluminium Products -->
                                    <li class="menu-item-has-children"><a href="#">Aluminium Products</a>
                                        <ul class="sub-menu">
                                            <?php
                                            $al_query = mysqli_query($con, "SELECT title, slug FROM aluminium ORDER BY id ASC");
                                            if ($al_query && mysqli_num_rows($al_query) > 0) {
                                                while ($al = mysqli_fetch_assoc($al_query)) {
                                                    $aTitle = htmlspecialchars($al['title']);
                                                    $aSlug  = urlencode($al['slug']);
                                                    echo '<li><a href="' . path() . '/aluminium-product/' . $aSlug . '">' . $aTitle . '</a></li>';
                                                }
                                            } else {
                                                echo '<li><a href="#">No Products Found</a></li>';
                                            }
                                            ?>
                                        </ul>
                                    </li>

                                    <!-- Home Decor (kept with query params; change if you want clean URLs for these too) -->
                                    <!-- <li class="menu-item-has-children">
                                        <a href="#">Home Decor</a>
                                        <ul class="sub-menu">
                                            <li><a href="<?php echo path(); ?>/homedecor.php?section=kitchen-wardrobe">Kitchen Wardrobe &amp; TV Cabinet</a></li>
                                            <li><a href="<?php echo path(); ?>/homedecor.php?section=residential-doors">Residential &amp; Commercial Doors</a></li>
                                            <li><a href="<?php echo path(); ?>/homedecor.php?section=home-automation">Home Automation</a></li>
                                        </ul>
                                    </li> -->
                                    <?php
                                    $top = mysqli_query($con, "SELECT * FROM tbl_top_category ORDER BY t_id ASC");

                                    if (mysqli_num_rows($top) > 0) {
                                    ?>
                                        <li class="menu-item-has-children">
                                            <a href="#">Home Decor</a>
                                            <ul class="sub-menu">

                                                <?php while ($roww = mysqli_fetch_assoc($top)) {

                                                    $cat_name = htmlspecialchars($roww['cat_name'], ENT_QUOTES, 'UTF-8');
                                                    $slug     = urlencode($roww['slug']);
                                                ?>
                                                    <li>
                                                        <a href="<?php echo path(); ?>homedecor/<?php echo $slug; ?>">
                                                            <?php echo $cat_name; ?>
                                                        </a>
                                                    </li>
                                                <?php } ?>

                                            </ul>
                                        </li>
                                    <?php } ?>

                                    <!-- Architecture & Design Services -->
                                    <li class="menu-item-has-children">
                                        <a href="#">Architecture</a>
                                        <ul class="sub-menu">
                                            <li><a href="#">Interior Design Service</a></li>
                                            <li><a href="#">Architectural Planning</a></li>
                                            <li><a href="#">Collaboration &amp; Builder Support</a></li>
                                        </ul>
                                    </li>

                                    <!-- Gallery -->
                                    <li class="menu-item-has-children"><a href="#">Gallery</a>
                                        <ul class="sub-menu">
                                            <li><a href="<?php echo path(); ?>gallery">Images</a></li>
                                            <li><a href="<?php echo path(); ?>video">Videos</a></li>
                                        </ul>
                                    </li>

                                    <li><a href="<?php echo path(); ?>blog">Blog</a></li>
                                    <li><a href="<?php echo path(); ?>contact">Contact Us</a></li>

                                </ul>
                            </nav>
                            <button type="button" class="th-menu-toggle d-block d-lg-none"><i class="far fa-bars"></i></button>
                        </div>

                    </div>
                </div>
            </div>

        </div>
    </header>