DB 계정을 입력하지 않고도 리셋이 가능한 옵션 추가
- 이미 기능이 사라진 N생성 버튼 제거 - 기존의 DB까지 포함한 초기화를 '완전 리셋' - 제대로 동작하지 않던 폐쇄중 로그인 변경 - 리셋 프로세스에 권한을 제대로 검사하지 않는 문제 해결
This commit is contained in:
@@ -163,4 +163,59 @@ function PrintElapsedTime() {
|
||||
$_endTime = round(getMicroTime() - $_startTime, 3);
|
||||
echo "<table width=1000 align=center style=font-size:10;><tr><td align=right>경과시간 : {$_endTime}초</td></tr></table>";
|
||||
}
|
||||
|
||||
function requireUserLevel($connect, $reqLevel=5){
|
||||
|
||||
if(isset($_SESSION['ownUserLevel']) && $_SESSION['ownUserLevel']>=$reqLevel){
|
||||
return;
|
||||
}
|
||||
|
||||
$p_id = isset($_SESSION['p_id'])?$_SESSION['p_id']:null;
|
||||
if(!$p_id){
|
||||
|
||||
$query = "select count(*) as cnt from general where userlevel < 4 limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$cnt = MYDB_fetch_array($result);
|
||||
|
||||
if($cnt['cnt'] == 0){
|
||||
//아직 제대로된 계정이 생성되지 않았다면 넘어간다.
|
||||
//서버 리셋시 ~ 첫 유저 계정 생성시까지 취약점이 되지만, 구조상 어쩔 수 없다.
|
||||
return;
|
||||
}
|
||||
|
||||
echo "
|
||||
<html>
|
||||
<head>
|
||||
<title>로그인 되지 않음</title>
|
||||
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
|
||||
<link rel=stylesheet href=stylesheet.php type=text/css>
|
||||
</head>
|
||||
<body>
|
||||
각 서버에 로그인이 되지 않아 유저 정보를 확인할 수 없습니다. 서버 접속을 수행해주세요.<br>
|
||||
</body>
|
||||
</html>";
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "select userlevel from general where user_id='$p_id'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
if($me['userlevel'] < $reqLevel) {
|
||||
echo "
|
||||
<html>
|
||||
<head>
|
||||
<title>권한 부족</title>
|
||||
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
|
||||
<link rel=stylesheet href=stylesheet.php type=text/css>
|
||||
</head>
|
||||
<body>
|
||||
충분한 권한이 없습니다.<br>
|
||||
</body>
|
||||
</html>";
|
||||
exit();
|
||||
}
|
||||
|
||||
$_SESSION['ownUserLevel'] = $reqLevel;
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user