diff --git a/f_config/DB.php b/f_config/DB.php index 58d04ce8..73bbf2da 100644 --- a/f_config/DB.php +++ b/f_config/DB.php @@ -1,10 +1,9 @@ IsExist()) { - $DB = new _DB($SETTING->DBHost(), $SETTING->DBId(), $SETTING->DBPw(), $SETTING->DBName()); +if($SETTING->isExist()) { + require_once($SETTING->getSettingFile()); } else { Error('설정 파일이 없습니다. 설정을 먼저 하십시요!'); } diff --git a/f_config/DBS.php b/f_config/DBS.php deleted file mode 100644 index 6f95263f..00000000 --- a/f_config/DBS.php +++ /dev/null @@ -1,13 +0,0 @@ -IsExist()) { - } else { - $DBS[$i] = new _DB($SETTINGS[$i]->DBHost(), $SETTINGS[$i]->DBId(), $SETTINGS[$i]->DBPw(), $SETTINGS[$i]->DBName()); - } -} - - diff --git a/f_config/MAIL.php b/f_config/MAIL.php index e056c4b9..3ac77b70 100644 --- a/f_config/MAIL.php +++ b/f_config/MAIL.php @@ -3,7 +3,7 @@ require_once('_common.php'); require_once(ROOT.W.F_FUNC.W.'class._Mail.php'); require_once(ROOT.W.F_CONFIG.W.SETTING.PHP); -if($SETTING->IsExist()) { +if($SETTING->isExist()) { $MAIL = new _Mail(); } else { Error('설정 파일이 없습니다. 설정을 먼저 하십시요!'); diff --git a/f_config/SETTING.php b/f_config/SETTING.php index 31d4665f..05e0bde1 100644 --- a/f_config/SETTING.php +++ b/f_config/SETTING.php @@ -2,6 +2,6 @@ require_once('_common.php'); require_once(ROOT.W.F_FUNC.W.'class._Setting.php'); -$SETTING = new _Setting(ROOT.W.D_SETTING.W.SET.PHP); +$SETTING = new _Setting(ROOT); diff --git a/f_config/SETTINGS.php b/f_config/SETTINGS.php deleted file mode 100644 index f1e91f30..00000000 --- a/f_config/SETTINGS.php +++ /dev/null @@ -1,11 +0,0 @@ -체섭', - '퀘섭', - '풰섭', - '퉤섭', - '훼섭' -); - -$_serverLevels = array( - 1, - 1, - 1, - 1, - 1 -); - - +$serverList = [ + 'che'=>['체', 'white', new _Setting(__DIR__.ROOT.W.'che')], + 'kwe'=>['퀘', 'yellow', new _Setting(__DIR__.ROOW.W.'kwe')], + 'pwe'=>['풰', 'orange', new _Setting(__DIR__.ROOW.W.'pwe')], + 'twe'=>['퉤', 'magenta', new _Setting(__DIR__.ROOW.W.'twe')], + 'hwe'=>['훼', 'red', new _Setting(__DIR__.ROOW.W.'hwe')] +]; diff --git a/f_config/config.php b/f_config/config.php index 2da12dbf..a7ceea7e 100644 --- a/f_config/config.php +++ b/f_config/config.php @@ -40,12 +40,9 @@ define('INC', 'Inc.php'); define('APP', 'app'); define('FUNC', 'func'); define('DB', 'DB'); -define('DBS', 'DBS'); define('SESSION', 'SESSION'); define('CONFIG', 'config'); -define('SET', 'set'); define('SETTING', 'SETTING'); -define('SETTINGS', 'SETTINGS'); define('RETRIVAL', 'retrival'); define('INSTALL', 'install'); diff --git a/f_func/class._Chat.php b/f_func/class._Chat.php index ce9459c1..60a805da 100644 --- a/f_func/class._Chat.php +++ b/f_func/class._Chat.php @@ -1,6 +1,5 @@ objDB = ADONewConnection('mysqli'); // 예 'mysql' 또는 'postgres' -// $this->objDB->debug = true; - $this->objDB->debug = false; - $this->objDB->Connect($host, $id, $pw, $db) or Error('DB Connect() error: '.$db); - // 성능을 고려해 PConnect 조사 - $this->objDB->SetFetchMode(ADODB_FETCH_ASSOC); - $this->objDB->Execute('set names utf8'); - - $this->setting = "{$host}//{$id}//{$db}"; - } - - public function GetSetting() { - return $this->setting; - } - - public function QueryNoError($strQuery) { - return $this->objDB->Execute($strQuery); - } - - public function Query($strQuery) { - $rs = $this->objDB->Execute($strQuery) or Error($strQuery); - return $rs; - } - - public function Count($rs) { - if($rs == null) { - return 0; - } - return $rs->RecordCount(); - } - - public function HasNext($rs) { - return !$rs->EOF; - } - - public function GetAll($rs) { - return $rs->GetRows(); - } - - public function Get($rs) { - return $rs->fields; - } - - public function MoveNext($rs) { - $rs->MoveNext(); - } - - public function Next($rs) { - $obj = $rs->fields; - $rs->MoveNext(); - return $obj; - } - - public function Select($strFields, $strTable, $strCondition=NULL, $strGroupByField=NULL, $strHavingCondition=NULL) { - $strQuery = "SELECT {$strFields} FROM {$strTable}"; - if($strCondition != NULL) { - $strQuery .= " WHERE {$strCondition}"; - if($strGroupByField != NULL) { - $strQuery .= " GROUP BY {$strGroupByField}"; - if($strHavingCondition != NULL) { - $strQuery .= " HAVING {$strHavingCondition}"; - } - } - } - - return $this->objDB->Execute($strQuery); - } - - public function Insert($strTable, $strFields, $strValues) { - $strQuery = "INSERT INTO {$strTable} ({$strFields}) VALUES ({$strValues})"; - $this->objDB->Execute($strQuery); - } - - public function InsertArray($strTable, $arrVals) { - $arrFields = array(); - $arrValues = array(); - - foreach($arrVals as $strKey => $strVal) { - $arrFields[] = $strKey; - $arrValues[] = $strVal; - } - - $strFields = implode(',', $arrFields); - $strValues = implode("','", $arrValues); - $strValues = "'".$strValues."'"; - - $strQuery = "INSERT INTO {$strTable} ({$strFields}) VALUES ({$strValues})"; - - $this->objDB->Execute($strQuery); - } - - public function Update($strTable, $strSetting, $strCondition=NULL) { - $strQuery = "UPDATE {$strTable} SET {$strSetting}"; - if($strCondition != NULL) { - $strQuery .= " WHERE {$strCondition}"; - } - - $this->objDB->Execute($strQuery); - } - - public function UpdateArray($strTable, $arrVals, $strCondition=NULL) { - $arrSetting = array(); - - foreach($arrVals as $strKey => $strVal) { - $arrSetting[] = "{$strKey}='{$strVal}'"; - } - - $strSetting = implode(',', $arrSetting); - - $strQuery = "UPDATE {$strTable} SET {$strSetting}"; - if($strCondition != NULL) { - $strQuery .= " WHERE {$strCondition}"; - } - - $this->objDB->Execute($strQuery); - } - - public function Delete($strTable, $strCondition=NULL) { - $strQuery = "DELETE FROM {$strTable}"; - if($strCondition != NULL) { - $strQuery .= " WHERE {$strCondition}"; - } - - $this->objDB->Execute($strQuery); - } - - public function __destruct() { - $this->objDB->Close(); - } - - public function Qstr($str) { - return $this->objDB->qstr($str); - } -} - - diff --git a/f_func/class._Log.php b/f_func/class._Log.php index acc92361..f26a3462 100644 --- a/f_func/class._Log.php +++ b/f_func/class._Log.php @@ -1,7 +1,5 @@ settingFile = $filename; + public function __construct($basepath) { + $this->basepath = realpath($basepath); + $this->settingFile = realpath($basepath.D_SETTING.W.'conf.php'); - if(file_exists($filename)) { - $this->isExist = 1; - - $f = @file($filename); - $this->dbHost = trim(str_replace("\n", "", $f[1])); - $this->dbId = trim(str_replace("\n", "", $f[2])); - $this->dbPw = trim(str_replace("\n", "", $f[3])); - $this->dbName = trim(str_replace("\n", "", $f[4])); - if(count($f) > 10){ - $this->mailHost = trim(str_replace("\n", "", $f[5])); - $this->mailPort = trim(str_replace("\n", "", $f[6])); - $this->mailId = trim(str_replace("\n", "", $f[7])); - $this->mailPw = trim(str_replace("\n", "", $f[8])); - $this->mailAddr = trim(str_replace("\n", "", $f[9])); - } - + if(file_exists($this->settingFile)) { + $this->exist = 1; } } - public function IsExist() { - return $this->isExist; + public function isExist() { + return $this->exist; } - public function DBHost() { - return $this->dbHost; + public function getShortName(){ + return basename($this->basepath); } - public function DBId() { - return $this->dbId; + public function getBasePath(){ + return $this->basepath; } - public function DBPw() { - return $this->dbPw; - } - - public function DBName() { - return $this->dbName; - } - - public function MailHost() { - return $this->mailHost; - } - - public function MailPort() { - return $this->mailPort; - } - - public function MailId() { - return $this->mailId; - } - - public function MailPw() { - return $this->mailPw; - } - - public function MailAddr() { - return $this->mailAddr; + public function getSettingFile() { + return $this->settingFile; } } diff --git a/f_install/common_schema.sql b/f_install/common_schema.sql index 4e021a15..d3e7c589 100644 --- a/f_install/common_schema.sql +++ b/f_install/common_schema.sql @@ -10,23 +10,6 @@ CREATE TABLE SYSTEM ( PRIMARY KEY (NO) ) ENGINE=MYISAM DEFAULT CHARSET=UTF8; --- 참여 테이블 -CREATE TABLE DONATION ( - NO INT NOT NULL AUTO_INCREMENT, - ID VARCHAR(64) NOT NULL, - NAME VARCHAR(64) NOT NULL, - RNAME VARCHAR(64) NOT NULL, - SUBNAME VARCHAR(64) NOT NULL, - DATE DATE NOT NULL, - AMOUNT INT NOT NULL, - CUMUL INT NOT NULL, - TOTAL INT NOT NULL, - - PRIMARY KEY (NO), - KEY (ID), - KEY (NAME) -) ENGINE=MYISAM DEFAULT CHARSET=UTF8; - -- 회원 테이블 CREATE TABLE MEMBER ( NO INT NOT NULL AUTO_INCREMENT, diff --git a/f_install/install1.php b/f_install/install1.php index 5eed4764..1af7c292 100644 --- a/f_install/install1.php +++ b/f_install/install1.php @@ -1,7 +1,7 @@ diff --git a/f_install/install1Post.php b/f_install/install1Post.php index 14888ab5..96c6a175 100644 --- a/f_install/install1Post.php +++ b/f_install/install1Post.php @@ -15,24 +15,21 @@ $mailAddr = $_POST['mailAddr']; require_once(ROOT.W.F_FUNC.W.'class._DB.php'); require_once(ROOT.W.F_FUNC.W.'class._String.php'); -if(file_exists(ROOT.W.D_SETTING.W.SET.PHP)) ErrorToScreen('이미 설치되어 있습니다. 재설치하려면 설정 파일을 지우세요.'); +if(file_exists(ROOT.W.D_SETTING.W.'conf.php')) ErrorToScreen('이미 설치되어 있습니다. 재설치하려면 설정 파일을 지우세요.'); if(fileperms(ROOT.W.D_SETTING.W) != 040707 && fileperms(ROOT.W.D_SETTING.W) != 040777) ErrorToScreen('설정 디렉토리 권한을 707 또는 777로 설정해주세요.'); -$DB = new _DB($dbHost, $dbId, $dbPw, $dbName); - +$db = getRootDB(); //로그 등 삭제 $tables = array( 'SYSTEM', 'MEMBER', - 'DONATION', 'EMAIL' ); //테이블 삭제 -for($i=0; $i < count($tables); $i++) { - $query = "DROP TABLE {$tables[$i]}"; - $DB->QueryNoError($query); +foreach($tables as $table){ + $db->query('DROP TABLE IF EXISTS %b', $table); } //테이블 생성 @@ -44,15 +41,15 @@ $querys = explode(';', $file); foreach($querys as $query) { $query = trim($query); if($query != "") { - $DB->Query($query); + $db->query($query); } } // 파일로 DB 정보 저장 -$file = @fopen(ROOT.W.D_SETTING.W.SET.PHP, 'w') or ErrorToScreen('설정 실패. 디렉토리의 퍼미션을 707로 주십시요'); +$file = @fopen(ROOT.W.D_SETTING.W.'conf.php', 'w') or ErrorToScreen('설정 실패. 디렉토리의 퍼미션을 707로 주십시요'); @fwrite($file, " diff --git a/f_install/install2Post.php b/f_install/install2Post.php index c293ec35..f35ba763 100644 --- a/f_install/install2Post.php +++ b/f_install/install2Post.php @@ -10,7 +10,7 @@ require_once(ROOT.W.F_FUNC.W.'class._Time.php'); require_once(ROOT.W.F_CONFIG.W.DB.PHP); // 시스템정보 1개 등록 -$DB->InsertArray('SYSTEM', array( +$db->insert('SYSTEM', array( 'REG' => 'N', 'LOGIN' => 'N', 'CRT_DATE' => _Time::DatetimeNow(), @@ -18,7 +18,7 @@ $DB->InsertArray('SYSTEM', array( )); // 운영자 1명 등록 -$DB->InsertArray('MEMBER', array( +$db->insert('MEMBER', array( 'ID' => $id, 'PW' => $pw, 'PID' => '-', @@ -31,9 +31,9 @@ $DB->InsertArray('MEMBER', array( // 부운영자 1명 등록 -$DB->InsertArray('MEMBER', array( +$db->insert('MEMBER', array( 'ID' => 'viceadmin', - 'PW' => md5('12qw!@QWQPQP%12qw!@QWQPQP%'), + 'PW' => 'aZ', 'PID' => '-', 'NAME' => '부운영자', 'EMAIL' => 'nomail@nomail.com', diff --git a/i_entrance/Action.js b/i_entrance/Action.js index a4de95e4..df3769ab 100644 --- a/i_entrance/Action.js +++ b/i_entrance/Action.js @@ -78,33 +78,3 @@ function Entrance_Logout() { ) }); } - -//TODO: 재설계 -function Entrance_Enter(serverDir) { - Popup_Wait(function() { - PostJSON( - HOME+I+ENTRANCE+W+"enterPost", { - }, - function(response, textStatus) { - if(response.result == "SUCCESS") { - var form = $("
"); - $(form).attr("action", HOME+serverDir); - $(form).attr("method", "post"); - - var id = $(""); - $(id).attr("value", response.id); - var pw = $(""); - $(pw).attr("value", response.pw); - var conmsg = $(""); - $(conmsg).attr("value", response.conmsg); - - $(form).append(id).append(pw).append(conmsg); - $("body").append(form); - $(form).submit(); - } else { - Popup_WaitShow("입장 실패!"); - } - } - ) - }); -} diff --git a/i_entrance/Frame.php b/i_entrance/Frame.php index 106f7193..310b7005 100644 --- a/i_entrance/Frame.php +++ b/i_entrance/Frame.php @@ -3,18 +3,16 @@ require_once('_common.php'); require_once(ROOT.W.F_CONFIG.W.DB.PHP); require_once(ROOT.W.F_CONFIG.W.SESSION.PHP); -$rs = $DB->Select('NOTICE', 'SYSTEM', "NO='1'"); -$system = $DB->Get($rs); +$db = getRootDB(); +$system = $db->queryFirstRow('SELECT `NOTICE` FROM `SYSTEM` WHERE `NO`=1'); -$rs = $DB->Select('ID, GRADE', 'MEMBER', "NO='{$SESSION->NoMember()}'"); -$member = $DB->Get($rs); +$member = $db->queryFirstRow('SELECT ID, GRADE FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember()); ?> = 6) { - include(DONATION.W.FRAME); include(MEMBER.W.FRAME); } ?> diff --git a/i_entrance/adminInc.php b/i_entrance/adminInc.php index 50e24da9..5a060b3d 100644 --- a/i_entrance/adminInc.php +++ b/i_entrance/adminInc.php @@ -15,7 +15,6 @@ Entrance_AdminUpdate();
회 원 관 리
- @@ -30,19 +29,22 @@ Entrance_AdminUpdate();
getBasePath(); + $serverDir = $settingObj->getShortName(); //TODO: .htaccess가 서버 오픈에도 사용될 수 있으니 별도의 방법이 필요함 if(!is_dir($serverPath)){ $state = '상태이상, 01'; } - else if(!file_exists($realServerPath.'/index.php')){ + else if(!file_exists($serverPath.'/index.php')){ $state = '상태이상, 02'; } - else if(file_exists($realServerPath.'/.htaccess')) { + else if(file_exists($serverPath.'/.htaccess')) { // 폐쇄중 - if(file_exists($realServerPath.W.D_SETTING.W.SET.PHP)) { + if($settingObj->isExist()) { // 폐쇄중, 설정있음 $state = '폐쇄중, 설정있음'; } else { @@ -51,7 +53,7 @@ foreach($_serverDirs as $serverDir) { } } else{ // 오픈중 - if(file_exists($realServerPath.W.D_SETTING.W.SET.PHP)) { + if($settingObj->isExist()) { // 서비스중 $state = '서비스중'; } else { @@ -60,10 +62,6 @@ foreach($_serverDirs as $serverDir) { } } - /*else { - // 이상함 - $state = '상태이상, 03'; - }*/ ?>
@@ -79,7 +77,6 @@ foreach($_serverDirs as $serverDir) {
diff --git a/i_entrance/adminPost.php b/i_entrance/adminPost.php index 711ce6e6..ebd1c42c 100644 --- a/i_entrance/adminPost.php +++ b/i_entrance/adminPost.php @@ -21,19 +21,20 @@ $notice = util::array_get($_POST['notice'], ''); $server = util::array_get($_POST['server'], ''); $select = util::array_get($_POST['select'], ''); +$db = getRootDB(); -$rs = $DB->Select('GRADE', 'MEMBER', "NO='{$SESSION->NoMember()}'"); -$member = $DB->Get($rs); +$member = $db->queryFirstRow('SELECT `GRADE` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember()); function doServerModeSet($server, $select, &$response){ - global $_serverDirs; - $serverDir = $_serverDirs[$server]; - $serverPath = ROOT.W.$serverDir; + global $serverList; + $settingObj = $serverList[$server][2]; + + $serverDir = $settingObj->getShortName(); + $serverPath = $settingObj->getBasePath(); $realServerPath = realpath(dirname(__FILE__)).W.$serverPath; if($select == 0) { //폐쇄 $templates = new League\Plates\Engine('templates'); - //TODO: .htaccess가 서버 오픈에도 사용될 수 있으니 별도의 방법이 필요함 $allow_ip = util::get_client_ip(false); @@ -48,16 +49,16 @@ function doServerModeSet($server, $select, &$response){ $htaccess = $templates->render('block_htaccess', ['allow_ip' => $allow_ip, 'xforward_allow_ip' => $xforward_allow_ip]); - file_put_contents($realServerPath.'/.htaccess', $htaccess); + file_put_contents($serverPath.'/.htaccess', $htaccess); } elseif($select == 1) {//리셋 - if(file_exists($realServerPath.W.D_SETTING.W.SET.PHP)){ - @unlink($realServerPath.W.D_SETTING.W.SET.PHP); + if(file_exists($serverPath.W.D_SETTING.W.'conf.php')){ + @unlink($serverPath.W.D_SETTING.W.'conf.php'); } - $response['installURL'] = $serverPath.W."install.php"; + $response['installURL'] = $serverDir.W."install.php"; } elseif($select == 2) {//오픈 - if(file_exists($realServerPath.'.htaccess')){ - @unlink($realServerPath.'.htaccess'); + if(file_exists($serverPath.'.htaccess')){ + @unlink($serverPath.'.htaccess'); } } return true; @@ -72,7 +73,7 @@ function doAdminPost($member, $action, $notice, $server, $select){ } if($action == 0) { - $DB->Update('SYSTEM', "NOTICE='{$notice}'", 'NO=1'); + $db->update('SYSTEM', ['NOTICE'=>$notice], 'NO=1'); $response['result'] = 'SUCCESS'; return $response; } @@ -93,5 +94,4 @@ function doAdminPost($member, $action, $notice, $server, $select){ $response = doAdminPost($member, $action, $notice, $server, $select); -sleep(1); echo json_encode($response); diff --git a/i_entrance/donation/Action.js b/i_entrance/donation/Action.js deleted file mode 100644 index ba5c97e5..00000000 --- a/i_entrance/donation/Action.js +++ /dev/null @@ -1,96 +0,0 @@ -function EntranceDonation_Import() { -} - -function EntranceDonation_Init() { - $("#EntranceDonation_0001").click(EntranceDonation_Back); - $("#EntranceDonation_000200").click(function() { EntranceDonation_Calculate(); }); - $("#EntranceDonation_000308").click(function() { EntranceDonation_Donate(); }); -} - -function EntranceDonation_Update() { - EntranceDonation_UpdateDonation(); -} - -function EntranceDonation_Back() { - $("#EntranceDonation_00").hide(); - - $("#Entrance_00").show(); - Entrance_Update(); -} - -function EntranceDonation_UpdateDonation() { - Popup_Wait(function() { - GetJSON( - HOME+I+ENTRANCE+W+DONATION+W+GET, { - }, - function(response, textStatus) { - if(response.result == "SUCCESS") { - $("#EntranceDonation_0005").html(response.donations); - $("#EntranceDonation_000301").val(response.date); - Popup_WaitHide(); - } else { - Popup_WaitShow("처리 실패!"); - } - } - ) - }); -} - -function EntranceDonation_Calculate() { - Popup_Wait(function() { - PostJSON( - HOME+I+ENTRANCE+W+DONATION+W+"calculate"+POST, { - }, - function(response, textStatus) { - if(response.result == "SUCCESS") { - $("#EntranceDonation_000301").val(""); - $("#EntranceDonation_000302").val(""); - $("#EntranceDonation_000303").val(""); - $("#EntranceDonation_000304").val(""); - $("#EntranceDonation_000305").val(""); - $("#EntranceDonation_000306").val(""); - Popup_WaitHide(); - EntranceDonation_UpdateDonation(); - } else { - Popup_WaitShow("처리 실패!"); - } - } - ) - }); -} - -function EntranceDonation_Donate() { - var date = $("#EntranceDonation_000301").val(); - var id = $("#EntranceDonation_000302").val(); - var name = $("#EntranceDonation_000303").val(); - var rname = $("#EntranceDonation_000304").val(); - var subname = $("#EntranceDonation_000305").val(); - var amount = $("#EntranceDonation_000306").val(); - - Popup_Wait(function() { - PostJSON( - HOME+I+ENTRANCE+W+DONATION+W+POST, { - date: date, - id: id, - name: name, - rname: rname, - subname: subname, - amount: amount - }, - function(response, textStatus) { - if(response.result == "SUCCESS") { - $("#EntranceDonation_000301").val(""); - $("#EntranceDonation_000302").val(""); - $("#EntranceDonation_000303").val(""); - $("#EntranceDonation_000304").val(""); - $("#EntranceDonation_000305").val(""); - $("#EntranceDonation_000306").val(""); - Popup_WaitHide(); - EntranceDonation_UpdateDonation(); - } else { - Popup_WaitShow("처리 실패!"); - } - } - ) - }); -} diff --git a/i_entrance/donation/Frame.php b/i_entrance/donation/Frame.php deleted file mode 100644 index f7d5a032..00000000 --- a/i_entrance/donation/Frame.php +++ /dev/null @@ -1,44 +0,0 @@ - - - - -
-
- 참 여 기 록 -
- -
- -
-
-
-
- - - - - - -
-
- -
-
-
순번
-
일자
-
ID
-
이름
-
입금자
-
닉네임
-
금액
-
개인누적
-
총누적
-
-
-
-
diff --git a/i_entrance/donation/Get.php b/i_entrance/donation/Get.php deleted file mode 100644 index 9e59292a..00000000 --- a/i_entrance/donation/Get.php +++ /dev/null @@ -1,46 +0,0 @@ -Select('GRADE', 'MEMBER', "NO='{$SESSION->NoMember()}'"); -$member = $DB->Get($rs); - -if($member['GRADE'] < 6) { - $response['result'] = 'FAIL'; - $response['msg'] = '운영자 권한이 없습니다.'; -} else { - $response['donations'] = ''; - - $rs = $DB->Select('NO, ID, NAME, RNAME, SUBNAME, DATE, AMOUNT, CUMUL, TOTAL', 'DONATION', '1 ORDER BY DATE DESC, NO DESC'); - while($DB->HasNext($rs)) { - $donation = $DB->Next($rs); - - $response['donations'] .= " - - - - - - - - - - - "; - } - $response['donations'] .= '
{$donation['NO']}{$donation['DATE']}{$donation['ID']}{$donation['NAME']}{$donation['RNAME']}{$donation['SUBNAME']}{$donation['AMOUNT']}{$donation['CUMUL']}{$donation['TOTAL']}
'; - $response['date'] = _Time::DateToday(); - - $response['result'] = 'SUCCESS'; -} - -sleep(1); -echo json_encode($response); - - diff --git a/i_entrance/donation/Post.php b/i_entrance/donation/Post.php deleted file mode 100644 index 0ca5eec5..00000000 --- a/i_entrance/donation/Post.php +++ /dev/null @@ -1,58 +0,0 @@ -Select('GRADE', 'MEMBER', "NO='{$SESSION->NoMember()}'"); -$member = $DB->Get($rs); - -if($member['GRADE'] < 6) { - $response['result'] = 'FAIL'; - $response['msg'] = '운영자 권한이 없습니다.'; -} else { - if($subname == "") { - $rs = $DB->Select('NAME', 'MEMBER', "ID='{$id}'"); - $donator = $DB->Get($rs); - $subname = $donator['NAME']; - } - - $rs = $DB->Select('SUM(AMOUNT) AS CUM', 'DONATION', "ID='{$id}'"); - $donator = $DB->Get($rs); - $cumul = $donator['CUM'] + $amount; - - $rs = $DB->Select('SUM(AMOUNT) AS TOT', 'DONATION'); - $donator = $DB->Get($rs); - $total = $donator['TOT'] + $amount; - - $DB->InsertArray('DONATION', array( - 'ID' => $id, - 'NAME' => $name, - 'RNAME' => $rname, - 'SUBNAME' => $subname, - 'DATE' => $date, - 'AMOUNT' => $amount, - 'CUMUL' => $cumul, - 'TOTAL' => $total - )); - - $response['result'] = 'SUCCESS'; -} - -echo json_encode($response); - - diff --git a/i_entrance/donation/Style.css b/i_entrance/donation/Style.css deleted file mode 100644 index 2c898d41..00000000 --- a/i_entrance/donation/Style.css +++ /dev/null @@ -1,178 +0,0 @@ -@charset "utf-8"; - -#EntranceDonation_00 { - width: 800px; height: 20px; - border: none; - position: absolute; - top: 20px; left: 50%; - margin-left: -400px; /* DIV박스 크기의 1/2로 마진을 잡아줍니다. */ - display: none; - z-index: 2; -} - -#EntranceDonation_0000 { - width: 800px; height: 50px; - position: absolute; top: 0px; left: 0px; -} - -#EntranceDonation_0001 { - width: 100px; height: 30px; - position: absolute; top: 10px; left: 650px; -} - -#EntranceDonation_0002 { - width: 800px; height: 20px; - position: absolute; top: 52px; left: 0px; -} - -#EntranceDonation_000200 { - width: 100px; height: 20px; -} - -#EntranceDonation_0003 { - width: 800px; height: 20px; - position: absolute; top: 74px; left: 0px; - border: none; -} - -#EntranceDonation_000300 { - width: 48px; height: 20px; - float: left; -} - -#EntranceDonation_000301 { - width: 96px; height: 16px; - float: left; -} - -#EntranceDonation_000302 { - width: 96px; height: 16px; - float: left; -} - -#EntranceDonation_000303 { - width: 96px; height: 16px; - float: left; -} - -#EntranceDonation_000304 { - width: 96px; height: 16px; - float: left; -} - -#EntranceDonation_000305 { - width: 96px; height: 16px; - float: left; -} - -#EntranceDonation_000306 { - width: 66px; height: 16px; - float: left; -} - -#EntranceDonation_000307 { - width: 78px; height: 20px; - float: left; -} - -#EntranceDonation_000308 { - width: 100px; height: 20px; - float: left; -} - -#EntranceDonation_0004 { - width: 800px; height: 20px; - position: absolute; top: 96px; left: 0px; - border: none; -} - -#EntranceDonation_000400 { - width: 48px; height: 20px; - float: left; -} - -#EntranceDonation_000401 { - width: 98px; height: 20px; - float: left; -} - -#EntranceDonation_000402 { - width: 98px; height: 20px; - float: left; -} - -#EntranceDonation_000403 { - width: 98px; height: 20px; - float: left; -} - -#EntranceDonation_000404 { - width: 98px; height: 20px; - float: left; -} - -#EntranceDonation_000405 { - width: 98px; height: 20px; - float: left; -} - -#EntranceDonation_000406 { - width: 68px; height: 20px; - float: left; -} - -#EntranceDonation_000407 { - width: 78px; height: 20px; - float: left; -} - -#EntranceDonation_000408 { - width: 98px; height: 20px; - float: left; -} - -#EntranceDonation_0005 { - width: 800px; height: 20px; - position: absolute; top: 118px; left: 0px; - border: none; -} - -#EntranceDonation_000500 { - border: none; -} - -.EntranceDonation_00050000 { - width: 48px; -} - -.EntranceDonation_00050001 { - width: 98px; -} - -.EntranceDonation_00050002 { - width: 98px; -} - -.EntranceDonation_00050003 { - width: 98px; -} - -.EntranceDonation_00050004 { - width: 98px; -} - -.EntranceDonation_00050005 { - width: 98px; -} - -.EntranceDonation_00050006 { - width: 68px; -} - -.EntranceDonation_00050007 { - width: 78px; -} - -.EntranceDonation_00050008 { - width: 98px; -} diff --git a/i_entrance/donation/_common.php b/i_entrance/donation/_common.php deleted file mode 100644 index d7a78a7b..00000000 --- a/i_entrance/donation/_common.php +++ /dev/null @@ -1,10 +0,0 @@ -Select('GRADE', 'MEMBER', "NO='{$SESSION->NoMember()}'"); -$member = $DB->Get($rs); - -if($member['GRADE'] < 6) { - $response['result'] = 'FAIL'; - $response['msg'] = '운영자 권한이 없습니다.'; -} else { - //개인누적계산 - $rs = $DB->Select('ID', 'DONATION', '1', 'ID'); - while($DB->HasNext($rs)) { - $donator = $DB->Next($rs); - $cumul = 0; - - $rs2 = $DB->Select('NO, AMOUNT', 'DONATION', "ID='{$donator['ID']}' ORDER BY DATE, NO"); - while($DB->HasNext($rs2)) { - $donation = $DB->Next($rs2); - $cumul += $donation['AMOUNT']; - - $DB->Update('DONATION', "CUMUL='{$cumul}'", "NO='{$donation['NO']}'"); - } - } - - $total = 0; - //총누적계산 - $rs = $DB->Select('NO, AMOUNT', 'DONATION', '1 ORDER BY DATE, NO'); - while($DB->HasNext($rs)) { - $donation = $DB->Next($rs); - $total += $donation['AMOUNT']; - - $DB->Update('DONATION', "TOTAL='{$total}'", "NO='{$donation['NO']}'"); - } - - $response['result'] = 'SUCCESS'; -} - -echo json_encode($response); - - diff --git a/i_entrance/enterPost.php b/i_entrance/enterPost.php deleted file mode 100644 index eb7e8b0b..00000000 --- a/i_entrance/enterPost.php +++ /dev/null @@ -1,22 +0,0 @@ -Select('ID, PW, CONMSG', 'MEMBER', "NO='{$SESSION->NoMember()}'"); -$member = $DB->Get($rs); - -$response['id'] = $member['ID']; -$response['pw'] = $member['PW'].md5(rand()%100000000);; -$response['conmsg'] = $member['CONMSG']; - -$response['result'] = 'SUCCESS'; - -sleep(1); -echo json_encode($response); diff --git a/i_entrance/manage/Action.js b/i_entrance/manage/Action.js index 5f119400..847c905e 100644 --- a/i_entrance/manage/Action.js +++ b/i_entrance/manage/Action.js @@ -20,7 +20,7 @@ function EntranceManage_Init() { function EntranceManage_Update() { Popup_Wait(function() { PostJSON( - HOME+I+ENTRANCE+W+MANAGE+W+GET, { + HOME+I+ENTRANCE+W+MANAGE+W+'Get.php', { }, function(response, textStatus) { if(response.result == "SUCCESS") { @@ -50,7 +50,6 @@ function EntranceManage_UpdateInfo(member) { $("#EntranceManage_0010").text(member.grade); $("#EntranceManage_001500").attr("src", member.picture0); $("#EntranceManage_001501").attr("src", member.picture1); - $("#EntranceManage_0020").html(member.donation); } function EntranceManage_ChangePw() { diff --git a/i_entrance/manage/Frame.php b/i_entrance/manage/Frame.php index ffa11b87..057721fa 100644 --- a/i_entrance/manage/Frame.php +++ b/i_entrance/manage/Frame.php @@ -51,6 +51,4 @@ require_once('_common.php'); 탈퇴신청시 1개월간 정보가 보존되며, 1개월간 재가입이 불가능합니다. -
-
diff --git a/i_entrance/manage/Get.php b/i_entrance/manage/Get.php index dbfd9def..9e2d64cf 100644 --- a/i_entrance/manage/Get.php +++ b/i_entrance/manage/Get.php @@ -6,9 +6,8 @@ require_once(ROOT.W.F_CONFIG.W.SESSION.PHP); // 외부 파라미터 - -$rs = $DB->Select('ID, NAME, GRADE, PICTURE', 'MEMBER', "NO='{$SESSION->NoMember()}'"); -$member = $DB->Get($rs); +$db = getRootDB(); +$member = $db->queryFirstRow('SELECT `ID`, `NAME`, `GRADE`, `PICTURE` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember()); $response['id'] = $member['ID']; $response['name'] = $member['NAME']; @@ -31,42 +30,6 @@ if($member['PICTURE'] == '') { $response['picture1'] = '../d_pic/'.$member['PICTURE']; } -$response['donation'] = ''; - -$rs = $DB->Select('DATE, AMOUNT, CUMUL', 'DONATION', "ID='{$member['ID']}'"); -$count = $DB->Count($rs); -if($count > 0) { - $response['donation'] = ' - - - - - - - - - '; - - $i = 1; - while($DB->HasNext($rs)) { - $donation = $DB->Next($rs); - - $response['donation'] .= " - - - - - - - "; - $i++; - } - - $response['donation'] .= ' -
참 여 기 록
순번일자금액누적
{$i}{$donation['DATE']}{$donation['AMOUNT']}{$donation['CUMUL']}
- '; -} - $response['result'] = 'SUCCESS'; sleep(1); diff --git a/i_entrance/manage/deletePost.php b/i_entrance/manage/deletePost.php index fede9c05..f2a460be 100644 --- a/i_entrance/manage/deletePost.php +++ b/i_entrance/manage/deletePost.php @@ -2,17 +2,13 @@ require_once('_common.php'); require_once(ROOT.W.F_FUNC.W.'class._JSON.php'); require_once(ROOT.W.F_CONFIG.W.DB.PHP); -require_once(ROOT.W.F_CONFIG.W.'DBS'.PHP); -require_once(ROOT.W.F_CONFIG.W.SETTINGS.PHP); require_once(ROOT.W.F_CONFIG.W.SESSION.PHP); // 외부 파라미터 $respone = []; - -$rs = $DB->Select('ID, PICTURE', 'MEMBER', "NO='{$SESSION->NoMember()}'"); - -$member = $DB->Get($rs); +$db = getRootDB(); +$member = $db->queryFirstRow('SELECT ID, PICTURE FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember()); @@ -38,21 +34,18 @@ if($dt == $rf) { $response['msg'] = '1일 1회 변경 가능합니다!'; $response['result'] = 'FAIL'; } else { - $DB->Update('MEMBER', "PICTURE='', IMGSVR=0", "NO='{$SESSION->NoMember()}'"); - if(file_exists($dest)){ - @unlink($dest); - } - - for($i=0; $i < $_serverCount; $i++) { - if($SETTINGS[$i]->IsExist()) { - $rs = $DBS[$i]->Select('IMG', 'game', "NO='1'"); - $game = $DBS[$i]->Get($rs); - if($game['IMG'] > 0) { - // 엔장선택 제외하고 업데이트 - $DBS[$i]->Update('general', "PICTURE='default.jpg', IMGSVR=0", "NPC=0 AND USER_ID='{$member['ID']}'"); - } - } + $db->update('MEMBER', [ + 'PICTURE'=>'', + 'IMGSVR'=>0, + ], 'NO=%i', $SESSION->NoMember()); + + //TODO: 각 세부 서버가 '열린 경우' 이미지를 갱신하도록 처리 + //Token을 받아 처리하는 형식이면 가능할듯. + /* + for($i=0; $i < ; $i++) { + Update('general', "PICTURE='default.jpg', IMGSVR=0", "NPC=0 AND USER_ID='{$member['ID']}'"); } + */ $response['msg'] = '제거에 성공했습니다!'; $response['result'] = 'SUCCESS'; diff --git a/i_entrance/manage/iconPost.php b/i_entrance/manage/iconPost.php index 66c30b22..f49d13d8 100644 --- a/i_entrance/manage/iconPost.php +++ b/i_entrance/manage/iconPost.php @@ -1,8 +1,6 @@ IMAGETYPE_JPEG, '.png'=>IMAGETYPE_PNG, '.gif'=>IMAGETYPE_GIF); -$rs = $DB->Select('ID, PICTURE', 'MEMBER', "NO='{$SESSION->NoMember()}'"); -$member = $DB->Get($rs); +$db = getRootDB(); +$member = $db->queryFirstRow('SELECT `ID`, `PICTURE` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember()); $picName = $member['PICTURE']; @@ -78,22 +76,14 @@ if(!is_uploaded_file($image['tmp_name'])) { $response['msg'] = '업로드에 실패했습니다!'; $response['result'] = 'FAIL'; } else { - if(file_exists($old_path)){ - @unlink($old_path); - } $pic = "{$newPicName}?={$rf}"; - $DB->Update('MEMBER', "PICTURE='{$pic}', IMGSVR=1", "NO='{$SESSION->NoMember()}'"); + getRootDB()->update('MEMBER',[ + 'PICTURE' => $pic, + 'IMGSVR' => 1 + ], 'NO=%i', $SESSION->NoMember()); - for($i=0; $i < $_serverCount; $i++) { - if($SETTINGS[$i]->IsExist()) { - $rs = $DBS[$i]->Select('IMG', 'game', "NO='1'"); - $game = $DBS[$i]->Get($rs); - if($game['IMG'] > 0) { - // 엔장선택 제외하고 업데이트 - $DBS[$i]->Update('general', "PICTURE='{$pic}', IMGSVR=1", "NPC=0 AND USER_ID='{$member['ID']}'"); - } - } - } + //TODO: 각 서버에도 전파 + //Update('general', "PICTURE='{$pic}', IMGSVR=1", "NPC=0 AND USER_ID='{$member['ID']}'"); $response['msg'] = '업로드에 성공했습니다!'; $response['result'] = 'SUCCESS'; diff --git a/i_entrance/manage/passwordPost.php b/i_entrance/manage/passwordPost.php index 4265d87f..83414c75 100644 --- a/i_entrance/manage/passwordPost.php +++ b/i_entrance/manage/passwordPost.php @@ -2,8 +2,6 @@ require_once('_common.php'); require_once(ROOT.W.F_FUNC.W.'class._JSON.php'); require_once(ROOT.W.F_CONFIG.W.DB.PHP); -require_once(ROOT.W.F_CONFIG.W.'DBS'.PHP); -require_once(ROOT.W.F_CONFIG.W.SETTINGS.PHP); require_once(ROOT.W.F_CONFIG.W.SESSION.PHP); // 외부 파라미터 @@ -14,20 +12,14 @@ $newPw = $_POST['newPw']; $response['result'] = 'FAIL'; -$rs = $DB->Select('ID, PW', 'MEMBER', "NO='{$SESSION->NoMember()}'"); -$member = $DB->Get($rs); +$db = getRootDB(); +$member = $db->queryFirstRow('SELECT `ID`, `PW` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember()); if($member['PW'] != $pw) { $response['result'] = 'FAIL'; $response['msg'] = '실패: 현재 비밀번호가 일치하지 않습니다.'; } else { - $DB->Update('MEMBER', "PW='{$newPw}'", "NO='{$SESSION->NoMember()}'"); - - for($i=0; $i < $_serverCount; $i++) { - if($SETTINGS[$i]->IsExist()) { - $DBS[$i]->Update('general', "PASSWORD='{$newPw}'", "USER_ID='{$member['ID']}'"); - } - } + $db->update('MEMBER', ['PW'=>$newPw], 'NO=%i', $SESSION->NoMember()); $response['result'] = 'SUCCESS'; $response['msg'] = "정상적으로 비밀번호가 수정되었습니다."; diff --git a/i_entrance/manage/quitPost.php b/i_entrance/manage/quitPost.php index 58a915aa..6ffad12b 100644 --- a/i_entrance/manage/quitPost.php +++ b/i_entrance/manage/quitPost.php @@ -11,17 +11,17 @@ $pw = $_POST['pw']; $response['result'] = 'FAIL'; -$rs = $DB->Select('PW', 'MEMBER', "NO='{$SESSION->NoMember()}'"); -$member = $DB->Get($rs); +$db = getRootDB(); +$member = $db->queryFirstRow('SELECT `PW` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember()); if($member['PW'] != $pw) { $response['result'] = 'FAIL'; $response['msg'] = '실패: 현재 비밀번호가 일치하지 않습니다.'; } else { - $DB->UpdateArray('MEMBER', array( + $db->update('MEMBER', array( 'QUIT' => 'Y', 'REG_DATE'=> _Time::DatetimeNow() - ), "NO='{$SESSION->NoMember()}'"); + ), 'NO=%i', $SESSION->NoMember()); $SESSION->Logout(); diff --git a/i_entrance/member/Frame.php b/i_entrance/member/Frame.php index 33f4756d..ba63d6e3 100644 --- a/i_entrance/member/Frame.php +++ b/i_entrance/member/Frame.php @@ -23,7 +23,6 @@ EntranceMember_Init(); -
선택: @@ -63,8 +62,6 @@ EntranceMember_Init();
등록
최근등록일
등급
-
총참여
-
최근참여일
사진
SVR
탈퇴
diff --git a/i_entrance/member/Get.php b/i_entrance/member/Get.php index d76badde..b3f11d1e 100644 --- a/i_entrance/member/Get.php +++ b/i_entrance/member/Get.php @@ -10,41 +10,31 @@ use utilphp\util as util; // $_GET['select'] : 정렬선택 $select = $_GET['select']; -$rs = $DB->Select('GRADE', 'MEMBER', "NO='{$SESSION->NoMember()}'"); -$member = $DB->Get($rs); -$donCumul = []; -$donDate = []; +$db = getRootDB(); +$member = $db->queryFirstRow('SELECT `GRADE` FROM `MEMBER` WHERE `no` = %i', $SESSION->NoMember()); if($member['GRADE'] < 6) { $response['result'] = 'FAIL'; $response['msg'] = '운영자 권한이 없습니다.'; } else { - $rs = $DB->Select('ID, CUMUL, DATE', 'DONATION', '1 ORDER BY NO'); - while($DB->HasNext($rs)) { - $donation = $DB->Next($rs); - $donCumul[$donation['ID']] = $donation['CUMUL']; - $donDate[$donation['ID']] = $donation['DATE']; - } - - $whereStr = ''; + $orderByStr = ''; switch($select) { - case 0: $whereStr = '1 ORDER BY NO'; break; - case 1: $whereStr = '1 ORDER BY ID'; break; - case 2: $whereStr = '1 ORDER BY NAME'; break; - case 3: $whereStr = '1 ORDER BY PID'; break; - case 4: $whereStr = '1 ORDER BY IP'; break; - case 5: $whereStr = '1 ORDER BY GRADE DESC'; break; - case 6: $whereStr = '1 ORDER BY REG_NUM DESC'; break; - case 7: $whereStr = '1 ORDER BY REG_DATE DESC'; break; + case 0: $orderByStr = 'ORDER BY NO'; break; + case 1: $orderByStr = 'ORDER BY ID'; break; + case 2: $orderByStr = 'ORDER BY NAME'; break; + case 3: $orderByStr = 'ORDER BY PID'; break; + case 4: $orderByStr = 'ORDER BY IP'; break; + case 5: $orderByStr = 'ORDER BY GRADE DESC'; break; + case 6: $orderByStr = 'ORDER BY REG_NUM DESC'; break; + case 7: $orderByStr = 'ORDER BY REG_DATE DESC'; break; } $response['lists'] = ''; $response['members'] = ''; - $rs = $DB->Select('NO, ID, PID, NAME, IP, PICTURE, IMGSVR, GRADE, REG_NUM, REG_DATE, BLOCK_NUM, BLOCK_DATE, QUIT', 'MEMBER', $whereStr); - $count = $DB->Count($rs); - while($DB->HasNext($rs)) { - $member = $DB->Next($rs); + $members = $db->queryFirstRow('SELECT NO, ID, PID, NAME, IP, PICTURE, IMGSVR, GRADE, REG_NUM, REG_DATE, BLOCK_NUM, BLOCK_DATE, QUIT FROM MEMBER %l', $orderByStr); + $count = count($members); + foreach($members as $member){ $member['PID'] = substr($member['PID'], 0, 8); $member['PICTURE'] = substr($member['PICTURE'], -8); @@ -68,8 +58,6 @@ if($member['GRADE'] < 6) { - - @@ -79,8 +67,7 @@ if($member['GRADE'] < 6) { $response['count'] = "(0000/{$count})"; - $rs = $DB->Select('REG, LOGIN', 'SYSTEM', "NO='1'"); - $system = $DB->Get($rs); + $system = getRootDB()->queryFirstRow('SELECT `REG`, `LOGIN` FROM `SYSTEM` WHERE `NO`=1'); $response['state'] = "가입: {$system['REG']}, 로그인: {$system['LOGIN']}"; diff --git a/i_entrance/member/Post.php b/i_entrance/member/Post.php index acd8e02f..c62149f6 100644 --- a/i_entrance/member/Post.php +++ b/i_entrance/member/Post.php @@ -2,8 +2,6 @@ require_once('_common.php'); require_once(ROOT.W.F_FUNC.W.'class._JSON.php'); require_once(ROOT.W.F_CONFIG.W.DB.PHP); -require_once(ROOT.W.F_CONFIG.W.'DBS'.PHP); -require_once(ROOT.W.F_CONFIG.W.SETTINGS.PHP); require_once(ROOT.W.F_CONFIG.W.SESSION.PHP); // 외부 파라미터 @@ -12,104 +10,55 @@ require_once(ROOT.W.F_CONFIG.W.SESSION.PHP); $select = $_POST['select']; $no = $_POST['no']; -$rs = $DB->Select('GRADE', 'MEMBER', "NO='{$SESSION->NoMember()}'"); -$member = $DB->Get($rs); +$db = getRootDB(); +$member = $db->queryFirstRow('SELECT `GRADE` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember()); if($member['GRADE'] < 6) { $response['result'] = 'FAIL'; $response['msg'] = '운영자 권한이 없습니다.'; } else { - $rs = $DB->Select('ID', 'MEMBER', "NO='{$no}'"); - $member = $DB->Get($rs); - - if($select == 0) { - // 블럭회원 - $DB->Update('MEMBER', 'GRADE=0', "NO='{$no}'"); - - for($i=0; $i < $_serverCount; $i++) { - if($SETTINGS[$i]->IsExist()) { - $DBS[$i]->Update('general', 'USERLEVEL=0', "USER_ID='{$member['ID']}'"); - } - } - } elseif($select == 1) { - // 일반회원 - $DB->Update('MEMBER', 'GRADE=1', "NO='{$no}'"); - - for($i=0; $i < $_serverCount; $i++) { - if($SETTINGS[$i]->IsExist()) { - $DBS[$i]->Update('general', 'USERLEVEL=1', "USER_ID='{$member['ID']}'"); - } - } - } elseif($select == 2) { - // 참여회원 - $DB->Update('MEMBER', 'GRADE=2', "NO='{$no}'"); - - for($i=0; $i < $_serverCount; $i++) { - if($SETTINGS[$i]->IsExist()) { - $DBS[$i]->Update('general', 'USERLEVEL=2', "USER_ID='{$member['ID']}'"); - } - } - } elseif($select == 3) { - // 유효회원 - $DB->Update('MEMBER', 'GRADE=3', "NO='{$no}'"); - - for($i=0; $i < $_serverCount; $i++) { - if($SETTINGS[$i]->IsExist()) { - $DBS[$i]->Update('general', 'USERLEVEL=3', "USER_ID='{$member['ID']}'"); - } - } - } elseif($select == 4) { - // 특별회원 - $DB->Update('MEMBER', 'GRADE=4', "NO='{$no}'"); - - for($i=0; $i < $_serverCount; $i++) { - if($SETTINGS[$i]->IsExist()) { - $DBS[$i]->Update('general', 'USERLEVEL=4', "USER_ID='{$member['ID']}'"); - } - } + + if($select >= 0 && $select <= 4) { + /* + 0: 블럭회원 + 1: 일반회원 + 2: 참여회원? + 3: 유효회원? + 4: 특별회원? + */ + $db->update('MEMBER', ['GRADE'=>$select], 'NO=%i', $no); } elseif($select == 5) { // 전콘제거 - $DB->Update('MEMBER', "PICTURE='', IMGSVR=0", "NO='{$no}'"); + $db->update('MEMBER', [ + 'PICTURE'=>'', + 'IMGSVR'=>0 + ], 'NO=%i', $no); - for($i=0; $i < $_serverCount; $i++) { - if($SETTINGS[$i]->IsExist()) { - $DBS[$i]->Update('general', "PICTURE='default.jpg', IMGSVR=0", "NPC=0 AND USER_ID='{$member['ID']}'"); - } - } } elseif($select == 6) { // 비번초기화 $pw = md5('11111111'); - $DB->Update('MEMBER', "PW='{$pw}'", "NO='{$no}'"); + $db->update('MEMBER', ['PW'=>$pw], 'NO=%i',$no); } elseif($select == 7) { // 회원삭제 - $DB->Delete('MEMBER', "NO='{$no}'"); + $db->delete('MEMBER', 'NO=%i', $no); } elseif($select == 8) { // 가입허용 - $DB->Update('SYSTEM', "REG='Y'", "NO='1'"); + $db->update('SYSTEM', ['REG'=>'Y'], 'NO=1'); } elseif($select == 9) { // 가입금지 - $DB->Update('SYSTEM', "REG='N'", "NO='1'"); + $db->update('SYSTEM', ['REG'=>'N'], 'NO=1'); } elseif($select == 10) { // 로그인허용 - $DB->Update('SYSTEM', "LOGIN='Y'", "NO='1'"); + $db->update('SYSTEM', ['LOGIN'=>'Y'], 'NO=1'); } elseif($select == 11) { // 로그인금지 - $DB->Update('SYSTEM', "LOGIN='N'", "NO='1'"); + $db->update('SYSTEM', ['LOGIN'=>'N'], 'NO=1'); } elseif($select == 12) { // 탈퇴처리(1개월) - $DB->Delete('MEMBER', "QUIT='Y' AND GRADE<'5' AND REG_DATEdelete('MEMBER', "QUIT='Y' AND GRADE<'5' AND REG_DATEDelete('MEMBER', "GRADE<'5' AND REG_DATEUpdate('MEMBER', 'IMGSVR=0'); - - for($i=0; $i < $_serverCount; $i++) { - if($SETTINGS[$i]->IsExist()) { - $DBS[$i]->Update('general', 'IMGSVR=0'); - } - } + $db->delete('MEMBER', "GRADE<'5' AND REG_DATESelect('ID, GRADE', 'MEMBER', "NO='{$SESSION->NoMember()}'"); -$member = $DB->Get($rs); - -$response['serverCount'] = $_serverCount; +$response['serverCount'] = count($serverList); $response['servers'] = ''; -for($i=0; $i < $_serverCount; $i++) { - if(!$SETTINGS[$i]->IsExist()) { + +foreach($serverList as $serverInfo){ + list($serverKorName, $serverColor, $setting) = $serverInfo; + + $serverText = "{$serverKorName}"; + if(!$serverInfo->isExist()) { $response['servers'] .= "
-

{$_serverNames[$i]}
+

{$serverText}

- 폐 쇄 중 -
"; } else { - $rs = $DBS[$i]->Select('ISUNITED, NPCMODE, YEAR, MONTH, SCENARIO, MAXGENERAL, TURNTERM', 'game', "NO='1'"); - $game = $DBS[$i]->Get($rs); - - $rs = $DBS[$i]->Select('COUNT(*) AS CNT', 'nation', "LEVEL>'0'"); - $nation = $DBS[$i]->Get($rs); - - $rs = $DBS[$i]->Select('COUNT(*) AS CNT', 'general', "NPC<'2'"); - $gen = $DBS[$i]->Get($rs); - - $rs = $DBS[$i]->Select('COUNT(*) AS CNT', 'general', "NPC>='2'"); - $npc = $DBS[$i]->Get($rs); - - unset($me); - $rs = $DBS[$i]->Select('NAME, PICTURE, IMGSVR', 'general', "USER_ID='{$member['ID']}'"); - $me = $DBS[$i]->Get($rs); - - if($game['ISUNITED'] == 2) { $state = "§천하통일§"; } - else { $state = "<{$nation['CNT']}국 경쟁중>"; } - $state = "{$state}"; - - if($me) { $site = "index.php"; } - elseif($game['NPCMODE'] == 1) { $site = "selection.php"; } - else { $site = "join.php"; } - - $info = "서기 {$game['YEAR']}년 {$game['MONTH']}월 (".getScenario($game['SCENARIO']).")
- 유저 : {$gen['CNT']} / {$game['MAXGENERAL']}명 NPC : {$npc['CNT']}명 (".getTurnTerm($game['TURNTERM']).")"; - - if($member['GRADE'] == 0) { - $character = "
- 계정 블럭 -
"; - } elseif($_serverLevels[$i] == 2 && $member['GRADE'] < 2) { - $character = "
- 클로즈 테스트중 -
"; - } elseif($_serverLevels[$i] == 3 && $member['GRADE'] < 3) { - $character = "
- 클로즈 테스트중 -
"; - } elseif($_serverLevels[$i] == 4 && $member['GRADE'] < 4) { - $character = "
- 클로즈 테스트중 -
"; - } elseif($_serverLevels[$i] == 5 && $member['GRADE'] < 5) { - $character = "
- 부운영자 테스트중 -
"; - } elseif($_serverLevels[$i] >= 6 && $member['GRADE'] < 6) { - $character = "
- 운영자 테스트중 -
"; - } elseif($me) { - if($me['PICTURE'] == '') { - $picture = ''; - } else { - if($me['IMGSVR'] == 0) { - $picture = '"; - } else { - $picture = '"; - } - } - - $character = " -
{$picture}
-
{$me['NAME']}
- -"; - } elseif($gen['CNT'] >= $game['MAXGENERAL']) { - $character = "
- 장수 등록 마감 -
"; - } else { - $character = "
- 미 등 록 -
"; - if($game['NPCMODE'] == 1) { - $character .= ""; - $character .= ""; - } else { - $character .= ""; - } - } - $response['servers'] .= " -
-

{$_serverNames[$i]}
{$state}
-

{$info}
- {$character} -
-"; +

{$serverText}
+"; + //TODO: 이에 대해 동적으로 j_server_basic_info.php 를 불러서 기록해야함. } } $response['result'] = 'SUCCESS'; - -sleep(1); echo json_encode($response); -function getScenario($scenario) { - switch($scenario) { - case 0: $str = "공백지모드"; break; - case 1: $str = "역사모드1 : 184년 황건적의 난"; break; - case 2: $str = "역사모드2 : 190년 반동탁연합"; break; - case 3: $str = "역사모드3 : 194년 군웅할거"; break; - case 4: $str = "역사모드4 : 196년 황제는 허도로"; break; - case 5: $str = "역사모드5 : 200년 관도대전"; break; - case 6: $str = "역사모드6 : 202년 원가의 분열"; break; - case 7: $str = "역사모드7 : 207년 적벽대전"; break; - case 8: $str = "역사모드8 : 213년 익주 공방전"; break; - case 9: $str = "역사모드9 : 219년 삼국정립"; break; - case 10: $str = "역사모드10 : 225년 칠종칠금"; break; - case 11: $str = "역사모드11 : 228년 출사표"; break; - - case 12: $str = "IF모드1 : 191년 백마장군의 위세"; break; - - case 20: $str = "가상모드1 : 180년 영웅 난무"; break; - case 21: $str = "가상모드1 : 180년 영웅 집결"; break; - case 22: $str = "가상모드2 : 179년 훼신 집결"; break; - case 23: $str = "가상모드3 : 180년 영웅 시대"; break; - case 24: $str = "가상모드4 : 180년 결사항전"; break; - case 25: $str = "가상모드5 : 180년 영웅독존"; break; - case 26: $str = "가상모드6 : 180년 무풍지대"; break; - case 27: $str = "가상모드7 : 180년 가요대잔치"; break; - case 28: $str = "가상모드8 : 180년 확산성 밀리언 아서"; break; - default: $str = "시나리오?"; break; - } - return $str; -} - -function getTurnTerm($term) { - switch($term) { - case 0: $str = "120분 턴 서버"; break; - case 1: $str = "60분 턴 서버"; break; - case 2: $str = "30분 턴 서버"; break; - case 3: $str = "20분 턴 서버"; break; - case 4: $str = "10분 턴 서버"; break; - case 5: $str = "5분 턴 서버"; break; - case 6: $str = "2분 턴 서버"; break; - case 7: $str = "1분 턴 서버"; break; - } - return $str; -} - - diff --git a/i_login/Frame.php b/i_login/Frame.php index 89b4addb..ecbf66d0 100644 --- a/i_login/Frame.php +++ b/i_login/Frame.php @@ -2,8 +2,7 @@ require_once('_common.php'); require_once(ROOT.W.F_CONFIG.W.DB.PHP); -$rs = $DB->Select('REG, LOGIN', 'SYSTEM', "NO='1'"); -$system = $DB->Get($rs); +$system = getRootDB()->queryFirstRow('SELECT `REG`, `LOGIN` FROM `SYSTEM` WHERE `NO`=1'); ?> diff --git a/i_login/Post.php b/i_login/Post.php index d1aa0050..b335e8f8 100644 --- a/i_login/Post.php +++ b/i_login/Post.php @@ -5,6 +5,8 @@ require_once(ROOT.W.F_FUNC.W.'class._Session.php'); require_once(ROOT.W.F_FUNC.W.'class._String.php'); require_once(ROOT.W.F_CONFIG.W.DB.PHP); +use utilphp\util as util; + // 외부 파라미터 // $_POST['id'] : ID // $_POST['pw'] : PW @@ -20,18 +22,18 @@ $pw = substr($pw, 0, 32); $response['result'] = 'FAIL'; $SESSION = new _Session(); - -$rs = $DB->Select('NO, GRADE, QUIT', 'MEMBER', "ID='{$id}' AND PW='{$pw}'"); -if($DB->Count($rs) == 1) { - $member = $DB->Get($rs); - +$db = getRootDB(); +$member = $db->queryFirstRow('SELECT `NO`, `GRADE`, `QUIT` FROM `MEMBER` WHERE `ID` = %s AND `PW` = %s', $id, $pw); +if($member) { if($member['QUIT'] != 'Y') { - $rs = $DB->Select('LOGIN', 'SYSTEM', "NO='1'"); - $system = $DB->Get($rs); + $system = $db->queryFirstRow('SELECT `LOGIN` FROM `SYSTEM` WHERE `NO` = 1'); if($system['LOGIN'] == 'Y' || $member['GRADE'] >= 5) { - $SESSION->Login($member['NO'], $id); - $DB->Update('MEMBER', "CONMSG='{$conmsg}', IP='{$_SERVER['REMOTE_ADDR']}'", "NO='{$member['NO']}'"); + $SESSION->Login($member['NO'], $id, $member['GRADE']); + $db->update('MEMBER', [ + 'CONMSG'=>$conmsg, + 'IP'=>util::get_client_ip(true), + ], 'NO=%i', $member['NO']); $_SESSION['conmsg'] = $conmsg;//XXX: conmsg를 처리할 더 적절한 장소는? diff --git a/i_login/findpw/Get.php b/i_login/findpw/Get.php index 4f3cb3e5..9152a99b 100644 --- a/i_login/findpw/Get.php +++ b/i_login/findpw/Get.php @@ -3,10 +3,8 @@ require_once('_common.php'); require_once(ROOT.W.F_FUNC.W.'class._JSON.php'); require_once(ROOT.W.F_CONFIG.W.DB.PHP); -$rs = $DB->Select('COUNT(*) AS CNT', 'MEMBER'); - -$registeredCount = $DB->Get($rs); -$response['registeredCount'] = $registeredCount['CNT']; +$registeredCount = getRootDB()->queryFirstField('SELECT COUNT(`NO`) AS CNT FROM MEMBER'); +$response['registeredCount'] = $registeredCount; $response['result'] = 'SUCCESS'; sleep(1); diff --git a/i_login/findpw/Post.php b/i_login/findpw/Post.php index 9e133764..1c34e30a 100644 --- a/i_login/findpw/Post.php +++ b/i_login/findpw/Post.php @@ -17,6 +17,7 @@ $pid2 = $_POST['pid2']; $pid = $_POST['pid1'].'-'.substr($_POST['pid2'],0,1).'-'.md5($_POST['pid2']); $email = $_POST['email']; +$db = getRootDB(); $response['result'] = 'FAIL'; $err = _Validation::CheckID($id); @@ -27,8 +28,7 @@ if($err == 2) { $response['result'] = 'FAIL'; $response['msg'] = '4~12글자로 입력해주세요.'; } elseif($err == 0) { - $rs = $DB->Select('ID', 'MEMBER', "ID='{$id}'"); - $count = $DB->Count($rs); + $count = $db->queryFirstField('SELECT COUNT(`ID`) FROM MEMBER WHERE `ID` = %s', $id); if($count == 1) { $response['result'] = 'SUCCESS'; } else { @@ -54,14 +54,7 @@ if($err == 3) { $response['result'] = 'FAIL'; $response['msg'] = '입력이 충분치 않습니다!'; } elseif($err == 0) { - $rs = $DB->Select('PID', 'MEMBER', "ID='{$id}' AND PID='{$pid}'"); - $count = $DB->Count($rs); - if($count == 1) { - $response['result'] = 'SUCCESS'; - } else { - $response['result'] = 'FAIL'; - $response['msg'] = '아이디에 맞지 않는 주민번호입니다! 운영자에게 문의해보세요!'; - } + $response['result'] = 'SUCCESS'; } if($response['result'] != 'SUCCESS') { @@ -75,8 +68,7 @@ if($err == 1) { $response['result'] = 'FAIL'; $response['msg'] = '이메일이 올바르지 않습니다!'; } elseif($err == 0) { - $rs = $DB->Select('EMAIL', 'MEMBER', "ID='{$id}' AND EMAIL='{$email}'"); - $count = $DB->Count($rs); + $count = $db->queryFirstField('SELECT COUNT(`NO`) FROM MEMBER WHERE ID = %s AND EMAIL = %s', $id, $email); if($count == 1) { $response['result'] = 'SUCCESS'; } else { @@ -91,14 +83,12 @@ if($response['result'] != 'SUCCESS') { } $response['result'] = 'FAIL'; -$rs = $DB->Select('VERIFIED', 'EMAIL', "EMAIL='{$email}'"); -$count = $DB->Count($rs); -if($count != 1) { +$verified = $db->queryFirstField('SELECT VERIFIED FROM EMAIL WHERE EMAIL = %s', $email); +if($verified === null) { $response['result'] = 'FAIL'; $response['msg'] = $email.' 에 대한 인증정보가 없습니다! 운영자에게 문의해보세요!'; } else { - $res = $DB->Get($rs); - if($res['VERIFIED'] == 1) { + if($verified) { $response['result'] = 'SUCCESS'; } else { $response['result'] = 'FAIL'; @@ -113,7 +103,7 @@ if($response['result'] != 'SUCCESS') { // 비밀번호 변경 $pw = md5('11111111'); -$DB->Update('MEMBER', "PW='{$pw}'", "ID='{$id}'"); +$db->update('MEMBER', ['PW'=>$pw], 'ID=%s', $id); $response['result'] = 'SUCCESS'; $response['msg'] = "정상적으로 비번이 변경되었습니다. ID: {$id}"; diff --git a/i_login/findpw/checkPost.php b/i_login/findpw/checkPost.php index e462f3ca..cc273615 100644 --- a/i_login/findpw/checkPost.php +++ b/i_login/findpw/checkPost.php @@ -20,6 +20,7 @@ $email = $_POST['email']; $response['type'] = $type; +$db = getRootDB(); if($type == 0) { $err = _Validation::CheckID($id); @@ -30,8 +31,7 @@ if($type == 0) { $response['result'] = 'FAIL'; $response['msg'] = '4~12글자로 입력해주세요.'; } elseif($err == 0) { - $rs = $DB->Select('ID', 'MEMBER', "ID='{$id}'"); - $count = $DB->Count($rs); + $count = $db->queryFirstField('SELECT count(id) FROM MEMBER WHERE ID=%s', $id); if($count == 1) { $response['result'] = 'SUCCESS'; $response['msg'] = '존재하는 아이디입니다. ^^'; @@ -52,8 +52,7 @@ if($type == 0) { $response['result'] = 'FAIL'; $response['msg'] = '입력이 충분치 않습니다!'; } elseif($err == 0) { - $rs = $DB->Select('PID', 'MEMBER', "ID='{$id}' AND PID='{$pid}'"); - $count = $DB->Count($rs); + $count = $db->queryFirstField('SELECT count(`NO`) FROM MEMBER WHERE ID = %s AND PID = %s', $id, $pid); if($count == 1) { $response['result'] = 'SUCCESS'; $response['msg'] = '맞는 주민번호입니다. ^^'; @@ -68,8 +67,7 @@ if($type == 0) { $response['result'] = 'FAIL'; $response['msg'] = '이메일이 올바르지 않습니다!'; } elseif($err == 0) { - $rs = $DB->Select('EMAIL', 'MEMBER', "ID='{$id}' AND EMAIL='{$email}'"); - $count = $DB->Count($rs); + $count = $db->queryFirstField('SELECT COUNT(`NO`) FROM MEMBER WHERE ID = %s AND EMAIL = %s', $id, $email); if($count == 1) { $response['result'] = 'SUCCESS'; $response['msg'] = '맞는 이메일입니다. ^^'; diff --git a/i_login/findpw/sendCodePost.php b/i_login/findpw/sendCodePost.php index d6b343b8..633d28d6 100644 --- a/i_login/findpw/sendCodePost.php +++ b/i_login/findpw/sendCodePost.php @@ -26,17 +26,16 @@ if($err == 1) { $response['result'] = 'FAIL'; $response['msg'] = '이메일전송이 실패: '.$res['msg']; } else { - $rs = $DB->Select('EMAIL', 'EMAIL', "EMAIL='{$email}'"); - $count = $DB->Count($rs); - if($count > 0) { - $DB->Delete('EMAIL', "EMAIL='{$email}'"); - } - $DB->InsertArray('EMAIL', array( + getRootDB()->insertUpdate('EMAIL', [ 'EMAIL' => $email, 'CODE' => $code, 'VERIFIED'=> 0, 'REG_DATE'=> _Time::DatetimeNow() - )); + ],[ + 'CODE' => $code, + 'VERIFIED'=> 0, + 'REG_DATE'=> _Time::DatetimeNow() + ]); $response['result'] = 'SUCCESS'; $response['msg'] = $email.'로 인증번호가 전송되었습니다. 이메일을 확인하세요.'; diff --git a/i_login/findpw/verifyCodePost.php b/i_login/findpw/verifyCodePost.php index 36075ea1..7749b8b9 100644 --- a/i_login/findpw/verifyCodePost.php +++ b/i_login/findpw/verifyCodePost.php @@ -14,28 +14,27 @@ $code = $_POST['code']; $response['result'] = 'FAIL'; +$db = getRootDB(); + $err = _Validation::CheckEmail($email); if($err == 1) { $response['result'] = 'FAIL'; $response['msg'] = '이메일이 올바르지 않습니다!'; } elseif($err == 0) { - $rs = $DB->Select('CODE', 'EMAIL', "EMAIL='{$email}'"); - $count = $DB->Count($rs); + $cmpCode = $db->queryFirstField('SELECT CODE FROM EMAIL WHERE EMAIL = %s', $email); - if($count == 0) { + if(!$cmpCode) { $response['result'] = 'FAIL'; $response['msg'] = '인증번호 전송 내역이 없습니다.'; - } elseif($count == 1) { - $result = $DB->Get($rs); - - if($result['CODE'] != $code) { + } else { + if($cmpCode != $code) { $response['result'] = 'FAIL'; $response['msg'] = '인증번호가 일치하지 않습니다.'; } else { - $DB->UpdateArray('EMAIL', array( + $db->update('EMAIL', [ 'VERIFIED'=> 1, 'VRF_DATE'=> _Time::DatetimeNow() - ), "EMAIL='{$email}'"); + ], 'EMAIL=%s', $email); $response['result'] = 'SUCCESS'; $response['msg'] = '인증번호가 확인되었습니다.'; diff --git a/i_login/join/Get.php b/i_login/join/Get.php index 4f3cb3e5..82275441 100644 --- a/i_login/join/Get.php +++ b/i_login/join/Get.php @@ -3,13 +3,10 @@ require_once('_common.php'); require_once(ROOT.W.F_FUNC.W.'class._JSON.php'); require_once(ROOT.W.F_CONFIG.W.DB.PHP); -$rs = $DB->Select('COUNT(*) AS CNT', 'MEMBER'); - -$registeredCount = $DB->Get($rs); +$registeredCount = getRootDB()->queryFirstField('SELECT COUNT(`NO`) FROM MEMBER'); $response['registeredCount'] = $registeredCount['CNT']; $response['result'] = 'SUCCESS'; -sleep(1); echo json_encode($response); diff --git a/i_login/join/Post.php b/i_login/join/Post.php index 49f028e1..ab88cbb2 100644 --- a/i_login/join/Post.php +++ b/i_login/join/Post.php @@ -24,9 +24,8 @@ $email = $_POST['email']; $pw = substr($pw, 0, 32); //FIXME: 32글자 제한을 왜해! $name = _String::NoSpecialCharacter($name); - -$rs = $DB->Select('REG', 'SYSTEM', "NO='1'"); -$system = $DB->Get($rs); +$db = getRootDB(); +$system = $db->queryFirstRow('SELECT `REG` FROM `SYSTEM` WHERE `NO`=1'); if($system['REG'] != 'Y') { $response['result'] = 'FAIL'; @@ -49,8 +48,7 @@ if($err == 2) { $response['result'] = 'FAIL'; $response['msg'] = '4~12글자로 입력해주세요.'; } elseif($err == 0) { - $rs = $DB->Select('ID', 'MEMBER', "ID='{$id}'"); - $count = $DB->Count($rs); + $count = $db->queryFirstField('SELECT COUNT(`ID`) FROM MEMBER WHERE `ID` = %s', $id); if($count == 0) { $response['result'] = 'SUCCESS'; } else { @@ -78,16 +76,6 @@ if($err == 3) { $response['msg'] = '입력이 충분치 않습니다!'; } elseif($err == 0) { $response['result'] = 'SUCCESS'; -/* - $rs = $DB->Select('PID', 'MEMBER', "PID='{$pid}'"); - $count = $DB->Count($rs); - if($count == 0) { - $response['result'] = 'SUCCESS'; - } else { - $response['result'] = 'FAIL'; - $response['msg'] = '이미 가입된 주민번호입니다! 운영자에게 문의해보세요!'; - } -*/ } if($response['result'] != 'SUCCESS') { @@ -101,8 +89,7 @@ if($err == 1) { $response['result'] = 'FAIL'; $response['msg'] = '닉네임이 올바르지 않습니다!'; } elseif($err == 0) { - $rs = $DB->Select('NAME', 'MEMBER', "NAME='{$name}'"); - $count = $DB->Count($rs); + $count = $db->queryFirstField('SELECT COUNT(`NAME`) FROM MEMBER WHERE `NAME` = %s', $name); if($count == 0) { $response['result'] = 'SUCCESS'; } else { @@ -122,8 +109,7 @@ if($err == 1) { $response['result'] = 'FAIL'; $response['msg'] = '이메일이 올바르지 않습니다!'; } elseif($err == 0) { - $rs = $DB->Select('EMAIL', 'MEMBER', "EMAIL='{$email}'"); - $count = $DB->Count($rs); + $count = $db->queryFirstField('SELECT COUNT(`NO`) FROM MEMBER WHERE EMAIL = %s', $email); if($count == 0) { $response['result'] = 'SUCCESS'; } else { @@ -138,14 +124,12 @@ if($response['result'] != 'SUCCESS') { } $response['result'] = 'FAIL'; -$rs = $DB->Select('VERIFIED', 'EMAIL', "EMAIL='{$email}'"); -$count = $DB->Count($rs); -if($count != 1) { +$verified = $db->queryFirstField('SELECT VERIFIED FROM EMAIL WHERE EMAIL = %s', $email); +if($verified === null) { $response['result'] = 'FAIL'; $response['msg'] = $email.' 에 대한 인증정보가 없습니다! 운영자에게 문의해보세요!'; } else { - $res = $DB->Get($rs); - if($res['VERIFIED'] == 1) { + if($verified) { $response['result'] = 'SUCCESS'; } else { $response['result'] = 'FAIL'; @@ -159,7 +143,7 @@ if($response['result'] != 'SUCCESS') { } // 멤버 등록 -$DB->InsertArray('MEMBER', array( +$db->insert('MEMBER', array( 'ID' => $id, 'PW' => $pw, 'PID' => $pid, diff --git a/i_login/join/checkPost.php b/i_login/join/checkPost.php index 62a24c2e..600aaeaf 100644 --- a/i_login/join/checkPost.php +++ b/i_login/join/checkPost.php @@ -23,9 +23,9 @@ $email = $_POST['email']; $name = _String::NoSpecialCharacter($name); $response['type'] = $type; +$db = getRootDB(); -$rs = $DB->Select('REG', 'SYSTEM', "NO='1'"); -$system = $DB->Get($rs); +$system = $db->queryFirstRow('SELECT `REG` FROM `SYSTEM` WHERE `NO`=1'); if($system['REG'] != 'Y') { $response['result'] = 'FAIL'; @@ -40,8 +40,7 @@ if($system['REG'] != 'Y') { $response['result'] = 'FAIL'; $response['msg'] = '4~12글자로 입력해주세요.'; } elseif($err == 0) { - $rs = $DB->Select('ID', 'MEMBER', "ID='{$id}'"); - $count = $DB->Count($rs); + $count = $db->queryFirstField('SELECT COUNT(`ID`) FROM MEMBER WHERE ID = %s', $id); if($count == 0) { $response['result'] = 'SUCCESS'; $response['msg'] = '사용할 수 있는 아이디입니다. ^^'; @@ -65,17 +64,6 @@ if($system['REG'] != 'Y') { } elseif($err == 0) { $response['result'] = 'SUCCESS'; $response['msg'] = '사용할 수 있는 생년월일입니다. ^^'; -/* - $rs = $DB->Select('PID', 'MEMBER', "PID='{$pid}'"); - $count = $DB->Count($rs); - if($count == 0) { - $response['result'] = 'SUCCESS'; - $response['msg'] = '사용할 수 있는 주민번호입니다. ^^'; - } else { - $response['result'] = 'FAIL'; - $response['msg'] = '이미 가입된 주민번호입니다! 운영자에게 문의해보세요!'; - } -*/ } } elseif($type == 2) { $err = _Validation::CheckName($name); @@ -83,8 +71,7 @@ if($system['REG'] != 'Y') { $response['result'] = 'FAIL'; $response['msg'] = '닉네임이 올바르지 않습니다!'." ($err)"; } elseif($err == 0) { - $rs = $DB->Select('NAME', 'MEMBER', "NAME='{$name}'"); - $count = $DB->Count($rs); + $count = $db->queryFirstField('SELECT COUNT(`NAME`) FROM MEMBER WHERE `NAME` = %s', $name); if($count == 0) { $response['result'] = 'SUCCESS'; $response['name'] = $name; @@ -100,8 +87,7 @@ if($system['REG'] != 'Y') { $response['result'] = 'FAIL'; $response['msg'] = '이메일이 올바르지 않습니다!'; } elseif($err == 0) { - $rs = $DB->Select('EMAIL', 'MEMBER', "EMAIL='{$email}'"); - $count = $DB->Count($rs); + $count = $db->queryFirstField('SELECT COUNT(`NO`) FROM MEMBER WHERE EMAIL = %s', $email); if($count == 0) { $response['result'] = 'SUCCESS'; $response['msg'] = $email.' 은(는) 사용할 수 있는 이메일입니다. ^^'; diff --git a/i_login/join/sendCodePost.php b/i_login/join/sendCodePost.php index 219cbda9..633d28d6 100644 --- a/i_login/join/sendCodePost.php +++ b/i_login/join/sendCodePost.php @@ -26,17 +26,16 @@ if($err == 1) { $response['result'] = 'FAIL'; $response['msg'] = '이메일전송이 실패: '.$res['msg']; } else { - $rs = $DB->Select('EMAIL', 'EMAIL', "EMAIL='{$email}'"); - $count = $DB->Count($rs); - if($count > 0) { - $DB->Delete('EMAIL', "EMAIL='{$email}'"); - } - $DB->InsertArray('EMAIL', array( + getRootDB()->insertUpdate('EMAIL', [ 'EMAIL' => $email, 'CODE' => $code, 'VERIFIED'=> 0, - 'REG_DATE'=> _Time::DatetimeNow() - )); + 'REG_DATE'=> _Time::DatetimeNow() + ],[ + 'CODE' => $code, + 'VERIFIED'=> 0, + 'REG_DATE'=> _Time::DatetimeNow() + ]); $response['result'] = 'SUCCESS'; $response['msg'] = $email.'로 인증번호가 전송되었습니다. 이메일을 확인하세요.'; diff --git a/i_login/join/verifyCodePost.php b/i_login/join/verifyCodePost.php index 63c64cb1..fafe6a54 100644 --- a/i_login/join/verifyCodePost.php +++ b/i_login/join/verifyCodePost.php @@ -13,28 +13,27 @@ $code = $_POST['code']; $response['result'] = 'FAIL'; +$db = getRootDB(); + $err = _Validation::CheckEmail($email); if($err == 1) { $response['result'] = 'FAIL'; $response['msg'] = '이메일이 올바르지 않습니다!'; } elseif($err == 0) { - $rs = $DB->Select('CODE', 'EMAIL', "EMAIL='{$email}'"); - $count = $DB->Count($rs); - - if($count == 0) { + $cmpCode = $db->queryFirstField('SELECT CODE FROM EMAIL WHERE EMAIL = %s', $email); + if(!$cmpCode) { $response['result'] = 'FAIL'; $response['msg'] = '인증번호 전송 내역이 없습니다.'; - } elseif($count == 1) { - $result = $DB->Get($rs); + } else { - if($result['CODE'] != $code) { + if($cmpCode != $code) { $response['result'] = 'FAIL'; $response['msg'] = '인증번호가 일치하지 않습니다.'; } else { - $DB->UpdateArray('EMAIL', array( + $db->update('EMAIL', [ 'VERIFIED'=> 1, 'VRF_DATE'=> _Time::DatetimeNow() - ), "EMAIL='{$email}'"); + ], 'EMAIL=%s', $email); $response['result'] = 'SUCCESS'; $response['msg'] = '인증번호가 확인되었습니다.'; diff --git a/i_other/help.php b/i_other/help.php index 282cd676..690cc278 100644 --- a/i_other/help.php +++ b/i_other/help.php @@ -236,10 +236,6 @@ if($category == 0) {
  생성할 캐릭터 이름을 입력합니다. 기본적으로는 닉네님으로 설정되어 있습니다. 매 기수마다 다른사람들이 알아보지 못하도록 숨어서 플레이(이하 잠입)하는 유저도 있습니다. 잠입의 묘미는 중수가 되면 저절로 아시게 될겁니다!

-   일반 장수 얼굴을 사용할때는 얼굴을 고릅니다. 각자의 개성을 나타낼 수 있도록 골라봅시다.

  장수의 성격을 선택합니다. 처음은 그냥 ????(랜덤)을 선택합니다.
@@ -425,7 +421,6 @@ if($category == 0) {   내 장수 정보 표시
  캐릭터의 얼굴입니다.
  병력을 소유했을때, 해당 병력의 종류에 따른 그림
-  회원분류 : 특별회원, 일반회원
  캐릭터 이름입니다.
  관직이 표시됩니다. 재야부터 군주까지 다양합니다.
  능력치에 따른 장수분류를 나타냅니다.
diff --git a/twe/_119.php b/twe/_119.php index 6612cc90..f22dbdac 100644 --- a/twe/_119.php +++ b/twe/_119.php @@ -4,11 +4,7 @@ include "func.php"; $connect=dbConn(); -$query = "select userlevel from general where owner='{$_SESSION['noMember']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { echo " diff --git a/twe/_119_b.php b/twe/_119_b.php index 0f0cadc6..953677e2 100644 --- a/twe/_119_b.php +++ b/twe/_119_b.php @@ -4,11 +4,7 @@ include "func.php"; $connect=dbConn(); -$query = "select userlevel from general where owner='{$_SESSION['noMember']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - -if($me['userlevel'] < 5) { +if(getUserGrade() < 5){ //echo ""; echo '_119.php';//TODO:debug all and replace } diff --git a/twe/_admin1.php b/twe/_admin1.php index 4682c760..d9a8b8d9 100644 --- a/twe/_admin1.php +++ b/twe/_admin1.php @@ -5,11 +5,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select userlevel from general where owner='{$_SESSION['noMember']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { echo " diff --git a/twe/_admin1_submit.php b/twe/_admin1_submit.php index fcbb7502..75d6bf8d 100644 --- a/twe/_admin1_submit.php +++ b/twe/_admin1_submit.php @@ -7,11 +7,7 @@ $connect = dbConn(); $admin = getAdmin($connect); -$query = "select userlevel from general where owner='{$_SESSION['noMember']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { //echo ""; echo '_admin1.php';//TODO:debug all and replace } diff --git a/twe/_admin2.php b/twe/_admin2.php index f80180a8..6694c57e 100644 --- a/twe/_admin2.php +++ b/twe/_admin2.php @@ -5,11 +5,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select userlevel from general where owner='{$_SESSION['noMember']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { echo " @@ -58,14 +54,14 @@ $admin = MYDB_fetch_array($result);
{$member['REG_NUM']} {$member['REG_DATE']} {$member['GRADE']}".util::array_get($donCumul[$member['ID']],'0')."".util::array_get($donDate[$member['ID']],'')." {$member['PICTURE']} {$member['IMGSVR']} {$member['QUIT']}
- + - - - - diff --git a/twe/_admin2_submit.php b/twe/_admin2_submit.php index a3377f88..457b00bc 100644 --- a/twe/_admin2_submit.php +++ b/twe/_admin2_submit.php @@ -5,11 +5,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select userlevel from general where owner='{$_SESSION['noMember']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { //echo ""; echo '_admin2.php';//TODO:debug all and replace } @@ -161,18 +157,6 @@ switch($btn) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } break; - case "특별회원 임명": - for($i=0; $i < sizeof($genlist); $i++) { - $query = "update general set userlevel=3 where no='$genlist[$i]'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - break; - case "특별회원 해제": - for($i=0; $i < sizeof($genlist); $i++) { - $query = "update general set userlevel=1 where no='$genlist[$i]'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - break; case "접속 허용": for($i=0; $i < sizeof($genlist); $i++) { $query = "update general set con=0 where no='$genlist[$i]'"; diff --git a/twe/_admin3.php b/twe/_admin3.php deleted file mode 100644 index e8c47655..00000000 --- a/twe/_admin3.php +++ /dev/null @@ -1,100 +0,0 @@ - - -관리메뉴 - - - - -관리자가 아닙니다.
-"; - echo banner(); - echo " - -"; - - exit(); -} -//$admin = getAdmin($connect); -?> - - -특별회원 - - - - -
회원선택

NPC
NPC유저
특별회원
접속제한
블럭회원
회원선택

NPC
NPC유저
접속제한
블럭회원
"; -$query = "select no,name,npc,userlevel,block from general order by npc,binary(name)"; +$query = "select no,name,npc,block from general order by npc,binary(name)"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gencount = MYDB_num_rows($result); @@ -76,7 +72,6 @@ for($i=0; $i < $gencount; $i++) { if($general['npc'] >= 2) { $style .= "color:cyan;"; } elseif($general['npc'] == 1) { $style .= "color:skyblue;"; } if($general['con'] > $admin['conlimit']) { $style .= "color:red;"; } - if($general['userlevel'] > 2) { $style .= "color:blue;"; } echo " "; @@ -119,10 +114,6 @@ for($i=0; $i < 27; $i++) { 이벤트2
특별회원
접속제한
- -
특 별 회 원
-
- - - - - - - - - - - - - - - -
회원선택

무장
지장
-"; - -$query = "select no,name,power,intel from general where userlevel>2 order by npc,binary(name)"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$gencount = MYDB_num_rows($result); - -for($i=0; $i < $gencount; $i++) { - $general = MYDB_fetch_array($result); - if($general['power'] >= $general['intel']) { - echo " - "; - } else { - echo " - "; - } -} - -echo " - - 아이템 지급 - - - - - -
특별회원
메세지 전달
-
- - - -
- - diff --git a/twe/_admin3_submit.php b/twe/_admin3_submit.php deleted file mode 100644 index 2578dad7..00000000 --- a/twe/_admin3_submit.php +++ /dev/null @@ -1,113 +0,0 @@ -location.replace('_admin3.php');"; - echo '_admin3.php';//TODO:debug all and replace -} - -$generalID = getGeneralID(); - -switch($btn) { - case "무기지급": - $date = date('Y-m-d H:i:s'); - for($i=0; $i < sizeof($genlist); $i++) { - $you = getDB()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); - if($weap == 0) { $msg = "무기 회수!"; } - else { $msg = getWeapName($weap)." 지급!"; } - // 상대에게 발송 - sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); - } - for($i=0; $i < sizeof($genlist); $i++) { - if($weap == 0) { - $query = "update general set weap='0' where no='$genlist[$i]'"; - } else { - $query = "update general set weap='$weap' where no='$genlist[$i]' and weap<'$weap'"; - } - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - break; - case "책지급": - $date = date('Y-m-d H:i:s'); - for($i=0; $i < sizeof($genlist); $i++) { - $you = getDB()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); - if($weap == 0) { $msg = "서적 회수!"; } - else { $msg = getBookName($weap)." 지급!"; } - // 상대에게 발송 - sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); - } - for($i=0; $i < sizeof($genlist); $i++) { - if($weap == 0) { - $query = "update general set book='0' where no='$genlist[$i]'"; - } else { - $query = "update general set book='$weap' where no='$genlist[$i]' and book<'$weap'"; - } - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - break; - case "말지급": - $date = date('Y-m-d H:i:s'); - for($i=0; $i < sizeof($genlist); $i++) { - $you = getDB()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); - if($weap == 0) { $msg = "말 회수!"; } - else { $msg = getHorseName($weap)." 지급!"; } - // 상대에게 발송 - sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); - } - for($i=0; $i < sizeof($genlist); $i++) { - if($weap == 0) { - $query = "update general set horse='0' where no='$genlist[$i]'"; - } else { - $query = "update general set horse='$weap' where no='$genlist[$i]' and horse<'$weap'"; - } - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - break; - case "도구지급": - $date = date('Y-m-d H:i:s'); - for($i=0; $i < sizeof($genlist); $i++) { - $you = getDB()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); - if($weap == 0) { $msg = "특수도구 회수!"; } - else { $msg = getItemName($weap)." 지급!"; } - // 상대에게 발송 - sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); - } - for($i=0; $i < sizeof($genlist); $i++) { - if($weap == 0) { - $query = "update general set item='0' where no='$genlist[$i]'"; - } else { - $query = "update general set item='$weap' where no='$genlist[$i]' and item<'$weap'"; - } - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - break; - case "특별회원 해제": - for($i=0; $i < sizeof($genlist); $i++) { - $query = "update general set userlevel=1 where no='$genlist[$i]'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - break; - case "메세지 전달": - //TODO:새 갠메 시스템으로 변경 - $date = date('Y-m-d H:i:s'); - for($i=0; $i < sizeof($genlist); $i++) { - $you = getDB()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); - // 상대에게 발송 - sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); - } - break; -} - -//echo ""; -echo '_admin3.php';//TODO:debug all and replace - diff --git a/twe/_admin4.php b/twe/_admin4.php index 42ec0151..f273de4b 100644 --- a/twe/_admin4.php +++ b/twe/_admin4.php @@ -5,11 +5,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select userlevel from general where owner='{$_SESSION['noMember']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { echo " @@ -45,14 +41,14 @@ $admin = MYDB_fetch_array($result);
- + @@ -80,7 +79,6 @@ switch($type) { case 13: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by special2 desc"; break; case 14: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by age desc"; break; case 15: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by npc desc"; break; - case 16: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by userlevel desc"; break; } $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gencount = MYDB_num_rows($genresult); diff --git a/twe/a_history.php b/twe/a_history.php index dd6dcb54..4bd366ba 100644 --- a/twe/a_history.php +++ b/twe/a_history.php @@ -11,11 +11,11 @@ $query = "select startyear,year,month,conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select skin,map,con,userlevel,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,map,con,turntime from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } $query = "select year,month from history order by no limit 1"; diff --git a/twe/a_kingdomList.php b/twe/a_kingdomList.php index 4a655850..4365ff56 100644 --- a/twe/a_kingdomList.php +++ b/twe/a_kingdomList.php @@ -10,11 +10,11 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select con,userlevel,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select con,turntime from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } ?> diff --git a/twe/a_status.php b/twe/a_status.php index 72310f03..cb9db0d8 100644 --- a/twe/a_status.php +++ b/twe/a_status.php @@ -11,11 +11,11 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select skin,map,con,userlevel,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,map,con,turntime from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } ?> diff --git a/twe/a_vote.php b/twe/a_vote.php index 9178ea45..84303cb4 100644 --- a/twe/a_vote.php +++ b/twe/a_vote.php @@ -4,7 +4,7 @@ include "func.php"; $connect = dbConn(); increaseRefresh("설문조사", 1); -$query = "select no,userlevel,vote from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,vote from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -43,7 +43,7 @@ function captureKey(e) { = 5) { +if(getUserGrade() >= 5) { echo " @@ -82,7 +82,7 @@ for($i=1; $i < $voteTypeCount; $i++) { echo " "; - } elseif($admin['voteopen'] >= 1 || $me['userlevel'] >= 5) { + } elseif($admin['voteopen'] >= 1 || getUserGrade() >= 5) { $query = "select no from general where vote='{$i}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $vCount = MYDB_num_rows($result); @@ -118,7 +118,7 @@ echo " "; -if($me['userlevel'] >= 5) { +if(getUserGrade() >= 5) { echo " @@ -170,7 +170,7 @@ if($me['no'] > 0) { "; -if($admin['voteopen'] >= 1 || $me['userlevel'] >= 5) { +if($admin['voteopen'] >= 1 || getUserGrade() >= 5) { echo " @@ -220,7 +220,7 @@ if($admin['voteopen'] >= 1 || $me['userlevel'] >= 5) { "; } -if($admin['voteopen'] >= 2 || $me['userlevel'] >= 5) { +if($admin['voteopen'] >= 2 || getUserGrade() >= 5) { $query = "select no from general where nation=0 and npc<2"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $memCount = MYDB_num_rows($result); diff --git a/twe/b_auction.php b/twe/b_auction.php index 324104eb..fca31f7a 100644 --- a/twe/b_auction.php +++ b/twe/b_auction.php @@ -6,7 +6,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("거래장", 2); -$query = "select no,special,skin,userlevel,con,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,special,skin,con,turntime from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -14,7 +14,7 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } $query = "select no from auction where no1='{$me['no']}'"; @@ -27,7 +27,7 @@ $bidCount = MYDB_num_rows($result); $btCount = $tradeCount + $bidCount; -if($me['userlevel'] >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) { +if(getUserGrade() >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) { $btn = "submit"; } else { $btn = "hidden"; diff --git a/twe/b_battleCenter.php b/twe/b_battleCenter.php index 356597c6..949ba540 100644 --- a/twe/b_battleCenter.php +++ b/twe/b_battleCenter.php @@ -16,7 +16,7 @@ $query = "select nation from general where no='$gen'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $general = MYDB_fetch_array($result); -$query = "select skin,no,nation,level,userlevel,con,turntime,belong from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,no,nation,level,con,turntime,belong from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -24,7 +24,7 @@ $query = "select secretlimit from nation where nation='{$me['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nation = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } //재야인 경우 diff --git a/twe/b_betting.php b/twe/b_betting.php index 3af3e0f5..7b671d25 100644 --- a/twe/b_betting.php +++ b/twe/b_betting.php @@ -7,7 +7,7 @@ $connect = dbConn(); increaseRefresh("베팅장", 1); checkTurn($connect); -$query = "select no,tournament,userlevel,con,turntime,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,tournament,con,turntime,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -15,7 +15,7 @@ $query = "select conlimit,tournament,phase,tnmt_type,develcost,bet0,bet1,bet2,be $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } switch($admin['tnmt_type']) { diff --git a/twe/b_chiefcenter.php b/twe/b_chiefcenter.php index 1b4c5d9f..e4f5fb40 100644 --- a/twe/b_chiefcenter.php +++ b/twe/b_chiefcenter.php @@ -10,7 +10,7 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select skin,no,nation,level,userlevel,con,turntime,belong from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,no,nation,level,con,turntime,belong from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -18,7 +18,7 @@ $query = "select secretlimit from nation where nation='{$me['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nation = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretlimit'])) { diff --git a/twe/b_currentCity.php b/twe/b_currentCity.php index 1ad63e4f..5e3294ef 100644 --- a/twe/b_currentCity.php +++ b/twe/b_currentCity.php @@ -6,7 +6,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("현재도시", 1); -$query = "select skin,no,nation,userlevel,level,city from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,no,nation,level,city from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -129,7 +129,7 @@ echo "
"; // 첩보된 도시까지만 허용 -if($valid == 0 && $me['userlevel'] < 5) { +if($valid == 0 && getUserGrade() < 5) { $_REQUEST['citylist'] = $me['city']; } @@ -280,7 +280,7 @@ for($j=0; $j < $gencount; $j++) { "; //아국장수이거나 보는 사람이 운영자일때 보여줌 - if(($general['nation'] != 0 && $general['nation'] == $myNation['nation']) || $me['userlevel'] >= 5) { + if(($general['nation'] != 0 && $general['nation'] == $myNation['nation']) || getUserGrade() >= 5) { switch($general['mode']) { case 0: $mode = "×"; break; case 1: $mode = "○"; break; diff --git a/twe/b_dipcenter.php b/twe/b_dipcenter.php index b3d1540b..36f1cf5f 100644 --- a/twe/b_dipcenter.php +++ b/twe/b_dipcenter.php @@ -10,7 +10,7 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select skin,no,nation,level,userlevel,con,turntime,belong from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,no,nation,level,con,turntime,belong from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -18,7 +18,7 @@ $query = "select secretlimit from nation where nation='{$me['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nation = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretlimit'])) { diff --git a/twe/b_diplomacy.php b/twe/b_diplomacy.php index c7b06b2f..6a26bdc5 100644 --- a/twe/b_diplomacy.php +++ b/twe/b_diplomacy.php @@ -10,7 +10,7 @@ $query = "select turnterm from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,nation,skin,map,userlevel from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,nation,skin,map from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -115,7 +115,7 @@ for($i=0; $i < $nationcount; $i++) { case 0: $str = ""; break; case 1: $str = ""; break; case 2: - if($nationnum[$i] == $me['nation'] || $nationnum[$k] == $me['nation'] || $me['userlevel'] >= 4) { $str = "ㆍ"; } + if($nationnum[$i] == $me['nation'] || $nationnum[$k] == $me['nation'] || getUserGrade() >= 5) { $str = "ㆍ"; } else { $str = "?"; } // $str = "ㆍ"; break; @@ -124,7 +124,7 @@ for($i=0; $i < $nationcount; $i++) { case 5: $str = ""; break; case 6: $str = ""; break; case 7: - if($nationnum[$i] == $me['nation'] || $nationnum[$k] == $me['nation'] || $me['userlevel'] >= 4) { $str = "@"; } + if($nationnum[$i] == $me['nation'] || $nationnum[$k] == $me['nation'] || getUserGrade() >= 5) { $str = "@"; } else { $str = "?"; } // $str = "@"; break; diff --git a/twe/b_genList.php b/twe/b_genList.php index 0db8fae5..a63c21af 100644 --- a/twe/b_genList.php +++ b/twe/b_genList.php @@ -10,7 +10,7 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select skin,no,nation,level,userlevel,con,turntime,belong from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,no,nation,level,con,turntime,belong from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -18,7 +18,7 @@ $query = "select level,secretlimit from nation where nation='{$me['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nation = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretlimit'])) { diff --git a/twe/b_tournament.php b/twe/b_tournament.php index e7da3f13..ec4a6d19 100644 --- a/twe/b_tournament.php +++ b/twe/b_tournament.php @@ -7,7 +7,7 @@ $connect = dbConn(); increaseRefresh("토너먼트", 1); checkTurn($connect); -$query = "select no,tournament,userlevel,con,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,tournament,con,turntime from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -15,7 +15,7 @@ $query = "select conlimit,tournament,phase,tnmt_msg,tnmt_type,develcost,tnmt_tri $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } switch($admin['tnmt_type']) { @@ -50,7 +50,7 @@ select { font-family:'굴림'; line-height:100%; }
회원선택

NPC
NPC유저
특별회원
접속제한
블럭회원
회원선택

NPC
NPC유저
접속제한
블럭회원
"; -$query = "select no,name,npc,userlevel,block from general where ip!='' order by npc,ip"; +$query = "select no,name,npc,block from general where ip!='' order by npc,ip"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gencount = MYDB_num_rows($result); @@ -63,7 +59,6 @@ for($i=0; $i < $gencount; $i++) { if($general['npc'] >= 2) { $style .= "color:cyan;"; } elseif($general['npc'] == 1) { $style .= "color:skyblue;"; } if($general['con'] > $admin['conlimit']) { $style .= "color:red;"; } - if($general['userlevel'] > 2) { $style .= "color:blue;"; } echo " "; diff --git a/twe/_admin4_submit.php b/twe/_admin4_submit.php index 0c38acb8..4639d248 100644 --- a/twe/_admin4_submit.php +++ b/twe/_admin4_submit.php @@ -5,11 +5,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select userlevel from general where owner='{$_SESSION['noMember']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { //echo ""; echo '_admin4.php';//TODO:debug all and replace } diff --git a/twe/_admin5.php b/twe/_admin5.php index 9110670a..75f3df15 100644 --- a/twe/_admin5.php +++ b/twe/_admin5.php @@ -5,11 +5,11 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select userlevel,skin from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { echo " diff --git a/twe/_admin5_submit.php b/twe/_admin5_submit.php index b58c018e..9214b57e 100644 --- a/twe/_admin5_submit.php +++ b/twe/_admin5_submit.php @@ -5,11 +5,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select userlevel from general where owner='{$_SESSION['noMember']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { //echo ""; echo '_admin5.php';//TODO:debug all and replace } diff --git a/twe/_admin6.php b/twe/_admin6.php index f15557ae..e45d5837 100644 --- a/twe/_admin6.php +++ b/twe/_admin6.php @@ -5,11 +5,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select userlevel from general where owner='{$_SESSION['noMember']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { echo " diff --git a/twe/_admin7.php b/twe/_admin7.php index db285008..dfda75d6 100644 --- a/twe/_admin7.php +++ b/twe/_admin7.php @@ -5,11 +5,11 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select userlevel,skin from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { echo " diff --git a/twe/_admin8.php b/twe/_admin8.php index 0fdd5e49..ef6ec6c5 100644 --- a/twe/_admin8.php +++ b/twe/_admin8.php @@ -5,11 +5,11 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select userlevel,skin from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { echo " diff --git a/twe/_simul.php b/twe/_simul.php index af4fdab6..4c513b5d 100644 --- a/twe/_simul.php +++ b/twe/_simul.php @@ -48,7 +48,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("시뮬", 2); -$query = "select no,tournament,userlevel,con,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,tournament,con,turntime from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -56,10 +56,10 @@ $query = "select * from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $game = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $game['conlimit']); +$con = checkLimit($me['con'], $game['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } -if($me['userlevel'] < 3) { +if(getUserGrade() < 3) { echo "특별회원이 아닙니다."; exit(); } diff --git a/twe/a_bestGeneral.php b/twe/a_bestGeneral.php index 065a2023..ec889c95 100644 --- a/twe/a_bestGeneral.php +++ b/twe/a_bestGeneral.php @@ -10,11 +10,11 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select con,userlevel,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select con,turntime from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } ?> diff --git a/twe/a_genList.php b/twe/a_genList.php index d57c771f..508b806d 100644 --- a/twe/a_genList.php +++ b/twe/a_genList.php @@ -10,11 +10,11 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select con,userlevel,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select con,turntime from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if(!isset($type) || $type == 0) { @@ -52,7 +52,6 @@ if(!isset($type) || $type == 0) { -
설 문 조 사 (금과 추첨으로 유니크템 증정!)
전 체 통 계 = 5) { +if(getUserGrade() >= 5) { echo " @@ -179,7 +179,7 @@ if($me['userlevel'] >= 5) { echo "
전 체$intel ".getLevel($general['level'])."
= 5) { +if(getUserGrade() >= 5) { echo " diff --git a/twe/c_auction.php b/twe/c_auction.php index ee9cc78e..e5e39a7a 100644 --- a/twe/c_auction.php +++ b/twe/c_auction.php @@ -10,7 +10,7 @@ $query = "select turnterm from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,gold,rice,special,userlevel from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,gold,rice,special from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -42,7 +42,7 @@ $value = round($value / 10) * 10; if($term > 24) $term = 24; $valid = 1; -if($me['userlevel'] >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) { +if(getUserGrade() >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) { } else { $msg = "ㆍ더이상 등록할 수 없습니다."; $msg2 = "ㆍ더이상 등록할 수 없습니다."; diff --git a/twe/c_tournament.php b/twe/c_tournament.php index ab37b620..487da870 100644 --- a/twe/c_tournament.php +++ b/twe/c_tournament.php @@ -11,7 +11,7 @@ $query = "select tournament,phase,tnmt_type,develcost from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,userlevel,tournament from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,tournament from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -22,17 +22,17 @@ case 2: $tp = "power"; $tp2 = "일기토"; $tp3 = "power"; break; case 3: $tp = "intel"; $tp2 = "설전"; $tp3 = "intel"; break; } -if($me['tournament'] == 1 && $me['userlevel'] < 5) { echo ""; exit(); } +if($me['tournament'] == 1 && getUserGrade() < 5) { echo ""; exit(); } -if($btn == "자동개최설정" && $me['userlevel'] >= 5) { +if($btn == "자동개최설정" && getUserGrade() >= 5) { $query = "update game set tnmt_trig={$trig}"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif($btn == "개최" && $me['userlevel'] >= 5) { +} elseif($btn == "개최" && getUserGrade() >= 5) { startTournament($connect, $auto, $type); -} elseif($btn == "중단" && $me['userlevel'] >= 5) { +} elseif($btn == "중단" && getUserGrade() >= 5) { $query = "update game set tnmt_auto=0, tournament=0, phase=0"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif((($btn == "투입" || $btn == "무명투입" || $btn == "쪼렙투입" || $btn == "일반투입" || $btn == "굇수투입" || $btn == "랜덤투입") && $me['userlevel'] >= 5) || $btn == "참가") { +} elseif((($btn == "투입" || $btn == "무명투입" || $btn == "쪼렙투입" || $btn == "일반투입" || $btn == "굇수투입" || $btn == "랜덤투입") && getUserGrade() >= 5) || $btn == "참가") { if($btn == "투입") { $query = "select no,name,npc,leader,power,intel,explevel,gold,horse,weap,book from general where no='$gen'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -123,7 +123,7 @@ if($btn == "자동개최설정" && $me['userlevel'] >= 5) { $query = "update game set tournament=2, phase=0"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -} elseif(($btn == "쪼렙전부투입" || $btn == "일반전부투입" || $btn == "굇수전부투입" || $btn == "랜덤전부투입") && $me['userlevel'] >= 5) { +} elseif(($btn == "쪼렙전부투입" || $btn == "일반전부투입" || $btn == "굇수전부투입" || $btn == "랜덤전부투입") && getUserGrade() >= 5) { $z = 0; for($i=0; $i < 8; $i++) { $query = "select grp from tournament where grp='$i'"; @@ -177,25 +177,25 @@ if($btn == "자동개최설정" && $me['userlevel'] >= 5) { $query = "update game set tournament=2, phase=0"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif($btn == "무명전부투입" && $me['userlevel'] >= 5) { fillLowGenAll($connect); -} elseif($btn == "예선" && $me['userlevel'] >= 5) { qualify($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); -} elseif($btn == "예선전부" && $me['userlevel'] >= 5) { qualifyAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); -} elseif($btn == "추첨" && $me['userlevel'] >= 5) { selection($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); -} elseif($btn == "추첨전부" && $me['userlevel'] >= 5) { selectionAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); -} elseif($btn == "본선" && $me['userlevel'] >= 5) { finallySingle($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); -} elseif($btn == "본선전부" && $me['userlevel'] >= 5) { finallyAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); -} elseif($btn == "배정" && $me['userlevel'] >= 5) { final16set($connect); -} elseif($btn == "베팅마감" && $me['userlevel'] >= 5) { +} elseif($btn == "무명전부투입" && getUserGrade() >= 5) { fillLowGenAll($connect); +} elseif($btn == "예선" && getUserGrade() >= 5) { qualify($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); +} elseif($btn == "예선전부" && getUserGrade() >= 5) { qualifyAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); +} elseif($btn == "추첨" && getUserGrade() >= 5) { selection($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); +} elseif($btn == "추첨전부" && getUserGrade() >= 5) { selectionAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); +} elseif($btn == "본선" && getUserGrade() >= 5) { finallySingle($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); +} elseif($btn == "본선전부" && getUserGrade() >= 5) { finallyAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); +} elseif($btn == "배정" && getUserGrade() >= 5) { final16set($connect); +} elseif($btn == "베팅마감" && getUserGrade() >= 5) { $dt = date("Y-m-d H:i:s", time() + 60); $query = "update game set tournament='7',phase='0',tnmt_time='$dt' where no=1"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif($btn == "16강" && $me['userlevel'] >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 16); -} elseif($btn == "8강" && $me['userlevel'] >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 8); -} elseif($btn == "4강" && $me['userlevel'] >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 4); -} elseif($btn == "결승" && $me['userlevel'] >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 2); -} elseif($btn == "포상" && $me['userlevel'] >= 5) { setGift($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); -} elseif($btn == "회수" && $me['userlevel'] >= 5) { setRefund($connect); -} elseif($btn == "메시지" && $me['userlevel'] >= 5) { +} elseif($btn == "16강" && getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 16); +} elseif($btn == "8강" && getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 8); +} elseif($btn == "4강" && getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 4); +} elseif($btn == "결승" && getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 2); +} elseif($btn == "포상" && getUserGrade() >= 5) { setGift($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); +} elseif($btn == "회수" && getUserGrade() >= 5) { setRefund($connect); +} elseif($btn == "메시지" && getUserGrade() >= 5) { $msg = addslashes(SQ2DQ($msg)); $query = "update game set tnmt_msg='$msg'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); diff --git a/twe/c_vote.php b/twe/c_vote.php index 0bdb8b82..28ecb548 100644 --- a/twe/c_vote.php +++ b/twe/c_vote.php @@ -9,44 +9,11 @@ $query = "select develcost,vote,votecomment from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,userlevel,vote,name,nation,horse,weap,book,item,npc from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,vote,name,nation,horse,weap,book,item,npc from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -if($btn == "수정" && $me['userlevel'] >= 5) { - if($title != "") { - $vote = explode("|", $admin['vote']); - $vote[0] = addslashes(SQ2DQ($title)); - $admin['vote'] = implode("|", $vote); - $query = "update game set vote='{$admin['vote']}' where no='1'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } -} elseif($btn == "추가" && $me['userlevel'] >= 5) { - if($str != "") { - $str = addslashes(SQ2DQ($str)); - $admin['vote'] .= "|{$str}"; - $query = "update game set vote='{$admin['vote']}' where no='1'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } -} elseif($btn == "리셋" && $me['userlevel'] >= 5) { - $query = "update game set voteopen=1,vote='',votecomment='' where no='1'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - $query = "update general set vote='0'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif($btn == "알림" && $me['userlevel'] >= 5) { - $query = "update general set newvote='1' where vote=0"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif($btn == "숨김" && $me['userlevel'] >= 5) { - $query = "update game set voteopen=0 where no=1"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif($btn == "전체통계만" && $me['userlevel'] >= 5) { - $query = "update game set voteopen=1 where no=1"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif($btn == "전부" && $me['userlevel'] >= 5) { - $query = "update game set voteopen=2 where no=1"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif($btn == "투표" && $me['vote'] == 0 && $sel > 0) { +if($btn == "투표" && $me['vote'] == 0 && $sel > 0) { $develcost = $admin['develcost'] * 5; $query = "update general set gold=gold+{$develcost},vote='{$sel}' where owner='{$_SESSION['noMember']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -54,7 +21,8 @@ if($btn == "수정" && $me['userlevel'] >= 5) { $log = array(); $log = uniqueItem($connect, $me, $log, 1); pushGenLog($me, $log); -} elseif($btn == "댓글" && $comment != "") { +} +else if($btn == "댓글" && $comment != "") { $comment = str_replace("|", " ", $comment); $comment = str_replace(":", " ", $comment); $comment = trim($comment); @@ -70,8 +38,53 @@ if($btn == "수정" && $me['userlevel'] >= 5) { $query = "update game set votecomment='{$admin['votecomment']}' where no=1"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + + + +} + +if(getUserGrade() < 5){ + echo " + echo 'a_vote.php '; + die(); +} + + +if($btn == "수정") { + if($title != "") { + $vote = explode("|", $admin['vote']); + $vote[0] = addslashes(SQ2DQ($title)); + $admin['vote'] = implode("|", $vote); + $query = "update game set vote='{$admin['vote']}' where no='1'"; + MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + } +} elseif($btn == "추가") { + if($str != "") { + $str = addslashes(SQ2DQ($str)); + $admin['vote'] .= "|{$str}"; + $query = "update game set vote='{$admin['vote']}' where no='1'"; + MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + } +} elseif($btn == "리셋") { + $query = "update game set voteopen=1,vote='',votecomment='' where no='1'"; + MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + + $query = "update general set vote='0'"; + MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +} elseif($btn == "알림") { + $query = "update general set newvote='1' where vote=0"; + MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +} elseif($btn == "숨김") { + $query = "update game set voteopen=0 where no=1"; + MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +} elseif($btn == "전체통계만") { + $query = "update game set voteopen=1 where no=1"; + MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +} elseif($btn == "전부") { + $query = "update game set voteopen=2 where no=1"; + MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } ?> - -a_vote.php + +a_vote.php \ No newline at end of file diff --git a/twe/d_setting/conf.orig.php b/twe/d_setting/conf.orig.php index d1304cf0..c24a8dec 100644 --- a/twe/d_setting/conf.orig.php +++ b/twe/d_setting/conf.orig.php @@ -1,9 +1,12 @@ diff --git a/twe/event_2.php b/twe/event_2.php index df276e77..0502a9e5 100644 --- a/twe/event_2.php +++ b/twe/event_2.php @@ -9,11 +9,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select userlevel from general where owner='{$_SESSION['noMember']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { echo " diff --git a/twe/event_3.php b/twe/event_3.php index bcc348d4..bca735be 100644 --- a/twe/event_3.php +++ b/twe/event_3.php @@ -9,11 +9,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select userlevel from general where owner='{$_SESSION['noMember']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { echo " diff --git a/twe/event_4.php b/twe/event_4.php index 09437521..8f395974 100644 --- a/twe/event_4.php +++ b/twe/event_4.php @@ -12,11 +12,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select userlevel from general where owner='{$_SESSION['noMember']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - -if($me['userlevel'] < 5) { +if(getUserGrade() < 5) { echo " diff --git a/twe/func.php b/twe/func.php index 454f74aa..1fb50322 100644 --- a/twe/func.php +++ b/twe/func.php @@ -64,11 +64,13 @@ function getUserID($forceExit=false){ * @return int|null */ function getUserGrade($forceExit=false){ - $userID = getUserID($forceExit); - if(!$userID){ - return null; + $userGrade = util::array_get($_SESSION['userGrade'], null); + if(!$userGrade && $forceExit){ + header('Location:..'); + die(); } - return getRootDB()->queryFirstField('SELECT `GRADE` from `MEMBER` WHERE NO=%i', $userID); + + return $userGrade; } /** @@ -76,7 +78,7 @@ function getUserGrade($forceExit=false){ * * @return int|null */ -function getGeneralID($forceExit=false){ +function getGeneralID($forceExit=false, $countLogin=true){ $userID = getUserID(); if(!$userID){ //유저id 없으면 어차피 의미 없음. return null; @@ -97,7 +99,7 @@ function getGeneralID($forceExit=false){ die(); } - if($generalID){ + if($generalID && $countLogin){ //로그인으로 처리 //XXX: 'get' 함수인데 update가 들어가있다. //TODO: 조금더 적절한 형태의 로그인 카운트를 생각해볼 것 @@ -230,13 +232,10 @@ function isSigned(){ } -function checkLimit($userlevel, $con, $conlimit) { - //TODO: 접속 제한의 기준을 새로 세울 것. - //운영자 - if($userlevel >= 5) { return 0; } - //특회이면 3배 - if($userlevel >= 3) { $conlimit *= 3; } - //접속률 이상이면 제한 +function checkLimit($con, $conlimit) { + if(getUserGrade()>=4){ + return 0; + } if($con > $conlimit) { return 2; //접속제한 90%이면 경고문구 @@ -918,7 +917,7 @@ function generalInfo($connect, $no, $skin) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); - $query = "select block,userlevel,no,name,picture,imgsvr,injury,nation,city,troop,leader,leader2,power,power2,intel,intel2,explevel,experience,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,killturn,age,personal,special,specage,special2,specage2,mode,con,connect from general where no='$no'"; + $query = "select block,no,name,picture,imgsvr,injury,nation,city,troop,leader,leader2,power,power2,intel,intel2,explevel,experience,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,killturn,age,personal,special,specage,special2,specage2,mode,con,connect from general where no='$no'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -980,11 +979,6 @@ function generalInfo($connect, $no, $skin) { $remaining = substr($general['turntime'], 14, 2) - date('i'); if($remaining < 0) { $remaining = 60 + $remaining; } - if($general['userlevel'] > 2) { $specUser = "특별"; } - else { $specUser = "일반"; } - if($general['block'] > 0) { $specUser = "블럭"; } - $specUser = ''; - if($nation['color'] == "" || $skin < 1) { $nation['color'] = "000000"; } if($general['age'] < 60) { $general['age'] = "{$general['age']} 세"; } diff --git a/twe/func_command.php b/twe/func_command.php index 2a1fb3fd..6e1d318d 100644 --- a/twe/func_command.php +++ b/twe/func_command.php @@ -449,7 +449,7 @@ function getCoreTurn($connect, $nation, $level) { function processCommand($connect, $no) { - $query = "select npc,no,name,userlevel,picture,imgsvr,nation,nations,city,troop,injury,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40 from general where no='$no'"; + $query = "select npc,no,name,picture,imgsvr,nation,nations,city,troop,injury,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40 from general where no='$no'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -513,7 +513,7 @@ function processCommand($connect, $no) { } //장수정보 재로드 - $query = "select npc,no,name,userlevel,picture,imgsvr,nation,nations,city,troop,injury,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40 from general where no='$no'"; + $query = "select npc,no,name,picture,imgsvr,nation,nations,city,troop,injury,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40 from general where no='$no'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $general = MYDB_fetch_array($result); } @@ -523,7 +523,7 @@ function processCommand($connect, $no) { if($general['npc'] >= 2 || $general['killturn'] > $admin['killturn']) { $query = "update general set recturn=turn0,resturn='FAIL',myset=3,con=0,killturn=killturn-1 where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } elseif(floor($command[0]) == 0 && $general['userlevel'] < 5) { + } elseif(floor($command[0]) == 0 && getUserGrade() < 5) { $query = "update general set recturn=turn0,resturn='FAIL',myset=3,con=0,killturn=killturn-1 where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } else { diff --git a/twe/index.php b/twe/index.php index 69f4f48e..1e3dc344 100644 --- a/twe/index.php +++ b/twe/index.php @@ -21,7 +21,7 @@ if(!$userID){ die(); } -$me = $db->queryFirstRow('select no,skin,userlevel,con,turntime,newmsg,newvote,map from general where owner = %i', $userID); +$me = $db->queryFirstRow('select no,skin,con,turntime,newmsg,newvote,map from general where owner = %i', $userID); //그새 사망이면 if($me === null) { @@ -49,7 +49,7 @@ $query = "select plock from plock where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $plock = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if($me['skin'] < 1) { @@ -172,12 +172,11 @@ echo " = 5) { +if(getUserGrade() >= 5) { echo "
【 국가방침 】
【 접속자 】
- diff --git a/twe/install.php b/twe/install.php index 43790b5c..236511ce 100644 --- a/twe/install.php +++ b/twe/install.php @@ -1,8 +1,13 @@
재설치하려면 해당 파일을 지우세요"); +include "lib.php"; - @chmod(".",0707); +if(getUserGrade(true) < 5){ + die('관리자 아님'); +} + +if(file_exists("d_setting/conf.php")) error("이미 conf.php가 생성되어 있습니다.

재설치하려면 해당 파일을 지우세요"); + +@chmod(".",0707); ?> diff --git a/twe/install1.php b/twe/install1.php index 12e49135..65607892 100644 --- a/twe/install1.php +++ b/twe/install1.php @@ -1,6 +1,11 @@
재설치하려면 해당 파일을 지우세요"); +include "lib.php"; + +if(getUserGrade(true) < 5){ + die('관리자 아님'); +} + +if(file_exists("d_setting/conf.php")) error("이미 conf.php가 생성되어 있습니다.

재설치하려면 해당 파일을 지우세요"); ?> diff --git a/twe/install2.php b/twe/install2.php index 2a8bbcfb..274e4e30 100644 --- a/twe/install2.php +++ b/twe/install2.php @@ -1,5 +1,9 @@ diff --git a/twe/install2_ok.php b/twe/install2_ok.php deleted file mode 100644 index 818a6551..00000000 --- a/twe/install2_ok.php +++ /dev/null @@ -1,384 +0,0 @@ -웹 IRC : http://barosl.com/webirc/흠냐
폭력적/선정적인 전콘/전메는 블럭/삭제 대상이 될 수 있습니다.', - 500, 300, 55, 120, 100, 100, - '$turntime', '$starttime', '$turnterm', '$killturn', - 5, '$startyear', '$scenario', '$img', '$npcmode', '$extend', '$fiction', - - 100, 150, 7, 10, 9, 9, -- 보병 - 100, 200, 7, 10, 10, 11, -- 청주병(중원) - 150, 150, 7, 10, 11, 10, -- 수병(오월) - 100, 150, 7, 20, 10, 10, -- 자객병(저) - 150, 200, 7, 10, 12, 12, -- 근위병(낙양) - 100, 250, 7, 5, 13, 10, -- 등갑병(남중) - - 100, 100, 7, 20, 10, 10, -- 궁병 - 100, 100, 8, 30, 11, 12, -- 궁기병(동이) - 150, 100, 8, 20, 12, 11, -- 연노병(서촉) - 150, 150, 7, 20, 13, 13, -- 강궁병(양양) - 200, 100, 7, 20, 13, 13, -- 석궁병(건업) - - 150, 100, 7, 5, 11, 11, -- 기병 - 200, 100, 7, 5, 12, 13, -- 백마병(하북) - 150, 150, 7, 5, 13, 12, -- 중장기병(서북) - 200, 100, 8, 5, 13, 11, -- 돌격기병(흉노) - 100, 200, 7, 5, 11, 13, -- 철기병(강) - 150, 100, 8, 15, 12, 12, -- 수렵기병(산월) - 250, 200, 6, 0, 16, 16, -- 맹수병(남만) - 200, 150, 7, 5, 14, 14, -- 호표기병(허창) - - 80, 80, 7, 5, 9, 9, -- 귀병 - 80, 80, 7, 20, 10, 10, -- 신귀병(초) - 80, 130, 7, 5, 9, 11, -- 백귀병(오환) - 130, 80, 7, 5, 11, 9, -- 흑귀병(왜) - 130, 130, 7, 0, 12, 12, -- 악귀병(장안) - 60, 60, 7, 10, 8, 8, -- 남귀병 - 110, 110, 7, 0, 13, 10, -- 황귀병(낙양) - 80, 130, 7, 15, 11, 12, -- 천귀병(성도) - 130, 80, 7, 15, 12, 11, -- 마귀병(업) - - 100, 100, 6, 0, 15, 5, -- 정란 - 150, 100, 6, 0, 20, 5, -- 충차 - 200, 100, 6, 0, 25, 5, -- 벽력거(업) - 50, 200, 5, 0, 30, 5 -- 목우(성도) - )", - $connect -) or Error(__LINE__.MYDB_error($connect),""); - -// 도시정보 입력 -// 이름 규모 인구 농업 상업 치안 수비 성벽 지역 경로 -insertCity($connect, "업", 8, 620500, 12500, 11300, 10000, 11700, 12200, 1, "9|18|70|78|80"); // 1 : 업 -insertCity($connect, "허창", 8, 587600, 12100, 12400, 10000, 11700, 12500, 2, "10|19|38|71|74|80"); // 2 : 허창 -insertCity($connect, "낙양", 8, 835700, 11700, 12000, 10000, 12100, 12400, 2, "70|71|72|74"); // 3 : 낙양 -insertCity($connect, "장안", 8, 592300, 11600, 12300, 10000, 12000, 11800, 3, "41|73|86"); // 4 : 장안 -insertCity($connect, "성도", 8, 652500, 12300, 12500, 10000, 12500, 12300, 4, "26|27|87"); // 5 : 성도 -insertCity($connect, "양양", 8, 583700, 12000, 12600, 10000, 11500, 11700, 6, "51|89"); // 6 : 양양 -insertCity($connect, "건업", 8, 638600, 11600, 12300, 10000, 11500, 11900, 7, "31|82|83"); // 7 : 건업 - -insertCity($connect, "북평", 7, 486200, 10200, 9500, 8000, 10300, 9900, 1, "77|90"); // 8 : 북평 -insertCity($connect, "남피", 7, 503200, 9900, 10100, 8000, 10100, 10500, 1, "1|36|77"); // 9 : 남피 -insertCity($connect, "완", 7, 472400, 10300, 10000, 8000, 10100, 9900, 2, "2|20|51|71"); // 10 : 완 -insertCity($connect, "수춘", 7, 514300, 9900, 9600, 8000, 9900, 9500, 2, "12|20|38|82"); // 11 : 수춘 -insertCity($connect, "서주", 7, 485300, 10100, 9800, 8000, 10200, 9700, 2, "11|21|38|39"); // 12 : 서주 -insertCity($connect, "강릉", 7, 485000, 10500, 9600, 8000, 9500, 9600, 6, "14|53|88|89"); // 13 : 강릉 -insertCity($connect, "장사", 7, 471000, 9700, 9900, 8000, 10000, 10500, 6, "13|15|30|53|54"); // 14 : 장사 -insertCity($connect, "시상", 7, 525200, 9800, 10000, 10000, 9900, 9600, 7, "14|56|58|91|92"); // 15 : 시상 -insertCity($connect, "위례", 7, 492600, 10000, 9300, 8000, 9800, 10300, 8, "32|33|34|60|79"); // 16 : 위례 - -insertCity($connect, "계", 6, 388500, 7500, 8000, 6000, 7800, 8100, 1, "35|77"); // 17 : 계 -insertCity($connect, "복양", 6, 418500, 8000, 8300, 6000, 8200, 8000, 2, "1|19|78|81"); // 18 : 복양 -insertCity($connect, "진류", 6, 395700, 8200, 8000, 6000, 8000, 8300, 2, "2|18|74|80|81"); // 19 : 진류 -insertCity($connect, "여남", 6, 383100, 7700, 8100, 6000, 8400, 7700, 2, "10|11|38"); // 20 : 여남 -insertCity($connect, "하비", 6, 427800, 8500, 8300, 6000, 8200, 7800, 2, "12|83"); // 21 : 하비 -insertCity($connect, "서량", 6, 387400, 7700, 7900, 6000, 8300, 8000, 3, "40|63|64"); // 22 : 서량 -insertCity($connect, "하내", 6, 373600, 7700, 8100, 6000, 8100, 8000, 3, "35|42|65|70"); // 23 : 하내 -insertCity($connect, "한중", 6, 402700, 7700, 8400, 6000, 8000, 8500, 4, "25|75|86"); // 24 : 한중 -insertCity($connect, "상용", 6, 368700, 7800, 7600, 6000, 7700, 8100, 4, "24|51"); // 25 : 상용 -insertCity($connect, "덕양", 6, 380300, 8100, 8400, 6000, 7900, 7700, 4, "5|27|44|45"); // 26 : 덕양 -insertCity($connect, "강주", 6, 412600, 7900, 8000, 6000, 8400, 8100, 4, "5|26|45|46|47"); // 27 : 강주 -insertCity($connect, "건녕", 6, 376500, 8200, 8000, 6000, 8600, 8100, 5, "46|48|49"); // 28 : 건녕 -insertCity($connect, "남해", 6, 380300, 8200, 7600, 6000, 8000, 8100, 5, "50|55|59|67"); // 29 : 남해 -insertCity($connect, "계양", 6, 395500, 8300, 8000, 6000, 8100, 7700, 6, "14|54|55"); // 30 : 계양 -insertCity($connect, "오", 6, 435500, 7700, 8100, 6000, 7700, 7600, 7, "7|57|92|93"); // 31 : 오 -insertCity($connect, "평양", 6, 398200, 7800, 8000, 6000, 8300, 7800, 8, "16|61"); // 32 : 평양 -insertCity($connect, "사비", 6, 415700, 7700, 7900, 6000, 7800, 8000, 8, "16|34|93"); // 33 : 사비 -insertCity($connect, "계림", 6, 391100, 8000, 7400, 6000, 8100, 7800, 8, "16|33|62|93"); // 34 : 계림 - -insertCity($connect, "진양", 5, 307400, 5600, 5900, 4000, 6400, 5900, 1, "17|23|70"); // 35 : 진양 -insertCity($connect, "평원", 5, 307400, 6200, 6500, 4000, 6100, 6300, 1, "9|37|78"); // 36 : 평원 -insertCity($connect, "북해", 5, 314600, 5500, 6300, 4000, 6300, 5800, 1, "36|39|79"); // 37 : 북해 -insertCity($connect, "초", 5, 328600, 6000, 6200, 4000, 6200, 5700, 2, "2|11|12|20|81"); // 38 : 초 -insertCity($connect, "패", 5, 287700, 6400, 5800, 4000, 5800, 5900, 2, "12|37|81"); // 39 : 패 -insertCity($connect, "천수", 5, 298500, 5900, 6400, 4000, 6000, 5800, 3, "22|41|64|84"); // 40 : 천수 -insertCity($connect, "안정", 5, 276400, 5700, 5900, 4000, 5700, 6200, 3, "4|40|85"); // 41 : 안정 -insertCity($connect, "홍농", 5, 274800, 5700, 6300, 4000, 5800, 6300, 3, "23|72|73"); // 42 : 홍농 -insertCity($connect, "하변", 5, 278500, 5800, 6200, 4000, 6000, 5600, 4, "76|85"); // 43 : 하변 -insertCity($connect, "자동", 5, 287000, 5700, 5500, 4000, 6000, 5800, 4, "26|75|76|87"); // 44 : 자동 -insertCity($connect, "영안", 5, 315300, 6200, 5900, 4000, 5800, 5900, 4, "26|27|88"); // 45 : 영안 -insertCity($connect, "귀양", 5, 274600, 5800, 6100, 4000, 6100, 5800, 5, "27|28|47"); // 46 : 귀양 -insertCity($connect, "주시", 5, 282800, 6000, 5900, 4000, 5800, 6300, 5, "27|46|48"); // 47 : 주시 -insertCity($connect, "운남", 5, 325800, 6200, 6000, 4000, 6400, 6100, 5, "28|47|66"); // 48 : 운남 -insertCity($connect, "남영", 5, 285300, 5900, 6200, 4000, 5800, 5700, 5, "28|54|66"); // 49 : 남영 -insertCity($connect, "교지", 5, 319500, 5800, 5900, 4000, 5800, 5900, 5, "29|66"); // 50 : 교지 -insertCity($connect, "신야", 5, 278600, 6000, 6200, 4000, 5800, 5500, 6, "6|10|25"); // 51 : 신야 -insertCity($connect, "강하", 5, 307400, 5500, 5600, 4000, 5700, 6000, 6, "89|91"); // 52 : 강하 -insertCity($connect, "무릉", 5, 319600, 5800, 6300, 4000, 6300, 5800, 6, "13|14|54"); // 53 : 무릉 -insertCity($connect, "영릉", 5, 284900, 6200, 5800, 4000, 6200, 6200, 6, "14|30|49|53"); // 54 : 영릉 -insertCity($connect, "상동", 5, 276700, 5800, 5900, 4000, 6200, 5800, 6, "29|30|58"); // 55 : 상동 -insertCity($connect, "여강", 5, 290500, 5600, 5800, 4000, 6000, 5500, 7, "15|82|91|92"); // 56 : 여강 -insertCity($connect, "회계", 5, 300500, 6400, 5900, 4000, 6200, 6400, 7, "31|67"); // 57 : 회계 -insertCity($connect, "고창", 5, 280200, 5700, 6200, 4000, 5800, 6300, 7, "15|55|67"); // 58 : 고창 -insertCity($connect, "대", 5, 325600, 6000, 6200, 4000, 5700, 6000, 7, "29|67|94"); // 59 : 대 -insertCity($connect, "안평", 5, 293700, 6300, 5900, 4000, 5900, 6300, 8, "16|61|79|90"); // 60 : 안평 -insertCity($connect, "졸본", 5, 293900, 5500, 5900, 4000, 6000, 5800, 8, "32|60|68"); // 61 : 졸본 -insertCity($connect, "이도", 5, 317400, 5800, 6100, 4000, 5800, 5600, 8, "34|69|93"); // 62 : 이도 - -insertCity($connect, "강", 4, 209500, 4000, 4200, 2000, 4300, 4000, 3, "22|84"); // 63 : 강 -insertCity($connect, "저", 4, 195700, 4000, 4200, 2000, 4300, 4200, 3, "22|40|85"); // 64 : 저 -insertCity($connect, "흉노", 4, 206400, 4000, 4100, 2000, 4000, 3800, 3, "23|84"); // 65 : 흉노 -insertCity($connect, "남만", 4, 237800, 4000, 4200, 2000, 4300, 4500, 5, "48|49|50"); // 66 : 남만 -insertCity($connect, "산월", 4, 227500, 4000, 3700, 2000, 4300, 3800, 7, "29|57|58|59"); // 67 : 산월 -insertCity($connect, "오환", 4, 215300, 4200, 3700, 2000, 4300, 4000, 8, "61|90"); // 68 : 오환 -insertCity($connect, "왜", 4, 206500, 3900, 3700, 2000, 4300, 4100, 8, "62|94"); // 69 : 왜 - -insertCity($connect, "호관", 3, 88700, 1900, 1800, 2000, 9500, 9600, 1, "1|3|23|35"); // 70 : 호관 -insertCity($connect, "호로", 3, 111200, 2200, 2100, 2000, 10300, 9800, 2, "2|3|10"); // 71 : 호로 -insertCity($connect, "사곡", 3, 100800, 2100, 1900, 2000, 9900, 10100, 3, "3|42"); // 72 : 사곡 -insertCity($connect, "함곡", 3, 108100, 2000, 2200, 2000, 10100, 10200, 3, "4|42"); // 73 : 함곡 -insertCity($connect, "사수", 3, 95800, 1700, 1900, 2000, 9500, 9600, 2, "2|3|19|80"); // 74 : 사수 -insertCity($connect, "양평", 3, 86800, 1900, 1900, 2000, 9700, 9600, 4, "24|44|86"); // 75 : 양평 -insertCity($connect, "가맹", 3, 85500, 1700, 1800, 2000, 9600, 9500, 4, "43|44"); // 76 : 가맹 - -insertCity($connect, "역경", 2, 98500, 1800, 1900, 2000, 3900, 4100, 1, "8|9|17"); // 77 : 역경 -insertCity($connect, "계교", 2, 101200, 2100, 1900, 2000, 4000, 4200, 1, "1|18|36"); // 78 : 계교 -insertCity($connect, "동황", 2, 99200, 1900, 2100, 2000, 3800, 4000, 1, "16|37|60"); // 79 : 동황 -insertCity($connect, "관도", 2, 112300, 2200, 2000, 2000, 4200, 4300, 2, "1|2|19|74"); // 80 : 관도 -insertCity($connect, "정도", 2, 108500, 2100, 2100, 2000, 4100, 3800, 2, "18|19|38|39"); // 81 : 정도 -insertCity($connect, "합비", 2, 99800, 2000, 1900, 2000, 3900, 4100, 2, "7|11|56"); // 82 : 합비 -insertCity($connect, "광릉", 2, 100100, 2000, 2100, 2000, 4100, 4000, 2, "7|21"); // 83 : 광릉 -insertCity($connect, "적도", 2, 95200, 1800, 1700, 2000, 3800, 3700, 3, "40|63|65"); // 84 : 적도 -insertCity($connect, "가정", 2, 93100, 1700, 1700, 2000, 3600, 3800, 3, "41|43|64"); // 85 : 가정 -insertCity($connect, "기산", 2, 100500, 1900, 1800, 2000, 4100, 4000, 4, "4|24|75"); // 86 : 기산 -insertCity($connect, "면죽", 3, 109300, 2200, 2100, 2000, 10800, 9900, 4, "5|44"); // 87 : 면죽 -insertCity($connect, "이릉", 2, 96800, 1800, 1900, 2000, 3900, 4100, 6, "13|45"); // 88 : 이릉 -insertCity($connect, "장판", 2, 103200, 2100, 2000, 2000, 4000, 3700, 6, "6|13|52|91"); // 89 : 장판 -insertCity($connect, "백랑", 2, 105200, 2200, 1900, 2000, 3800, 4200, 8, "8|60|68"); // 90 : 백랑 - -insertCity($connect, "적벽", 1, 111700, 2300, 2100, 2000, 4200, 4100, 7, "15|52|56|89"); // 91 : 적벽 -insertCity($connect, "파양", 1, 103700, 2000, 2200, 2000, 3800, 3800, 7, "15|31|56"); // 92 : 파양 -insertCity($connect, "탐라", 1, 113000, 2200, 2100, 2000, 4300, 4100, 8, "31|33|34|62"); // 93 : 탐라 -insertCity($connect, "유구", 1, 92100, 1700, 1800, 2000, 3700, 3700, 8, "59|69"); // 94 : 유구 - -//TODO:debug all and replace -switch($scenario) { - case 0: echo "index.php"; break; - case 1: echo "scenario_1.php"; break; - case 2: echo "scenario_2.php"; break; - case 3: echo "scenario_3.php"; break; - case 4: echo "scenario_4.php"; break; - case 5: echo "scenario_5.php"; break; - case 6: echo "scenario_6.php"; break; - case 7: echo "scenario_7.php"; break; - case 8: echo "scenario_8.php"; break; - case 9: echo "scenario_9.php"; break; - case 10: echo "scenario_10.php"; break; - case 11: echo "scenario_11.php"; break; - - case 12: echo "scenario_12.php"; break; - - case 20: echo "scenario_20.php"; break; - case 21: echo "scenario_21.php"; break; - case 22: echo "scenario_22.php"; break; - case 23: echo "scenario_23.php"; break; - case 24: echo "scenario_24.php"; break; - case 25: echo "scenario_25.php"; break; - case 26: echo "scenario_26.php"; break; - case 27: echo "scenario_27.php"; break; - case 28: echo "scenario_28.php"; break; - default: echo "install3_ok.php"; break; -} -/* -switch($scenario) { - case 0: echo ""; break; - case 1: echo ""; break; - case 2: echo ""; break; - case 3: echo ""; break; - case 4: echo ""; break; - case 5: echo ""; break; - case 6: echo ""; break; - case 7: echo ""; break; - case 8: echo ""; break; - case 9: echo ""; break; - case 10: echo ""; break; - case 11: echo ""; break; - - case 12: echo ""; break; - - case 20: echo ""; break; - case 21: echo ""; break; - case 22: echo ""; break; - case 23: echo ""; break; - case 24: echo ""; break; - case 25: echo ""; break; - case 26: echo ""; break; - case 27: echo ""; break; - case 28: echo ""; break; - default: echo ""; break; -} -*/ -function insertCity($connect, $name, $level, $pop2, $agri2, $comm2, $secu2, $def2, $wall2, $region, $path) { - switch($level) { - case 1: $pop = 5000; $agri = 100; $comm = 100; $secu = 100; $def = 500; $wall = 500; break; - case 2: $pop = 5000; $agri = 100; $comm = 100; $secu = 100; $def = 500; $wall = 500; break; - case 3: $pop = 10000; $agri = 100; $comm = 100; $secu = 100; $def = 1000; $wall = 1000; break; - case 4: $pop = 50000; $agri = 1000; $comm = 1000; $secu = 1000; $def = 1000; $wall = 1000; break; - case 5: $pop = 100000; $agri = 1000; $comm = 1000; $secu = 1000; $def = 2000; $wall = 2000; break; - case 6: $pop = 100000; $agri = 1000; $comm = 1000; $secu = 1000; $def = 3000; $wall = 3000; break; - case 7: $pop = 150000; $agri = 1000; $comm = 1000; $secu = 1000; $def = 4000; $wall = 4000; break; - case 8: $pop = 150000; $agri = 1000; $comm = 1000; $secu = 1000; $def = 5000; $wall = 5000; break; - } - - @MYDB_query(" - insert into city ( - name, level, path, pop, pop2, agri, agri2, comm, comm2, secu, secu2, rate, - trade, def, def2, wall, wall2, gen1, gen2, gen3, region - ) values ( - '$name', '$level', '$path', '$pop', '$pop2', '$agri', '$agri2', '$comm', '$comm2', '$secu', '$secu2', 50, - 100, '$def', '$def2', '$wall', '$wall2', 0, 0, 0, '$region' - )", - $connect - ) or Error(__LINE__.MYDB_error($connect),""); -} - diff --git a/twe/j_build_conf.php b/twe/j_build_conf.php new file mode 100644 index 00000000..227f9487 --- /dev/null +++ b/twe/j_build_conf.php @@ -0,0 +1,98 @@ +false, + 'reason'=>'이미 설정 파일이 존재합니다.' + ]); +} + diff --git a/twe/j_drop_settings.php b/twe/j_drop_settings.php new file mode 100644 index 00000000..8d647a45 --- /dev/null +++ b/twe/j_drop_settings.php @@ -0,0 +1,40 @@ +query("DROP TABLE IF EXISTS game"); +// 장수 테이블 삭제 +$db->query("DROP TABLE IF EXISTS general"); +// 국가 테이블 삭제 +$db->query("DROP TABLE IF EXISTS nation"); +// 도시 테이블 삭제 +$db->query("DROP TABLE IF EXISTS city"); +// 부대 테이블 삭제 +$db->query("DROP TABLE IF EXISTS troop"); +// 외교 테이블 삭제 +$db->query("DROP TABLE IF EXISTS diplomacy"); +// 토너먼트 테이블 삭제 +$db->query("DROP TABLE IF EXISTS tournament"); +// 거래 테이블 삭제 +$db->query("DROP TABLE IF EXISTS auction"); +// 통계 테이블 삭제 +$db->query("DROP TABLE IF EXISTS statistic"); +// 연감 테이블 삭제 +$db->query("DROP TABLE IF EXISTS history"); + +// 삭제 +unlink(__DIR__."/d_setting/conf.php"); + +delInDir("logs"); +delInDir("data/session"); +@unlink("data/connected.php"); + diff --git a/twe/j_init_scenario.php b/twe/j_init_scenario.php new file mode 100644 index 00000000..10cfa58d --- /dev/null +++ b/twe/j_init_scenario.php @@ -0,0 +1,40 @@ +
디렉토리의 퍼미션을 707로 주십시요",""); +//@fwrite($file,"
디렉토리의 퍼미션을 707로 주십시요",""); +@fclose($file); +@mkdir("data",0707); +@chmod("data",0707); +//@chmod("d_setting/conf.php",0707); + +$temp=MYDB_fetch_array(MYDB_query("select count(*) from general where level = '1'", $connect)); + +MYDB_close($connect); + +//echo ""; +echo 'install2.php';//TODO:debug all and replace + +// 관리자 테이블 생성 +$db->query($game_schema); +// 장수 테이블 생성 +$db->query($general_schema); +// 국가 테이블 생성 +$db->query($nation_schema); +// 도시 테이블 생성 +$db->query($city_schema); +// 부대 테이블 생성 +$db->query($troop_schema); +// 토큰 테이블 생성 +$db->query($token_schema); +// 외교 테이블 생성 +$db->query($diplomacy_schema); +// 전당 테이블 생성 +$db->query($hall_schema); +// 토너먼트 테이블 생성 +$db->query($tournament_schema); +// 거래 테이블 생성 +$db->query($auction_schema); +// 통계 테이블 생성 +$db->query($statistic_schema); +// 연감 테이블 생성 +$db->query($history_schema); \ No newline at end of file diff --git a/twe/install_ok.php b/twe/j_install.php similarity index 91% rename from twe/install_ok.php rename to twe/j_install.php index fbfbe85e..a2d4249a 100644 --- a/twe/install_ok.php +++ b/twe/j_install.php @@ -5,7 +5,11 @@ include "func.php"; use utilphp\util as util; -if(file_exists("d_setting/set.php")) error("이미 set.php가 생성되어 있습니다.

재설치하려면 해당 파일을 지우세요"); +if(getUserGrade(true) < 5){ + die('관리자 아님'); +} + +if(file_exists("d_setting/conf.php")) error("이미 conf.php가 생성되어 있습니다.

재설치하려면 해당 파일을 지우세요"); $hostname = util::array_get($_POST['hostname'], ''); @@ -95,12 +99,11 @@ 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),""); // 파일로 DB 정보 저장 -$file=@fopen("d_setting/set.php","w") or Error("set.php 파일 생성 실패

디렉토리의 퍼미션을 707로 주십시요",""); -@fwrite($file,"
디렉토리의 퍼미션을 707로 주십시요",""); -@fclose($file); +//TODO:Template로 기록 + @mkdir("data",0707); @chmod("data",0707); -@chmod("d_setting/set.php",0707); +@chmod("d_setting/conf.php",0707); $temp=MYDB_fetch_array(MYDB_query("select count(*) from general where level = '1'", $connect)); diff --git a/twe/j_install2.php b/twe/j_install2.php new file mode 100644 index 00000000..fc57f0d8 --- /dev/null +++ b/twe/j_install2.php @@ -0,0 +1,401 @@ +웹 IRC : http://barosl.com/webirc/흠냐
폭력적/선정적인 전콘/전메는 블럭/삭제 대상이 될 수 있습니다.', + 500, 300, 55, 120, 100, 100, + '$turntime', '$starttime', '$turnterm', '$killturn', + 5, '$startyear', '$scenario', '$img', '$npcmode', '$extend', '$fiction', + + 100, 150, 7, 10, 9, 9, -- 보병 + 100, 200, 7, 10, 10, 11, -- 청주병(중원) + 150, 150, 7, 10, 11, 10, -- 수병(오월) + 100, 150, 7, 20, 10, 10, -- 자객병(저) + 150, 200, 7, 10, 12, 12, -- 근위병(낙양) + 100, 250, 7, 5, 13, 10, -- 등갑병(남중) + + 100, 100, 7, 20, 10, 10, -- 궁병 + 100, 100, 8, 30, 11, 12, -- 궁기병(동이) + 150, 100, 8, 20, 12, 11, -- 연노병(서촉) + 150, 150, 7, 20, 13, 13, -- 강궁병(양양) + 200, 100, 7, 20, 13, 13, -- 석궁병(건업) + + 150, 100, 7, 5, 11, 11, -- 기병 + 200, 100, 7, 5, 12, 13, -- 백마병(하북) + 150, 150, 7, 5, 13, 12, -- 중장기병(서북) + 200, 100, 8, 5, 13, 11, -- 돌격기병(흉노) + 100, 200, 7, 5, 11, 13, -- 철기병(강) + 150, 100, 8, 15, 12, 12, -- 수렵기병(산월) + 250, 200, 6, 0, 16, 16, -- 맹수병(남만) + 200, 150, 7, 5, 14, 14, -- 호표기병(허창) + + 80, 80, 7, 5, 9, 9, -- 귀병 + 80, 80, 7, 20, 10, 10, -- 신귀병(초) + 80, 130, 7, 5, 9, 11, -- 백귀병(오환) + 130, 80, 7, 5, 11, 9, -- 흑귀병(왜) + 130, 130, 7, 0, 12, 12, -- 악귀병(장안) + 60, 60, 7, 10, 8, 8, -- 남귀병 + 110, 110, 7, 0, 13, 10, -- 황귀병(낙양) + 80, 130, 7, 15, 11, 12, -- 천귀병(성도) + 130, 80, 7, 15, 12, 11, -- 마귀병(업) + + 100, 100, 6, 0, 15, 5, -- 정란 + 150, 100, 6, 0, 20, 5, -- 충차 + 200, 100, 6, 0, 25, 5, -- 벽력거(업) + 50, 200, 5, 0, 30, 5 -- 목우(성도) + )", + $connect +) or Error(__LINE__.MYDB_error($connect),""); + +// 도시정보 입력 +// 이름 규모 인구 농업 상업 치안 수비 성벽 지역 경로 +insertCity( "업", 8, 620500, 12500, 11300, 10000, 11700, 12200, 1, "9|18|70|78|80"); // 1 : 업 +insertCity("허창", 8, 587600, 12100, 12400, 10000, 11700, 12500, 2, "10|19|38|71|74|80"); // 2 : 허창 +insertCity("낙양", 8, 835700, 11700, 12000, 10000, 12100, 12400, 2, "70|71|72|74"); // 3 : 낙양 +insertCity("장안", 8, 592300, 11600, 12300, 10000, 12000, 11800, 3, "41|73|86"); // 4 : 장안 +insertCity("성도", 8, 652500, 12300, 12500, 10000, 12500, 12300, 4, "26|27|87"); // 5 : 성도 +insertCity("양양", 8, 583700, 12000, 12600, 10000, 11500, 11700, 6, "51|89"); // 6 : 양양 +insertCity("건업", 8, 638600, 11600, 12300, 10000, 11500, 11900, 7, "31|82|83"); // 7 : 건업 + +insertCity("북평", 7, 486200, 10200, 9500, 8000, 10300, 9900, 1, "77|90"); // 8 : 북평 +insertCity("남피", 7, 503200, 9900, 10100, 8000, 10100, 10500, 1, "1|36|77"); // 9 : 남피 +insertCity( "완", 7, 472400, 10300, 10000, 8000, 10100, 9900, 2, "2|20|51|71"); // 10 : 완 +insertCity("수춘", 7, 514300, 9900, 9600, 8000, 9900, 9500, 2, "12|20|38|82"); // 11 : 수춘 +insertCity("서주", 7, 485300, 10100, 9800, 8000, 10200, 9700, 2, "11|21|38|39"); // 12 : 서주 +insertCity("강릉", 7, 485000, 10500, 9600, 8000, 9500, 9600, 6, "14|53|88|89"); // 13 : 강릉 +insertCity("장사", 7, 471000, 9700, 9900, 8000, 10000, 10500, 6, "13|15|30|53|54"); // 14 : 장사 +insertCity("시상", 7, 525200, 9800, 10000, 10000, 9900, 9600, 7, "14|56|58|91|92"); // 15 : 시상 +insertCity("위례", 7, 492600, 10000, 9300, 8000, 9800, 10300, 8, "32|33|34|60|79"); // 16 : 위례 + +insertCity( "계", 6, 388500, 7500, 8000, 6000, 7800, 8100, 1, "35|77"); // 17 : 계 +insertCity("복양", 6, 418500, 8000, 8300, 6000, 8200, 8000, 2, "1|19|78|81"); // 18 : 복양 +insertCity("진류", 6, 395700, 8200, 8000, 6000, 8000, 8300, 2, "2|18|74|80|81"); // 19 : 진류 +insertCity("여남", 6, 383100, 7700, 8100, 6000, 8400, 7700, 2, "10|11|38"); // 20 : 여남 +insertCity("하비", 6, 427800, 8500, 8300, 6000, 8200, 7800, 2, "12|83"); // 21 : 하비 +insertCity("서량", 6, 387400, 7700, 7900, 6000, 8300, 8000, 3, "40|63|64"); // 22 : 서량 +insertCity("하내", 6, 373600, 7700, 8100, 6000, 8100, 8000, 3, "35|42|65|70"); // 23 : 하내 +insertCity("한중", 6, 402700, 7700, 8400, 6000, 8000, 8500, 4, "25|75|86"); // 24 : 한중 +insertCity("상용", 6, 368700, 7800, 7600, 6000, 7700, 8100, 4, "24|51"); // 25 : 상용 +insertCity("덕양", 6, 380300, 8100, 8400, 6000, 7900, 7700, 4, "5|27|44|45"); // 26 : 덕양 +insertCity("강주", 6, 412600, 7900, 8000, 6000, 8400, 8100, 4, "5|26|45|46|47"); // 27 : 강주 +insertCity("건녕", 6, 376500, 8200, 8000, 6000, 8600, 8100, 5, "46|48|49"); // 28 : 건녕 +insertCity("남해", 6, 380300, 8200, 7600, 6000, 8000, 8100, 5, "50|55|59|67"); // 29 : 남해 +insertCity("계양", 6, 395500, 8300, 8000, 6000, 8100, 7700, 6, "14|54|55"); // 30 : 계양 +insertCity( "오", 6, 435500, 7700, 8100, 6000, 7700, 7600, 7, "7|57|92|93"); // 31 : 오 +insertCity("평양", 6, 398200, 7800, 8000, 6000, 8300, 7800, 8, "16|61"); // 32 : 평양 +insertCity("사비", 6, 415700, 7700, 7900, 6000, 7800, 8000, 8, "16|34|93"); // 33 : 사비 +insertCity("계림", 6, 391100, 8000, 7400, 6000, 8100, 7800, 8, "16|33|62|93"); // 34 : 계림 + +insertCity("진양", 5, 307400, 5600, 5900, 4000, 6400, 5900, 1, "17|23|70"); // 35 : 진양 +insertCity("평원", 5, 307400, 6200, 6500, 4000, 6100, 6300, 1, "9|37|78"); // 36 : 평원 +insertCity("북해", 5, 314600, 5500, 6300, 4000, 6300, 5800, 1, "36|39|79"); // 37 : 북해 +insertCity( "초", 5, 328600, 6000, 6200, 4000, 6200, 5700, 2, "2|11|12|20|81"); // 38 : 초 +insertCity( "패", 5, 287700, 6400, 5800, 4000, 5800, 5900, 2, "12|37|81"); // 39 : 패 +insertCity("천수", 5, 298500, 5900, 6400, 4000, 6000, 5800, 3, "22|41|64|84"); // 40 : 천수 +insertCity("안정", 5, 276400, 5700, 5900, 4000, 5700, 6200, 3, "4|40|85"); // 41 : 안정 +insertCity("홍농", 5, 274800, 5700, 6300, 4000, 5800, 6300, 3, "23|72|73"); // 42 : 홍농 +insertCity("하변", 5, 278500, 5800, 6200, 4000, 6000, 5600, 4, "76|85"); // 43 : 하변 +insertCity("자동", 5, 287000, 5700, 5500, 4000, 6000, 5800, 4, "26|75|76|87"); // 44 : 자동 +insertCity("영안", 5, 315300, 6200, 5900, 4000, 5800, 5900, 4, "26|27|88"); // 45 : 영안 +insertCity("귀양", 5, 274600, 5800, 6100, 4000, 6100, 5800, 5, "27|28|47"); // 46 : 귀양 +insertCity("주시", 5, 282800, 6000, 5900, 4000, 5800, 6300, 5, "27|46|48"); // 47 : 주시 +insertCity("운남", 5, 325800, 6200, 6000, 4000, 6400, 6100, 5, "28|47|66"); // 48 : 운남 +insertCity("남영", 5, 285300, 5900, 6200, 4000, 5800, 5700, 5, "28|54|66"); // 49 : 남영 +insertCity("교지", 5, 319500, 5800, 5900, 4000, 5800, 5900, 5, "29|66"); // 50 : 교지 +insertCity("신야", 5, 278600, 6000, 6200, 4000, 5800, 5500, 6, "6|10|25"); // 51 : 신야 +insertCity("강하", 5, 307400, 5500, 5600, 4000, 5700, 6000, 6, "89|91"); // 52 : 강하 +insertCity("무릉", 5, 319600, 5800, 6300, 4000, 6300, 5800, 6, "13|14|54"); // 53 : 무릉 +insertCity("영릉", 5, 284900, 6200, 5800, 4000, 6200, 6200, 6, "14|30|49|53"); // 54 : 영릉 +insertCity("상동", 5, 276700, 5800, 5900, 4000, 6200, 5800, 6, "29|30|58"); // 55 : 상동 +insertCity("여강", 5, 290500, 5600, 5800, 4000, 6000, 5500, 7, "15|82|91|92"); // 56 : 여강 +insertCity("회계", 5, 300500, 6400, 5900, 4000, 6200, 6400, 7, "31|67"); // 57 : 회계 +insertCity("고창", 5, 280200, 5700, 6200, 4000, 5800, 6300, 7, "15|55|67"); // 58 : 고창 +insertCity( "대", 5, 325600, 6000, 6200, 4000, 5700, 6000, 7, "29|67|94"); // 59 : 대 +insertCity("안평", 5, 293700, 6300, 5900, 4000, 5900, 6300, 8, "16|61|79|90"); // 60 : 안평 +insertCity("졸본", 5, 293900, 5500, 5900, 4000, 6000, 5800, 8, "32|60|68"); // 61 : 졸본 +insertCity("이도", 5, 317400, 5800, 6100, 4000, 5800, 5600, 8, "34|69|93"); // 62 : 이도 + +insertCity( "강", 4, 209500, 4000, 4200, 2000, 4300, 4000, 3, "22|84"); // 63 : 강 +insertCity( "저", 4, 195700, 4000, 4200, 2000, 4300, 4200, 3, "22|40|85"); // 64 : 저 +insertCity("흉노", 4, 206400, 4000, 4100, 2000, 4000, 3800, 3, "23|84"); // 65 : 흉노 +insertCity("남만", 4, 237800, 4000, 4200, 2000, 4300, 4500, 5, "48|49|50"); // 66 : 남만 +insertCity("산월", 4, 227500, 4000, 3700, 2000, 4300, 3800, 7, "29|57|58|59"); // 67 : 산월 +insertCity("오환", 4, 215300, 4200, 3700, 2000, 4300, 4000, 8, "61|90"); // 68 : 오환 +insertCity( "왜", 4, 206500, 3900, 3700, 2000, 4300, 4100, 8, "62|94"); // 69 : 왜 + +insertCity("호관", 3, 88700, 1900, 1800, 2000, 9500, 9600, 1, "1|3|23|35"); // 70 : 호관 +insertCity("호로", 3, 111200, 2200, 2100, 2000, 10300, 9800, 2, "2|3|10"); // 71 : 호로 +insertCity("사곡", 3, 100800, 2100, 1900, 2000, 9900, 10100, 3, "3|42"); // 72 : 사곡 +insertCity("함곡", 3, 108100, 2000, 2200, 2000, 10100, 10200, 3, "4|42"); // 73 : 함곡 +insertCity("사수", 3, 95800, 1700, 1900, 2000, 9500, 9600, 2, "2|3|19|80"); // 74 : 사수 +insertCity("양평", 3, 86800, 1900, 1900, 2000, 9700, 9600, 4, "24|44|86"); // 75 : 양평 +insertCity("가맹", 3, 85500, 1700, 1800, 2000, 9600, 9500, 4, "43|44"); // 76 : 가맹 + +insertCity("역경", 2, 98500, 1800, 1900, 2000, 3900, 4100, 1, "8|9|17"); // 77 : 역경 +insertCity("계교", 2, 101200, 2100, 1900, 2000, 4000, 4200, 1, "1|18|36"); // 78 : 계교 +insertCity("동황", 2, 99200, 1900, 2100, 2000, 3800, 4000, 1, "16|37|60"); // 79 : 동황 +insertCity("관도", 2, 112300, 2200, 2000, 2000, 4200, 4300, 2, "1|2|19|74"); // 80 : 관도 +insertCity("정도", 2, 108500, 2100, 2100, 2000, 4100, 3800, 2, "18|19|38|39"); // 81 : 정도 +insertCity("합비", 2, 99800, 2000, 1900, 2000, 3900, 4100, 2, "7|11|56"); // 82 : 합비 +insertCity("광릉", 2, 100100, 2000, 2100, 2000, 4100, 4000, 2, "7|21"); // 83 : 광릉 +insertCity("적도", 2, 95200, 1800, 1700, 2000, 3800, 3700, 3, "40|63|65"); // 84 : 적도 +insertCity("가정", 2, 93100, 1700, 1700, 2000, 3600, 3800, 3, "41|43|64"); // 85 : 가정 +insertCity("기산", 2, 100500, 1900, 1800, 2000, 4100, 4000, 4, "4|24|75"); // 86 : 기산 +insertCity("면죽", 3, 109300, 2200, 2100, 2000, 10800, 9900, 4, "5|44"); // 87 : 면죽 +insertCity("이릉", 2, 96800, 1800, 1900, 2000, 3900, 4100, 6, "13|45"); // 88 : 이릉 +insertCity("장판", 2, 103200, 2100, 2000, 2000, 4000, 3700, 6, "6|13|52|91"); // 89 : 장판 +insertCity("백랑", 2, 105200, 2200, 1900, 2000, 3800, 4200, 8, "8|60|68"); // 90 : 백랑 + +insertCity("적벽", 1, 111700, 2300, 2100, 2000, 4200, 4100, 7, "15|52|56|89"); // 91 : 적벽 +insertCity("파양", 1, 103700, 2000, 2200, 2000, 3800, 3800, 7, "15|31|56"); // 92 : 파양 +insertCity("탐라", 1, 113000, 2200, 2100, 2000, 4300, 4100, 8, "31|33|34|62"); // 93 : 탐라 +insertCity("유구", 1, 92100, 1700, 1800, 2000, 3700, 3700, 8, "59|69"); // 94 : 유구 + +//TODO:debug all and replace +switch($scenario) { + case 0: echo "index.php"; break; + case 1: echo "scenario_1.php"; break; + case 2: echo "scenario_2.php"; break; + case 3: echo "scenario_3.php"; break; + case 4: echo "scenario_4.php"; break; + case 5: echo "scenario_5.php"; break; + case 6: echo "scenario_6.php"; break; + case 7: echo "scenario_7.php"; break; + case 8: echo "scenario_8.php"; break; + case 9: echo "scenario_9.php"; break; + case 10: echo "scenario_10.php"; break; + case 11: echo "scenario_11.php"; break; + + case 12: echo "scenario_12.php"; break; + + case 20: echo "scenario_20.php"; break; + case 21: echo "scenario_21.php"; break; + case 22: echo "scenario_22.php"; break; + case 23: echo "scenario_23.php"; break; + case 24: echo "scenario_24.php"; break; + case 25: echo "scenario_25.php"; break; + case 26: echo "scenario_26.php"; break; + case 27: echo "scenario_27.php"; break; + case 28: echo "scenario_28.php"; break; + default: echo "install3_ok.php"; break; +} +/* +switch($scenario) { + case 0: echo ""; break; + case 1: echo ""; break; + case 2: echo ""; break; + case 3: echo ""; break; + case 4: echo ""; break; + case 5: echo ""; break; + case 6: echo ""; break; + case 7: echo ""; break; + case 8: echo ""; break; + case 9: echo ""; break; + case 10: echo ""; break; + case 11: echo ""; break; + + case 12: echo ""; break; + + case 20: echo ""; break; + case 21: echo ""; break; + case 22: echo ""; break; + case 23: echo ""; break; + case 24: echo ""; break; + case 25: echo ""; break; + case 26: echo ""; break; + case 27: echo ""; break; + case 28: echo ""; break; + default: echo ""; break; +} +*/ +function insertCity($name, $level, $pop2, $agri2, $comm2, $secu2, $def2, $wall2, $region, $path) { + switch($level) { + case 1: $pop = 5000; $agri = 100; $comm = 100; $secu = 100; $def = 500; $wall = 500; break; + case 2: $pop = 5000; $agri = 100; $comm = 100; $secu = 100; $def = 500; $wall = 500; break; + case 3: $pop = 10000; $agri = 100; $comm = 100; $secu = 100; $def = 1000; $wall = 1000; break; + case 4: $pop = 50000; $agri = 1000; $comm = 1000; $secu = 1000; $def = 1000; $wall = 1000; break; + case 5: $pop = 100000; $agri = 1000; $comm = 1000; $secu = 1000; $def = 2000; $wall = 2000; break; + case 6: $pop = 100000; $agri = 1000; $comm = 1000; $secu = 1000; $def = 3000; $wall = 3000; break; + case 7: $pop = 150000; $agri = 1000; $comm = 1000; $secu = 1000; $def = 4000; $wall = 4000; break; + case 8: $pop = 150000; $agri = 1000; $comm = 1000; $secu = 1000; $def = 5000; $wall = 5000; break; + } + + getDB()->insert('city',[ + 'name'=>$name, + 'level'=>$level, + 'path'=>$path, + 'pop'=>$pop, + 'pop2'=>$pop2, + 'agri'=>$agri, + 'agri2'=>$agri2, + 'comm'=>$comm, + 'comm2'=>$comm2, + 'secu'=>$secu, + 'secu2'=>$secu2, + 'rate'=>50, + 'trade'=>100, + 'def'=>$def, + 'def2'=>$def2, + 'wall'=>$wall, + 'wall2'=>$wall2, + 'gen1'=>0, + 'gen2'=>0, + 'gen3'=>0, + 'region'=>$region + ]); +} + diff --git a/twe/install3_ok.php b/twe/j_install3.php similarity index 75% rename from twe/install3_ok.php rename to twe/j_install3.php index b5d741aa..6d8973a1 100644 --- a/twe/install3_ok.php +++ b/twe/j_install3.php @@ -2,6 +2,10 @@ include "lib.php"; include "func.php"; +if(getUserGrade(true) < 5){ + die('관리자 아님'); +} + $connect=dbConn(); LogHistory(1); diff --git a/twe/j_msgsubmit.php b/twe/j_msgsubmit.php index c2db0e7f..fda0ea48 100644 --- a/twe/j_msgsubmit.php +++ b/twe/j_msgsubmit.php @@ -54,7 +54,7 @@ if(getBlockLevel() == 1 || getBlockLevel() == 3) { $conlimit = $db->queryFirstField('select conlimit from game where no=1'); -$me = $db->queryFirstRow('select `no`,`name`,`nation`,`level`,`userlevel`,`con`,`picture`,`imgsvr` from `general` where `owner` = %i', getUserID()); +$me = $db->queryFirstRow('select `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr` from `general` where `owner` = %i', getUserID()); if(!$me){ resetSessionGeneralValues(); @@ -65,7 +65,7 @@ if(!$me){ ]); } -$con = checkLimit($me['userlevel'], $me['con'], $conlimit); +$con = checkLimit($me['con'], $conlimit); if($con >= 2) { returnJson([ 'result' => false, diff --git a/twe/j_server_basic_info.php b/twe/j_server_basic_info.php new file mode 100644 index 00000000..6a4a5d66 --- /dev/null +++ b/twe/j_server_basic_info.php @@ -0,0 +1,94 @@ +'x', + 'me'=>'no' + ]); +} + +//FIXME:Name이 없는 동명의 함수가 있음 +function getScenarioName($scenario) { + switch($scenario) { + case 0: $str = "공백지모드"; break; + case 1: $str = "역사모드1 : 184년 황건적의 난"; break; + case 2: $str = "역사모드2 : 190년 반동탁연합"; break; + case 3: $str = "역사모드3 : 194년 군웅할거"; break; + case 4: $str = "역사모드4 : 196년 황제는 허도로"; break; + case 5: $str = "역사모드5 : 200년 관도대전"; break; + case 6: $str = "역사모드6 : 202년 원가의 분열"; break; + case 7: $str = "역사모드7 : 207년 적벽대전"; break; + case 8: $str = "역사모드8 : 213년 익주 공방전"; break; + case 9: $str = "역사모드9 : 219년 삼국정립"; break; + case 10: $str = "역사모드10 : 225년 칠종칠금"; break; + case 11: $str = "역사모드11 : 228년 출사표"; break; + + case 12: $str = "IF모드1 : 191년 백마장군의 위세"; break; + + case 20: $str = "가상모드1 : 180년 영웅 난무"; break; + case 21: $str = "가상모드1 : 180년 영웅 집결"; break; + case 22: $str = "가상모드2 : 179년 훼신 집결"; break; + case 23: $str = "가상모드3 : 180년 영웅 시대"; break; + case 24: $str = "가상모드4 : 180년 결사항전"; break; + case 25: $str = "가상모드5 : 180년 영웅독존"; break; + case 26: $str = "가상모드6 : 180년 무풍지대"; break; + case 27: $str = "가상모드7 : 180년 가요대잔치"; break; + case 28: $str = "가상모드8 : 180년 확산성 밀리언 아서"; break; + default: $str = "시나리오?"; break; + } + return $str; +} + +function getTurnTerm($term) { + switch($term) { + case 0: $str = "120분 턴 서버"; break; + case 1: $str = "60분 턴 서버"; break; + case 2: $str = "30분 턴 서버"; break; + case 3: $str = "20분 턴 서버"; break; + case 4: $str = "10분 턴 서버"; break; + case 5: $str = "5분 턴 서버"; break; + case 6: $str = "2분 턴 서버"; break; + case 7: $str = "1분 턴 서버"; break; + } + return $str; +} + +$db = getDB(); + +$game = $db->queryFirstRow('SELECT isUnited, npcMode, year, month, scenario, maxgeneral as maxUserCnt, turnTerm from game where `no`=1'); + +$nationCnt = $db->queryFirstField('SELECT count(`nation`) from nation where `level` > 0'); +$genCnt = $db->queryFirstField('SELECT count(`no`) from general where `npc` < 2'); +$npcCnt = $db->queryFirstField('SELECT count(`no`) from general where `npc` >= 2'); + +$game['turnTerm'] = getTurnTerm($game['turnTerm']); +$game['scenario'] = getScenarioName($game['scenario']); +$game['userCnt'] = $genCnt; +$game['npcCnt'] = $npcCnt; + +$generalID = getGeneralID(false, false); +$userGrade = getUserGrade(); +$me = [ + 'blocked'=> ($userGrade == 0) +]; + +if($generalID){ + $general = queryFirstRow('SELECT name, picture, imgsvr from general where no=%i', $generalID); + if($general){ + $me['name'] = $general['name']; + + if($me['imgsvr'] == 0) { + $me['picture'] = IMAGE.W.$me['PICTURE']; + } else { + $me['picture'] = '../d_pic/'.$me['PICTURE']; + } + } +} + +//TODO: 이를 표현하는 방법은 '이전 버전'의 serverListPost.php를 참고할 것. +jsonReturn([ + 'game'=>$game, + 'me'=>$me +]); \ No newline at end of file diff --git a/twe/join_post.php b/twe/join_post.php index 01acca2e..c1cde1cd 100644 --- a/twe/join_post.php +++ b/twe/join_post.php @@ -179,8 +179,6 @@ if($id_num) { $face = "default.jpg"; $imgsvr = 0; } - //특회 - $userlevel = $member['grade']; //성격 랜덤시 if($character == 11) $character = rand()%10; @@ -207,7 +205,6 @@ if($id_num) { 'crew' => 0, 'train' => 0, 'atmos' => 0, - 'userlevel' => $userlevel, 'level' => 0, 'turntime' => $turntime, 'killturn' => 6, diff --git a/twe/preprocessing.php b/twe/preprocessing.php index 804ed7f9..1123d3b2 100644 --- a/twe/preprocessing.php +++ b/twe/preprocessing.php @@ -10,11 +10,11 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,nation,userlevel,con from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,nation,con from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { //echo ""; echo 'index.php';//TODO:debug all and replace diff --git a/twe/reset.php b/twe/reset.php index e763976d..26bb2bc8 100644 --- a/twe/reset.php +++ b/twe/reset.php @@ -3,10 +3,7 @@ include "lib.php"; include "func.php"; include "schema.php"; -$userID = getUserID(); -$userLevel = toInt(getRootDB()->queryFirstField('select userlevel from member where no=%i',$userID)); - -if($userLevel < 5){ +if(getUserGrade(true) < 5){ echo '관리자 아님'; die(); } @@ -17,7 +14,7 @@ $connect = dbConn(); // 삭제 -unlink("d_setting/set.php"); +unlink("d_setting/conf.php"); // DB에 커넥트 하고 DB NAME으로 select DB $connect = @MYDB_connect($hostname,$user_id,$password) or Error("MySQL-DB Connect
Error!!!",""); @@ -28,28 +25,29 @@ delInDir("logs"); delInDir("data/session"); @unlink("data/connected.php"); + // 관리자 테이블 삭제 -if(isTable($connect, "game",$dbname)) @MYDB_query("drop table game", $connect) or Error(__LINE__.MYDB_error($connect),""); +if(isTable($connect, "game",$dbname)) @MYDB_query("DROP TABLE IF EXISTS game", $connect) or Error(__LINE__.MYDB_error($connect),""); // 장수 테이블 삭제 -if(isTable($connect, "gen",$dbname)) @MYDB_query("drop table general", $connect) or Error(__LINE__.MYDB_error($connect),""); +if(isTable($connect, "gen",$dbname)) @MYDB_query("DROP TABLE IF EXISTS general", $connect) or Error(__LINE__.MYDB_error($connect),""); // 국가 테이블 삭제 -if(isTable($connect, "nation",$dbname)) @MYDB_query("drop table nation", $connect) or Error(__LINE__.MYDB_error($connect),""); +if(isTable($connect, "nation",$dbname)) @MYDB_query("DROP TABLE IF EXISTS nation", $connect) or Error(__LINE__.MYDB_error($connect),""); // 도시 테이블 삭제 -if(isTable($connect, "city",$dbname)) @MYDB_query("drop table city", $connect) or Error(__LINE__.MYDB_error($connect),""); +if(isTable($connect, "city",$dbname)) @MYDB_query("DROP TABLE IF EXISTS city", $connect) or Error(__LINE__.MYDB_error($connect),""); // 부대 테이블 삭제 -if(isTable($connect, "troop",$dbname)) @MYDB_query("drop table troop", $connect) or Error(__LINE__.MYDB_error($connect),""); +if(isTable($connect, "troop",$dbname)) @MYDB_query("DROP TABLE IF EXISTS troop", $connect) or Error(__LINE__.MYDB_error($connect),""); // 토큰 테이블 삭제 -if(isTable($connect, "token",$dbname)) @MYDB_query("drop table token", $connect) or Error(__LINE__.MYDB_error($connect),""); +if(isTable($connect, "token",$dbname)) @MYDB_query("DROP TABLE IF EXISTS token", $connect) or Error(__LINE__.MYDB_error($connect),""); // 외교 테이블 삭제 -if(isTable($connect, "diplomacy",$dbname)) @MYDB_query("drop table diplomacy", $connect) or Error(__LINE__.MYDB_error($connect),""); +if(isTable($connect, "diplomacy",$dbname)) @MYDB_query("DROP TABLE IF EXISTS diplomacy", $connect) or Error(__LINE__.MYDB_error($connect),""); // 토너먼트 테이블 삭제 -if(isTable($connect, "tournament",$dbname)) @MYDB_query("drop table tournament", $connect) or Error(__LINE__.MYDB_error($connect),""); +if(isTable($connect, "tournament",$dbname)) @MYDB_query("DROP TABLE IF EXISTS tournament", $connect) or Error(__LINE__.MYDB_error($connect),""); // 거래 테이블 삭제 -if(isTable($connect, "auction",$dbname)) @MYDB_query("drop table auction", $connect) or Error("drop ".MYDB_error($connect),""); +if(isTable($connect, "auction",$dbname)) @MYDB_query("DROP TABLE IF EXISTS auction", $connect) or Error("drop ".MYDB_error($connect),""); // 통계 테이블 삭제 -if(isTable($connect, "statistic",$dbname)) @MYDB_query("drop table statistic", $connect) or Error("drop ".MYDB_error($connect),""); +if(isTable($connect, "statistic",$dbname)) @MYDB_query("DROP TABLE IF EXISTS statistic", $connect) or Error("drop ".MYDB_error($connect),""); // 연감 테이블 삭제 -if(isTable($connect, "history",$dbname)) @MYDB_query("drop table history", $connect) or Error("drop ".MYDB_error($connect),""); +if(isTable($connect, "history",$dbname)) @MYDB_query("DROP TABLE IF EXISTS history", $connect) or Error("drop ".MYDB_error($connect),""); // 관리자 테이블 생성 if(!isTable($connect, "game",$dbname)) @MYDB_query($game_schema, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -77,12 +75,12 @@ 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),""); // 파일로 DB 정보 저장 -$file=@fopen("d_setting/set.php","w") or Error("set.php 파일 생성 실패

디렉토리의 퍼미션을 707로 주십시요",""); -@fwrite($file,"
디렉토리의 퍼미션을 707로 주십시요",""); +$file=@fopen("d_setting/conf.php","w") or Error("conf.php 파일 생성 실패

디렉토리의 퍼미션을 707로 주십시요",""); +@fwrite($file,"
디렉토리의 퍼미션을 707로 주십시요",""); @fclose($file); @mkdir("data",0707); @chmod("data",0707); -@chmod("d_setting/set.php",0707); +@chmod("d_setting/conf.php",0707); $temp=MYDB_fetch_array(MYDB_query("select count(*) from general where level = '1'", $connect)); diff --git a/twe/schema.php b/twe/schema.php index ea696f1e..89cce609 100644 --- a/twe/schema.php +++ b/twe/schema.php @@ -87,7 +87,6 @@ CREATE TABLE `general` ( `tnmt` INT(1) NULL DEFAULT '1', `map` INT(1) NULL DEFAULT '0', `myset` INT(1) NULL DEFAULT '3', - `userlevel` INT(1) NULL DEFAULT '1', `tournament` INT(1) NULL DEFAULT '0', `vote` INT(1) NULL DEFAULT '0', `newvote` INT(1) NULL DEFAULT '0', diff --git a/twe/select_npc_post.php b/twe/select_npc_post.php index d8daa726..af5a8cb9 100644 --- a/twe/select_npc_post.php +++ b/twe/select_npc_post.php @@ -81,9 +81,6 @@ if($admin['npcmode'] != 1) { exit; */ } else { - //특회 - $userlevel = $member['grade']; - $query = " update general set name2='{$member['name']}', @@ -94,7 +91,6 @@ if($admin['npcmode'] != 1) { mode=2, map=0, owner='$userID', - userlevel='{$userlevel}' where no='{$npcid}' "; MYDB_query($query, $connect) or Error("join_post ".MYDB_error($connect),""); diff --git a/twe/turn.php b/twe/turn.php index 23a22120..37c00c4c 100644 --- a/twe/turn.php +++ b/twe/turn.php @@ -12,11 +12,11 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,nation,userlevel,con from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,nation,con from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$con = checkLimit($me['con'], $admin['conlimit']); if($con >= 2) { //echo ""; echo 'index.php';//TODO:debug all and replace