HEX
Server: Apache/2.4.46 (Ubuntu)
System: Linux localhost 5.11.0-49-generic #55-Ubuntu SMP Wed Jan 12 17:36:34 UTC 2022 x86_64
User: root (0)
PHP: 7.4.16
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/lab-portal/dashboard.php
<?php
session_start();

// Prevent previous page from being cached
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: 0");

// If no user session → force login
if (!isset($_SESSION["user"])) {
    header("Location: login.php");
    exit;
}

// Redirect to login if session is missing
if (!isset($_SESSION["user"])) {
    header("Location: login.php");
    exit;
}

$user = $_SESSION["user"];
?>

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

<style>
/* ===== Dashboard Layout ===== */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    background: #f4f6f9;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 250px;
    background: #1f2937;
    color: white;
    padding: 20px;
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    transition: 0.3s;
}

.sidebar h2 {
    font-size: 22px;
    margin-bottom: 20px;
}

.sidebar a {
    display: block;
    padding: 12px 10px;
    color: white;
    text-decoration: none;
    margin: 6px 0;
    border-radius: 6px;
    transition: 0.3s;
}

.sidebar a:hover {
    background: #374151;
}

/* ===== Mobile Sidebar Button ===== */
.mobile-menu-btn {
    display: none;
    background: #1f2937;
    color: white;
    padding: 10px 14px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    margin-bottom: 15px;
}

/* ===== Main Content ===== */
.main-content {
    /* margin-left: 260px; */
    padding: 25px;
    width: 100%;
}

@media(max-width: 768px) {
    .sidebar {
        left: -260px;
    }

    .sidebar.active {
        left: 0;
    }

    .mobile-menu-btn {
        display: inline-block;
    }

    .main-content {
        margin-left: 0;
    }
}

/* ===== Cards ===== */
.card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

.card h3 {
    margin-bottom: 15px;
}

/* Grid layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

/* JSON Box */
.json-box {
    background: #111827;
    color: #10b981;
    padding: 20px;
    border-radius: 10px;
    font-size: 14px;
    white-space: pre-wrap;
    overflow-x: auto;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px 25px;
    border-radius: 10px;
    box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

/* Left Section */
.top-left h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.top-left p {
    margin: 3px 0 0 0;
    font-size: 15px;
    color: #444;
}

/* Logout Button */
.logout-btn {
    background: #e63946;
    color: white;
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: 0.3s;
}

.logout-btn:hover {
    background: #c62839;
}

/* Responsive */
@media(max-width: 768px) {
    .top-bar {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .top-right {
        width: 100%;
    }

    .logout-btn {
        display: block;
        width: 100%;
    }
}
</style>



<div class="dashboard-container">



    <!-- Main Content -->
    <div class="main-content">

        <div class="top-bar">
            <div class="top-left">
                <h2>Welcome, <?= $user["first_name"] . " " . $user["last_name"]; ?></h2>
                <p><?= $user["email"]; ?></p>
            </div>

            <div class="top-right">
                <button onclick="confirmLogout()" class="logout-btn">Logout</button>
            </div>

            <!-- SweetAlert2 CDN -->
            <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>

            <script>
            function confirmLogout() {
                Swal.fire({
                    title: "Are you sure?",
                    text: "You will be logged out!",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#e63946",
                    cancelButtonColor: "#6c757d",
                    confirmButtonText: "Yes, Logout",
                    cancelButtonText: "Cancel"
                }).then((result) => {
                    if (result.isConfirmed) {
                        window.location.href = "logout.php";
                    }
                });
            }
            </script>


        </div>



        <br>

        <!-- Info Cards -->
        <div class="grid">

            <!-- Company Info -->
            <div class="card">
                <h3>🏢 Company Info</h3>
                <p><strong>Name:</strong> <?= $user["company"]["company_name"]; ?></p>
                <p><strong>Industry:</strong> <?= $user["company"]["industry"]; ?></p>
                <p><strong>Size:</strong> <?= $user["company"]["company_size"]; ?></p>
                <p><strong>Country:</strong> <?= $user["company"]["country"]; ?></p>
            </div>

            <!-- Subscription Info -->
            <div class="card">
                <h3>📦 Subscription Plan</h3>
                <p><strong>Plan:</strong> <?= $user["subscription"]["name"]; ?></p>
                <p><strong>Price:</strong> ₹<?= $user["subscription"]["price"]; ?></p>
                <p><strong>Validity:</strong> <?= $user["subscription"]["validity_days"]; ?> days</p>
                <p><strong>Expires:</strong> <?= $user["subscription"]["expires_at"]; ?></p>
            </div>

            <!-- Business Info -->
            <div class="card">
                <h3>💼 Business Info</h3>
                <p><strong>Name:</strong> <?= $user["business"]["business_name"]; ?></p>
                <p><strong>Category:</strong> <?= $user["business"]["category"]; ?></p>
                <p><strong>Website:</strong> <?= $user["business"]["website"]; ?></p>
                <p><strong>Email:</strong> <?= $user["business"]["business_email"]; ?></p>
            </div>

        </div>



        <div>
            <iframe
                src="https://app.powerbi.com/view?r=eyJrIjoiNGVhNjhiOTQtODYzMi00NTBhLTlkYWUtMzNhOTA5NmUyYTViIiwidCI6IjdhYjFmZDg1LWFlY2QtNDgzMy1iZDA0LTVlYmFkMjUwYWM0NSJ9"
                frameborder="0" style="width:100%; height:90vh; border:0;">
            </iframe>
        </div>

    </div>
</div>

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