권한 없는 사용자의 메뉴 접근 방지를 위한 코드 추가

This commit is contained in:
2025-07-23 16:55:26 +09:00
parent cc2ee8cbb3
commit 99a9a6fd42
4 changed files with 30 additions and 11 deletions

View File

@ -2,6 +2,8 @@
// 베이커리 제품목록록
include_once "_common.php";
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
include_once 'head.sub.php';
include_once FG_MANAGER_PATH."/head.php";
// 검색 변수 초기화

View File

@ -3,6 +3,7 @@
include_once "_common.php";
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
include_once 'head.sub.php';
include_once FG_MANAGER_PATH."/head.php";
// 검색 변수 초기화

View File

@ -0,0 +1,13 @@
<?php
if (!isset($_SESSION['user_id'])) exit; //페이지 직접 실행 방지
// 권한부여 및 체크
$pageAuth = array(
'abc',
'firstgarden',
'bakery'
);
if ( !in_array($_SESSION['user_id'], $pageAuth) ) {
alert('권한이 없습니다', false);
}
?>

View File

@ -66,17 +66,20 @@
<li><a class="dropdown-item" href="<?=FG_MANAGER_URL.'/annual_member/annual_member_category.php'?>">연간회원 구분관리</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
베이커리
</a>
<ul class="dropdown-menu">
<li class="nav-item">
<a class="nav-link" href="<?=FG_MANAGER_URL.'/bakery/bakery_stock.php'?>">일일현황</a>
<a class="nav-link" href="<?=FG_MANAGER_URL.'/bakery/bakery_product_list.php'?>">제품목록관리</a>
</li>
</ul>
</li>
<?php if ($_SESSION['user_id'] === 'abc' || $_SESSION['user_id'] === 'firstgarden' || $_SESSION['user_id'] === 'bakery') { ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
베이커리
</a>
<ul class="dropdown-menu">
<li class="nav-item">
<a class="nav-link" href="<?=FG_MANAGER_URL.'/bakery/bakery_stock.php'?>">일일현황</a>
<a class="nav-link" href="<?=FG_MANAGER_URL.'/bakery/bakery_stock_view.php'?>">기간조회</a>
<a class="nav-link" href="<?=FG_MANAGER_URL.'/bakery/bakery_product_list.php'?>">제품목록관리</a>
</li>
</ul>
</li>
<?php } ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
관리자