File "admin-header.php"

Full path: /home/fsibplc/public_html/sommilito-bank/admin/admin-header.php
File size: 4.84 B (4.84 KB bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php
session_start();

require 'dbconfig.php';

// Redirect if not logged in
if (!isset($_SESSION['user']) || !isset($_SESSION['useremail']) || !isset($_SESSION['userid']) || !isset($_SESSION['userdivision'])) {
    header("Location: ../login.php");
    exit;
}

// Optional: store in variables to simplify HTML
$userid = $_SESSION['userid'];
$username = $_SESSION['user'];
$useremail = $_SESSION['useremail'];
$userdivision = $_SESSION['userdivision'];

$current_page = basename($_SERVER['PHP_SELF']);


?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dashboard</title>

    <!-- Tailwind CDN -->
    <script src="../assets/js/tailwind/browser@4.js"></script>
    <script src="assets/js/tailwind/elements@1.js" type="module"></script>
</head>

<body class="flex h-screen bg-gray-100">

    <!-- Left Sidebar -->
    <aside class="bg-gray-50 text-teal-900 w-64 shadow flex-shrink-0 flex flex-col transition-all duration-300">
        <!-- Logo -->
        <div class="flex items-center justify-center h-20">
            <img src="../assets/logo/sm-logo.jpeg" alt="Logo" class="h-8 w-auto">
        </div>

        <!-- Menu Items -->
        <nav class="flex-1 px-4 py-6 space-y-2">
            <a href="dashboard.php" class="flex items-center gap-2  px-4 py-2 text-sm font-medium rounded transition <?= $current_page == 'dashboard.php' ? 'bg-gray-200 text-teal-900' : 'hover:bg-gray-200' ?>">
                <svg class="w-4 h-4 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" /> 
                </svg>
                Dashboard
            </a>
            <a href="slider.php" class="flex items-center gap-2  px-4 py-2 text-sm font-medium rounded hover:bg-gray-200 transition <?= $current_page == 'slider.php' || $current_page == 'slider-add.php' || $current_page == 'slider-edit.php' ? 'bg-gray-200 text-teal-900' : 'hover:bg-gray-200' ?>">
                <svg class="w-4 h-4 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 15a4 4 0 004 4h9a4 4 0 004-4M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0Z" />
                </svg>
                Slider
            </a>
            <a href="products.php" class="flex items-center gap-2  px-4 py-2 text-sm font-medium rounded hover:bg-gray-200 transition <?= $current_page == 'products.php' ? 'bg-gray-200 text-teal-900' : 'hover:bg-gray-200' ?>">
                <svg class="w-4 h-4 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z" />
                </svg>
                Products
            </a>
            <a href="../logout.php" class="flex items-center gap-2 px-4 py-2 text-sm font-medium rounded hover:bg-red-300 hover:text-red-800 transition">
                <svg class="w-4 h-4 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 12H8m12 0-4 4m4-4-4-4M9 4H7a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h2" />
                </svg>
                Logout</a>
        </nav>
    </aside>

        <!-- Main Content Area -->
    <div class="flex-1 flex flex-col">
        <!-- Top Bar -->
        <header class="flex items-center justify-between bg-white shadow h-20 px-6 overflow-hidden">
            <div>
                <h1 class="text-xl font-semibold text-teal-900"></h1>
            </div>

            <!-- User Icon -->
            <div class="flex items-center space-x-3">
                <div class="flex flex-col">
                    <span class="text-teal-600 font-medium text-sm"><?= htmlspecialchars($username) ?></span>
                    <!-- <span class="text-gray-600 font-medium text-sm"><?= htmlspecialchars($useremail) ?></span> -->
                    <span class="text-gray-600 font-medium text-sm"><?= htmlspecialchars($userdivision) ?></span>
                </div>
            </div>
        </header>