<?php 
require_once 'db.php';

$user_id = 0;
$username = '';

if(isset($_SESSION['user_id'])){
    $user_id = $_SESSION['user_id'];

    $name_query = "SELECT * FROM `tbl_register` WHERE id = '$user_id'";
    $res = mysqli_query($conn, $name_query);

    if(mysqli_num_rows($res) > 0){
        $row = mysqli_fetch_assoc($res);
        $username = $row['name'];
    }
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Imperial Products Supply</title>
    <link rel="icon" type="image/png" href="assets/images/favicon.png">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
    <link rel="stylesheet" href="https://unpkg.com/boxicons@2.1.2/css/boxicons.min.css" />
    <link rel="stylesheet" href="https://cdn.rawgit.com/michalsnik/aos/1.0.1/dist/aos.css" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" />
    <link rel="stylesheet"
        href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css" />
    <!-- Toastr CSS -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" />
    <link rel="stylesheet" href="assets/css/style.css" />
    <link rel="stylesheet" href="assets/css/auth.css" />
</head>

<body>
    <header class="header-row">
        <div class="container-fluid">
            <nav class="navbar navbar-expand-md navbar-dark">
                <a class="navbar-brand d-md-none" href="./">
                    <img src="assets/images/logo.png" alt="logo">
                </a>
                <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
                    aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse" id="navbarNav">
                    <ul class="navbar-nav">
                        <li class="nav-item">
                            <a class="nav-link" href="./">Home</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="about-us.php">About Us</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="products.php">Products</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="gallery.php">Gallery</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="product-calculator.php">Product Calculator</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="stone-calculator.php">Stone Calculator</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="custom-order.php">Custom Order</a>
                        </li>
                    </ul>
                    <a class="navbar-brand d-none d-md-block" href="./">
                        <img src="assets/images/logo.png" alt="logo">
                    </a>
                    <ul class="navbar-nav right-menu justify-content-end">
                        <li class="nav-item">
                            <div class="form-wo">
                                <form role="search" action="./" method="GET">
                                    <input type="text" name="s" value="" aria-label="Search"
                                        placeholder="Search for products">
                                </form>
                            </div>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="javascript:;"><img src="assets/images/heart-icon.png"
                                    alt="heart icon"></a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="javascript:;"><img src="assets/images/cart-icon.png"
                                    alt="cart icon"></a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="login.php"><img src="assets/images/user-icon.png"
                                    alt="user icon"></a>
                        </li>
                    </ul>
                </div>
            </nav>
        </div>
    </header>