유저 권한을 $SESSION을 이용하는 형태로 변경
This commit is contained in:
@@ -4,12 +4,9 @@ require_once(ROOT.'/f_func/class._Session.php');
|
|||||||
|
|
||||||
$SESSION = new _Session();
|
$SESSION = new _Session();
|
||||||
|
|
||||||
if($SESSION->isLoggedIn() == false) {
|
if(!$SESSION->isLoggedIn()) {
|
||||||
// echo('<script>window.top.entrance.location.replace("'.ROOT.'/indexLogin.php");</script>');
|
header ("Location: ".ROOT);
|
||||||
header ("Location: ".ROOT.'/i_login/login.php');
|
die();
|
||||||
exit(1);
|
|
||||||
//echo('<script>window.top.entrance.location.replace("'.ROOT.'/i_login/login.php");</script>');
|
|
||||||
//exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ class _Session {
|
|||||||
unset($_SESSION['userGrade']);
|
unset($_SESSION['userGrade']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getGrade() {
|
||||||
|
return $_SESSION['userGrade'];
|
||||||
|
}
|
||||||
|
|
||||||
public function isLoggedIn() {
|
public function isLoggedIn() {
|
||||||
if($this->NoMember()){
|
if($this->NoMember()){
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -53,8 +53,9 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#user_info input{
|
#user_info button{
|
||||||
width: 200px; height: 50px;
|
width: 200px;
|
||||||
|
height: 50px;
|
||||||
margin: 10px 50px;
|
margin: 10px 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,14 @@ $notice = util::array_get($_POST['notice'], '');
|
|||||||
$server = util::array_get($_POST['server'], '');
|
$server = util::array_get($_POST['server'], '');
|
||||||
|
|
||||||
$db = getRootDB();
|
$db = getRootDB();
|
||||||
|
$userGrade = $SESSION->getGrade();
|
||||||
|
|
||||||
$member = $db->queryFirstRow('SELECT `GRADE` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember());
|
if($userGrade < 6) {
|
||||||
|
returnJson([
|
||||||
|
'result'=>'FAIL',
|
||||||
|
'msg'=>'운영자 권한이 없습니다.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
function doServerModeSet($server, $action, &$response){
|
function doServerModeSet($server, $action, &$response){
|
||||||
$serverList = getServerConfigList();
|
$serverList = getServerConfigList();
|
||||||
@@ -48,6 +54,7 @@ function doServerModeSet($server, $action, &$response){
|
|||||||
['allow_ip' => $allow_ip, 'xforward_allow_ip' => $xforward_allow_ip]);
|
['allow_ip' => $allow_ip, 'xforward_allow_ip' => $xforward_allow_ip]);
|
||||||
file_put_contents($serverPath.'/.htaccess', $htaccess);
|
file_put_contents($serverPath.'/.htaccess', $htaccess);
|
||||||
} elseif($action == 'reset') {//리셋
|
} elseif($action == 'reset') {//리셋
|
||||||
|
//FIXME: reset, reset_full 구현
|
||||||
if(file_exists($serverPath.'/d_setting/conf.php')){
|
if(file_exists($serverPath.'/d_setting/conf.php')){
|
||||||
@unlink($serverPath.'/d_setting/conf.php');
|
@unlink($serverPath.'/d_setting/conf.php');
|
||||||
}
|
}
|
||||||
@@ -63,13 +70,8 @@ function doServerModeSet($server, $action, &$response){
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function doAdminPost($member, $action, $notice, $server){
|
function doAdminPost($action, $notice, $server){
|
||||||
$response['result'] = 'FAIL';
|
$response['result'] = 'FAIL';
|
||||||
if($member['GRADE'] < 6) {
|
|
||||||
$response['result'] = 'FAIL';
|
|
||||||
$response['msg'] = '운영자 권한이 없습니다.';
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($action == 'notice') {
|
if($action == 'notice') {
|
||||||
getRootDB()->update('SYSTEM', ['NOTICE'=>$notice], 'NO=1');
|
getRootDB()->update('SYSTEM', ['NOTICE'=>$notice], 'NO=1');
|
||||||
@@ -86,6 +88,6 @@ function doAdminPost($member, $action, $notice, $server){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = doAdminPost($member, $action, $notice, $server);
|
$response = doAdminPost($action, $notice, $server);
|
||||||
|
|
||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
|
|||||||
@@ -6,9 +6,8 @@ require_once(ROOT.'/f_config/SESSION.php');
|
|||||||
$templates = new League\Plates\Engine('templates');
|
$templates = new League\Plates\Engine('templates');
|
||||||
|
|
||||||
$db = getRootDB();
|
$db = getRootDB();
|
||||||
$system = $db->queryFirstRow('SELECT `NOTICE` FROM `SYSTEM` WHERE `NO`=1');
|
$notice = $db->queryFirstField('SELECT `NOTICE` FROM `SYSTEM` WHERE `NO`=1');
|
||||||
$member = $db->queryFirstRow('SELECT ID, GRADE FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember());
|
$userGrade = $SESSION->getGrade();
|
||||||
$userGrade = $member['GRADE'];
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@@ -44,7 +43,7 @@ $userGrade = $member['GRADE'];
|
|||||||
<body>
|
<body>
|
||||||
<?php include("manage".W."Frame.php"); ?>
|
<?php include("manage".W."Frame.php"); ?>
|
||||||
<?php
|
<?php
|
||||||
if($member['GRADE'] >= 6) {
|
if($userGrade >= 6) {
|
||||||
include('member/Frame.php');
|
include('member/Frame.php');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -53,11 +52,11 @@ if($member['GRADE'] >= 6) {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
if($userGrade >= 6){
|
if($userGrade >= 6){
|
||||||
echo $templates->render('global_panel',['notice'=>$system['NOTICE']]);
|
echo $templates->render('global_panel',['notice'=>$notice]);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div id="server_notice"><span style="color:orange;font-size:2em;"><?=$system['NOTICE'];?></span></div>
|
<div id="server_notice"><span style="color:orange;font-size:2em;"><?=$notice?></span></div>
|
||||||
|
|
||||||
<table id="server_list_table">
|
<table id="server_list_table">
|
||||||
<caption class="bg2 section_title with_border">서 버 선 택</caption>
|
<caption class="bg2 section_title with_border">서 버 선 택</caption>
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ use utilphp\util as util;
|
|||||||
$select = $_GET['select'];
|
$select = $_GET['select'];
|
||||||
|
|
||||||
$db = getRootDB();
|
$db = getRootDB();
|
||||||
$member = $db->queryFirstRow('SELECT `GRADE` FROM `MEMBER` WHERE `no` = %i', $SESSION->NoMember());
|
$userGrade = $SESSION->getGrade();
|
||||||
if($member['GRADE'] < 6) {
|
if($userGrade < 6) {
|
||||||
$response['result'] = 'FAIL';
|
returnJson([
|
||||||
$response['msg'] = '운영자 권한이 없습니다.';
|
'result'=>'FAIL',
|
||||||
} else {
|
'msg'=>'운영자 권한이 없습니다.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$orderByStr = '';
|
$orderByStr = '';
|
||||||
switch($select) {
|
switch($select) {
|
||||||
@@ -71,8 +73,7 @@ if($member['GRADE'] < 6) {
|
|||||||
$response['state'] = "가입: {$system['REG']}, 로그인: {$system['LOGIN']}";
|
$response['state'] = "가입: {$system['REG']}, 로그인: {$system['LOGIN']}";
|
||||||
|
|
||||||
$response['result'] = 'SUCCESS';
|
$response['result'] = 'SUCCESS';
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode($response);
|
returnJson($response);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user