commit
This commit is contained in:
36
kngil/bbs/adm_guard.php
Normal file
36
kngil/bbs/adm_guard.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
/* =========================
|
||||
1. 로그인 체크
|
||||
========================= */
|
||||
if (empty($_SESSION['login'])) {
|
||||
header('Location: /kngil/skin/index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
/* =========================
|
||||
2. 권한 체크
|
||||
========================= */
|
||||
$auth_bc = $_SESSION['login']['auth_bc'] ?? '';
|
||||
|
||||
$ALLOW_AUTH = [
|
||||
'BS100100', // 개발자
|
||||
'BS100200', // 관리자
|
||||
'BS100300', // 메인
|
||||
'BS100400', // 서브
|
||||
];
|
||||
|
||||
if (!in_array($auth_bc, $ALLOW_AUTH, true)) {
|
||||
http_response_code(403);
|
||||
echo '접근 권한이 없습니다.';
|
||||
exit;
|
||||
}
|
||||
|
||||
/* =========================
|
||||
3. 권한 플래그 (중요)
|
||||
========================= */
|
||||
define('IS_SUPER_ADMIN', in_array($auth_bc, ['BS100100','BS100200'], true));
|
||||
define('IS_COMPANY_ADMIN', in_array($auth_bc, ['BS100300','BS100400'], true));
|
||||
Reference in New Issue
Block a user