<?php
session_start();

if (!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] !== true) {
    echo <<<HTML
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
        <meta charset="UTF-8">
        <title>未登录</title>
        <link href="assets/css/bootstrap.min.css" rel="stylesheet">
    <link href="assets/css/sweetalert2.min.css" rel="stylesheet">
    <script src="assets/js/sweetalert2.all.min.js"></script>
    </head>
    <body>
    <script>
      Swal.fire({
        icon: 'warning',
        title: '没有权限',
        text: '请先登录后再访问',
        showConfirmButton: false,
        timer: 2000
      }).then(() => {
        window.location.href = 'login.php';
      });
    </script>
    </body>
    </html>
    HTML;
    exit;
}