Files
edu/admin/skin/_auth_guard.php
T

26 lines
644 B
PHP

<?php
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
$memberId = (string)($_SESSION['member_id'] ?? '');
$authLevel = strtoupper(trim((string)($_SESSION['auth_level'] ?? '')));
if ($memberId === '') {
header('Location: /bbs/login.php');
exit;
}
if (!in_array($authLevel, ['LE10001', 'LE10002'], true)) {
http_response_code(403);
exit('접근 권한이 없습니다.');
}
$currentPage = basename((string)($_SERVER['PHP_SELF'] ?? ''));
$legalOnlyPage = 'legal_edu.php';
if ($authLevel === 'LE10002' && $currentPage !== $legalOnlyPage) {
header('Location: /admin/skin/' . $legalOnlyPage);
exit;
}