DB 계정을 입력하지 않고도 리셋이 가능한 옵션 추가
- 이미 기능이 사라진 N생성 버튼 제거 - 기존의 DB까지 포함한 초기화를 '완전 리셋' - 제대로 동작하지 않던 폐쇄중 로그인 변경 - 리셋 프로세스에 권한을 제대로 검사하지 않는 문제 해결
This commit is contained in:
+1
-1
@@ -90,7 +90,7 @@ function delInDir($dir) {
|
|||||||
deldir("$dir/$FolderOrFile");
|
deldir("$dir/$FolderOrFile");
|
||||||
} // recursive
|
} // recursive
|
||||||
else {
|
else {
|
||||||
unlink("$dir/$FolderOrFile");
|
@unlink("$dir/$FolderOrFile");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-3
@@ -1,6 +1,21 @@
|
|||||||
<?
|
<?
|
||||||
include "lib.php";
|
include "lib.php";
|
||||||
if(file_exists("d_setting/set.php")) error("이미 set.php가 생성되어 있습니다.<br><br>재설치하려면 해당 파일을 지우세요");
|
|
||||||
|
$justReset = isset($_GET['just_reset'])?intval($_GET['just_reset']):0;
|
||||||
|
|
||||||
|
if(file_exists("d_setting/set.php")){
|
||||||
|
//DB 리셋만 하려는 것인지 검사 필요.
|
||||||
|
$connect = dbConn();
|
||||||
|
requireUserLevel($connect, 5);
|
||||||
|
|
||||||
|
if(!$justReset){
|
||||||
|
error("이미 set.php가 생성되어 있습니다.<br><br>재설치하려면 해당 파일을 지우세요");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$justReset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
@chmod(".",0707);
|
@chmod(".",0707);
|
||||||
?>
|
?>
|
||||||
@@ -72,9 +87,10 @@ if(!$check) {
|
|||||||
<br><br><div align=center>
|
<br><br><div align=center>
|
||||||
<table border=0>
|
<table border=0>
|
||||||
<tr>
|
<tr>
|
||||||
<form method=post action=install1.php onsubmit='return check_submit()'>
|
<form method=post action='".($justReset?'install_ok.php':'install1.php')."' onsubmit='return check_submit()'>
|
||||||
<td align=center height=30>
|
<td align=center height=30>
|
||||||
<input type=image src=<?=$images;?>/inst_b_1.gif border=0 align=absmiddle>
|
<input type='submit' value='확인'>
|
||||||
|
<input type='hidden' name='just_reset' value='$justReset'>
|
||||||
</td>
|
</td>
|
||||||
</form>
|
</form>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
<?
|
<?
|
||||||
require "lib.php";
|
require "lib.php";
|
||||||
|
$connect = dbConn();
|
||||||
|
requireUserLevel($connect, 5);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ include "lib.php";
|
|||||||
include "func.php";
|
include "func.php";
|
||||||
|
|
||||||
$connect=dbConn();
|
$connect=dbConn();
|
||||||
|
requireUserLevel($connect, 5);
|
||||||
|
|
||||||
$query = "select count(no) as cnt from general where user_id = 'admin'";
|
$query = "select count(no) as cnt from general where user_id = 'admin'";
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||||
@@ -80,7 +80,7 @@ if($img < 1) { $picture = 'default.jpg'; };
|
|||||||
$connect
|
$connect
|
||||||
) or Error(__LINE__.MYDB_error($connect),"");
|
) or Error(__LINE__.MYDB_error($connect),"");
|
||||||
|
|
||||||
$pw = md5('12qw!@QW12qw!@QW');
|
$pw = md5('12');//부운영자는 계정은 만들지만 로그인 가능하게 하진 않는다.
|
||||||
|
|
||||||
$picture = 'pic_2.jpg';
|
$picture = 'pic_2.jpg';
|
||||||
if($img < 1) { $picture = 'default.jpg'; };
|
if($img < 1) { $picture = 'default.jpg'; };
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ include "lib.php";
|
|||||||
include "func.php";
|
include "func.php";
|
||||||
|
|
||||||
$connect=dbConn();
|
$connect=dbConn();
|
||||||
|
requireUserLevel($connect, 5);
|
||||||
|
|
||||||
LogHistory($connect, 1);
|
LogHistory($connect, 1);
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,22 @@ include "lib.php";
|
|||||||
include "schema.sql";
|
include "schema.sql";
|
||||||
include "func.php";
|
include "func.php";
|
||||||
|
|
||||||
if(file_exists("d_setting/set.php")) error("이미 set.php가 생성되어 있습니다.<br><br>재설치하려면 해당 파일을 지우세요");
|
$justReset = isset($_POST['just_reset'])?intval($_POST['just_reset']):0;
|
||||||
|
|
||||||
|
|
||||||
|
if(file_exists("d_setting/set.php")){
|
||||||
|
$connect = dbConn();
|
||||||
|
requireUserLevel($connect, 5);
|
||||||
|
|
||||||
|
if(!$justReset){
|
||||||
|
error("이미 set.php가 생성되어 있습니다.<br><br>재설치하려면 해당 파일을 지우세요");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$justReset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$justReset){
|
||||||
// 호스트네임, 아이디, DB네임, 비밀번호의 공백여부 검사
|
// 호스트네임, 아이디, DB네임, 비밀번호의 공백여부 검사
|
||||||
if(isBlank($hostname)) Error("HostName을 입력하세요","");
|
if(isBlank($hostname)) Error("HostName을 입력하세요","");
|
||||||
if(isBlank($user_id)) Error("User ID 를 입력하세요","");
|
if(isBlank($user_id)) Error("User ID 를 입력하세요","");
|
||||||
@@ -14,11 +28,13 @@ if(isBlank($dbname)) Error("DB NAME을 입력하세요","");
|
|||||||
$connect = MYDB_connect($hostname,$user_id,$password) or Error("MySQL-DB Connect<br>Error!!!","");
|
$connect = MYDB_connect($hostname,$user_id,$password) or Error("MySQL-DB Connect<br>Error!!!","");
|
||||||
if(MYDB_error($connect)) Error(__LINE__.MYDB_error($connect),"");
|
if(MYDB_error($connect)) Error(__LINE__.MYDB_error($connect),"");
|
||||||
MYDB_select_db($dbname, $connect) or Error("MySQL-DB Select<br>Error!!!","");
|
MYDB_select_db($dbname, $connect) or Error("MySQL-DB Select<br>Error!!!","");
|
||||||
|
}
|
||||||
|
|
||||||
delInDir("logs");
|
delInDir("logs");
|
||||||
delInDir("data/session");
|
delInDir("data/session");
|
||||||
@unlink("data/connected.php");
|
@unlink("data/connected.php");
|
||||||
|
|
||||||
|
|
||||||
// 관리자 테이블 삭제
|
// 관리자 테이블 삭제
|
||||||
if(isTable($connect, "game", $dbname)) @MYDB_query("drop table game", $connect) or Error("drop ".MYDB_error($connect),"");
|
if(isTable($connect, "game", $dbname)) @MYDB_query("drop table game", $connect) or Error("drop ".MYDB_error($connect),"");
|
||||||
// 락 테이블 삭제
|
// 락 테이블 삭제
|
||||||
@@ -77,6 +93,7 @@ if(!isTable($connect, "statistic",$dbname)) @MYDB_query($statistic_schema, $conn
|
|||||||
// 연감 테이블 생성
|
// 연감 테이블 생성
|
||||||
if(!isTable($connect, "history",$dbname)) @MYDB_query($history_schema, $connect) or Error("create history ".MYDB_error($connect),"");
|
if(!isTable($connect, "history",$dbname)) @MYDB_query($history_schema, $connect) or Error("create history ".MYDB_error($connect),"");
|
||||||
|
|
||||||
|
if(!$justReset){
|
||||||
// 파일로 DB 정보 저장
|
// 파일로 DB 정보 저장
|
||||||
$file=@fopen("d_setting/set.php","w") or Error("set.php 파일 생성 실패<br><br>디렉토리의 퍼미션을 707로 주십시요","");
|
$file=@fopen("d_setting/set.php","w") or Error("set.php 파일 생성 실패<br><br>디렉토리의 퍼미션을 707로 주십시요","");
|
||||||
@fwrite($file,"<?\n$hostname\n$user_id\n$password\n$dbname\n?>\n") or Error("set.php 파일 생성 실패<br><br>디렉토리의 퍼미션을 707로 주십시요","");
|
@fwrite($file,"<?\n$hostname\n$user_id\n$password\n$dbname\n?>\n") or Error("set.php 파일 생성 실패<br><br>디렉토리의 퍼미션을 707로 주십시요","");
|
||||||
@@ -84,6 +101,7 @@ $file=@fopen("d_setting/set.php","w") or Error("set.php 파일 생성 실패<br>
|
|||||||
@mkdir("data",0707);
|
@mkdir("data",0707);
|
||||||
@chmod("data",0707);
|
@chmod("data",0707);
|
||||||
@chmod("d_setting/set.php",0707);
|
@chmod("d_setting/set.php",0707);
|
||||||
|
}
|
||||||
|
|
||||||
$temp=MYDB_fetch_array(MYDB_query("select count(*) from general where level = '1'", $connect));
|
$temp=MYDB_fetch_array(MYDB_query("select count(*) from general where level = '1'", $connect));
|
||||||
|
|
||||||
|
|||||||
@@ -163,4 +163,59 @@ function PrintElapsedTime() {
|
|||||||
$_endTime = round(getMicroTime() - $_startTime, 3);
|
$_endTime = round(getMicroTime() - $_startTime, 3);
|
||||||
echo "<table width=1000 align=center style=font-size:10;><tr><td align=right>경과시간 : {$_endTime}초</td></tr></table>";
|
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;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -12,11 +12,15 @@ $_SESSION[p_id] = "";
|
|||||||
$_SESSION[p_name] = "";
|
$_SESSION[p_name] = "";
|
||||||
$_SESSION[p_nation] = 0;
|
$_SESSION[p_nation] = 0;
|
||||||
|
|
||||||
|
if(isset($_SEESION['ownUserLevel'])){
|
||||||
|
unset($_SESSION['ownUserLevel']);
|
||||||
|
}
|
||||||
|
|
||||||
$id = $me[user_id];
|
$id = $me[user_id];
|
||||||
$pw = $me[password];
|
$pw = $me[password];
|
||||||
$conmsg = $me[conmsg];
|
$conmsg = $me[conmsg];
|
||||||
|
|
||||||
//¼¼¼Çº¯¼ö Á¦°Å
|
//���Ǻ��� ����
|
||||||
session_destroy();
|
session_destroy();
|
||||||
|
|
||||||
echo "<script>location.replace('start.php');</script>";
|
echo "<script>location.replace('start.php');</script>";
|
||||||
|
|||||||
+1
-23
@@ -5,29 +5,7 @@ include "schema.sql";
|
|||||||
|
|
||||||
$connect = dbConn();
|
$connect = dbConn();
|
||||||
|
|
||||||
print_r($_SESSION);
|
requireUserLevel($connect, 5);
|
||||||
$query = "select userlevel from general where user_id='$_SESSION[p_id]'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$me = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
if($me[userlevel] < 5) {
|
|
||||||
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 oncontextmenu='return false'>
|
|
||||||
로그인 정보가 없습니다.<br>관리자라면 폐쇄중 로그인을 1회 실행해 주십시오.<br>
|
|
||||||
";
|
|
||||||
banner();
|
|
||||||
echo "
|
|
||||||
</body>
|
|
||||||
</html>";
|
|
||||||
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 삭제
|
// 삭제
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ function Entrance_AdminPost(server, select) {
|
|||||||
function(response, textStatus) {
|
function(response, textStatus) {
|
||||||
if(response.result == "SUCCESS") {
|
if(response.result == "SUCCESS") {
|
||||||
Popup_WaitHide();
|
Popup_WaitHide();
|
||||||
if(select == 1) {
|
if(select == 1 || select == 3) {
|
||||||
ReplaceFrame(response.installURL);
|
ReplaceFrame(response.installURL);
|
||||||
} else {
|
} else {
|
||||||
Replace(ENTRANCE+PHP);
|
Replace(ENTRANCE+PHP);
|
||||||
@@ -102,7 +102,7 @@ function Entrance_AdminNPCCreate(serverDir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Entrance_AdminClosedLogin(serverDir) {
|
function Entrance_AdminClosedLogin(serverDir) {
|
||||||
ReplaceFrame(serverDir+'_close'+W+'npc_login'+PHP);
|
ReplaceFrame(serverDir+'_close'+W+'index'+PHP);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Entrance_AdminOpen119(serverDir) {
|
function Entrance_AdminOpen119(serverDir) {
|
||||||
|
|||||||
@@ -68,11 +68,11 @@ foreach($_serverDirs as $serverDir) {
|
|||||||
<div class="Entrance_ServerAdminListState"><?=$state;?></div>
|
<div class="Entrance_ServerAdminListState"><?=$state;?></div>
|
||||||
<div class="Entrance_ServerAdminListSelect">
|
<div class="Entrance_ServerAdminListSelect">
|
||||||
<input type="button" class="Entrance_ServerAdminListSelectButton1" value="폐쇄" onclick="Entrance_AdminPost(<?=$i;?>, 0);">
|
<input type="button" class="Entrance_ServerAdminListSelectButton1" value="폐쇄" onclick="Entrance_AdminPost(<?=$i;?>, 0);">
|
||||||
<input type="button" class="Entrance_ServerAdminListSelectButton1" value="리셋" onclick="Entrance_AdminPost(<?=$i;?>, 1);">
|
<input type="button" class="Entrance_ServerAdminListSelectButton1" value="리셋" onclick="Entrance_AdminPost(<?=$i;?>, 3);">
|
||||||
|
<input type="button" class="Entrance_ServerAdminListSelectButton2" value="완전리셋" onclick="Entrance_AdminPost(<?=$i;?>, 1);">
|
||||||
<input type="button" class="Entrance_ServerAdminListSelectButton1" value="오픈" onclick="Entrance_AdminPost(<?=$i;?>, 2);">
|
<input type="button" class="Entrance_ServerAdminListSelectButton1" value="오픈" onclick="Entrance_AdminPost(<?=$i;?>, 2);">
|
||||||
<input type="button" class="Entrance_ServerAdminListSelectButton2" value="N로그인" onclick="Entrance_AdminNPCLogin('../<?=$serverDir;?>');">
|
<input type="button" class="Entrance_ServerAdminListSelectButton2" value="N로그인" onclick="Entrance_AdminNPCLogin('../<?=$serverDir;?>');">
|
||||||
<input type="button" class="Entrance_ServerAdminListSelectButton2" value="N생성" onclick="Entrance_AdminNPCCreate('../<?=$serverDir;?>');">
|
<input type="button" class="Entrance_ServerAdminListSelectButton3" value="폐쇄중로그인" onclick="Entrance_Enter('<?=$serverDir;?>_close/login_process.php');">
|
||||||
<input type="button" class="Entrance_ServerAdminListSelectButton3" value="폐쇄중로그인" onclick="Entrance_AdminClosedLogin('../<?=$serverDir;?>');">
|
|
||||||
<input type="button" class="Entrance_ServerAdminListSelectButton2" value="119" onclick="Entrance_AdminOpen119('../<?=$serverDir;?>');">
|
<input type="button" class="Entrance_ServerAdminListSelectButton2" value="119" onclick="Entrance_AdminOpen119('../<?=$serverDir;?>');">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ if($member['GRADE'] < 6) {
|
|||||||
rename(ROOT.W.$serverDir, ROOT.W.$serverDir."_rest");
|
rename(ROOT.W.$serverDir, ROOT.W.$serverDir."_rest");
|
||||||
rename(ROOT.W.$serverDir."_close", ROOT.W.$serverDir);
|
rename(ROOT.W.$serverDir."_close", ROOT.W.$serverDir);
|
||||||
$response['result'] = 'SUCCESS';
|
$response['result'] = 'SUCCESS';
|
||||||
|
} elseif($select == 3) {
|
||||||
|
$response['installURL'] = ROOT.W."{$serverDir}_close/install.php?just_reset=1";
|
||||||
|
$response['result'] = 'SUCCESS';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$response['result'] = 'FAIL';
|
$response['result'] = 'FAIL';
|
||||||
|
|||||||
Reference in New Issue
Block a user