<?php
session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

require('../dbconfig/dbconfig.php'); 

if (!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] !== true) {
    header("Location: login.php"); // Redirect to the login page
    exit;
}

?>

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="styles/dashboard.css">
    <link rel="icon" type="image/x-icon" href="../assets/logo.png">
    <title>Admin Panel</title>
    <link rel="stylesheet"
        href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/css/bootstrap.min.css">
</head>

<body>
    <div class="container">
        <h2>Dashboard</h2>
        <div class="buttonl-container">
            <a href="logout.php" class="btn btn-logout">Log Out</a>
        </div>
    </div>
    <div class="dashboardContainer">
        <a href="UserDetailsreport.php" style="text-decoration: none; color:black">
            <div class="btnContainer">
                <h2>User Details</h2>
            </div>
        </a>
        <a href="WinnerDetailsReport.php" style="text-decoration: none; color:black">
            <div class="btnContainer">
                <h2>Winner Details</h2>
            </div>
</a>
    </div>
</body>

</html>

<?php
// Close the database connection if initialized
if (isset($conn)) {
    $conn->close();
}
?>