diff --git a/i_entrance/j_server_change_status.php b/i_entrance/j_server_change_status.php index a86d3a32..18356c7c 100644 --- a/i_entrance/j_server_change_status.php +++ b/i_entrance/j_server_change_status.php @@ -77,7 +77,7 @@ function doAdminPost($action, $notice, $server){ $response['result'] = 'FAIL'; if($action == 'notice') { - RootDB::db()->update('SYSTEM', ['NOTICE'=>$notice], 'NO=1'); + RootDB::db()->update('SYSTEM', ['NOTICE'=>$notice], true); $response['result'] = 'SUCCESS'; return $response; } diff --git a/src/sammo/Session.php b/src/sammo/Session.php index f2c7c28c..5725f8d7 100644 --- a/src/sammo/Session.php +++ b/src/sammo/Session.php @@ -24,6 +24,10 @@ class Session { 'writeClosed'=>true ]; + const GAME_KEY_DATE = '_g_loginDate'; + const GAME_KEY_GENERAL_ID = '_g_no'; + const GAME_KEY_GENERAL_NAME = '_g_name'; + const GAME_KEY_EXPECTED_DEADTIME = '_g_deadtime'; private $writeClosed = false; @@ -124,7 +128,9 @@ class Session { return $this; } + public function logout() { + $this->logoutGame(); $this->set('userID', null); $this->set('userName', null); $this->set('userGrade', null); @@ -132,6 +138,75 @@ class Session { return $this; } + public function loginGame(&$result = null){ + $userID = $this->userID; + if(!$userID){ + if($result !== null){ + $result = false; + } + return $this; + } + + if(!class_exists('\\sammo\\DB')){ + if($result !== null){ + $result = false; + } + return $this; + } + + $prefix = DB::prefix(); + $db = DB::db(); + + $loginDate = $this->get($prefix.static::GAME_KEY_DATE); + $generalID = $this->get($prefix.static::GAME_KEY_GENERAL_ID); + $generalName = $this->get($prefix.static::GAME_KEY_GENERAL_NAME); + $deadTime = $this->get($prefix.static::GAME_KEY_EXPECTED_DEADTIME); + + $now = time(); + if( + $generalID && $generalName && $loginDate && $deateTime + && $loginDate + 600 > $now && $deadTime > $now + ){ + //로그인 정보는 5분간 유지한다. + if($result !== null){ + $result = true; + } + return $this; + } + + if($generalID || $generalName || $loginDate || $deadTime){ + $this->logoutGame(); + } + + $general = $db->queryFirstRow( + 'SELECT `no`, `name`, `killturn`, `turntime` from general where `owner` = %i', + $userID + ); + if(!$general){ + if($result !== null){ + $result = false; + } + return $this; + } + + $turnterm = $db->queryFirstField('SELECT turnterm from game limit 1'); + + $generalID = $general['no']; + $generalName = $general['name']; + + + } + + public function logoutGame(){ + $prefix = DB::prefix(); + $this->set($prefix.static::GAME_KEY_DATE, null); + $this->set($prefix.static::GAME_KEY_GENERAL_ID, null); + $this->set($prefix.static::GAME_KEY_GENERAL_NAME, null); + $this->set($prefix.static::GAME_KEY_EXPECTED_DEADTIME, null); + return $this; + } + + /** * 로그인 유저의 전역 grade를 받아옴 * @return int|null diff --git a/twe/_admin1_submit.php b/twe/_admin1_submit.php index 5ae82355..00de2256 100644 --- a/twe/_admin1_submit.php +++ b/twe/_admin1_submit.php @@ -17,7 +17,7 @@ if(Session::getUserGrade() < 5) { switch($btn) { case "변경": $msg = addslashes(SQ2DQ($msg)); - $query = "update game set msg='$msg' where no='1'"; + $query = "update game set msg='$msg'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); break; case "요청": @@ -31,23 +31,23 @@ switch($btn) { pushHistory($history); break; case "변경1": - $query = "update game set starttime='$starttime' where no='1'"; + $query = "update game set starttime='$starttime'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); break; case "변경2": - $query = "update game set maxgeneral='$maxgeneral' where no='1'"; + $query = "update game set maxgeneral='$maxgeneral'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); break; case "변경3": - $query = "update game set maxnation='$maxnation' where no='1'"; + $query = "update game set maxnation='$maxnation'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); break; case "변경4": - $query = "update game set startyear='$startyear' where no='1'"; + $query = "update game set startyear='$startyear'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); break; case "변경5": - $query = "update game set normgeneral='$gen_rate' where no='1'"; + $query = "update game set normgeneral='$gen_rate'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); break; case "1분턴": @@ -72,7 +72,7 @@ switch($btn) { $turn = ($admin['year'] - $admin['startyear']) * 12 + $admin['month'] - 1; $starttime = date("Y-m-d H:i:s", strtotime($admin['turntime']) - $turn * $unit); $starttime = cutTurn($starttime, $turnterm); - $query = "update game set turnterm='$turnterm',starttime='$starttime' where no='1'"; + $query = "update game set turnterm='$turnterm',starttime='$starttime'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); // 턴시간이 길어지는 경우 랜덤턴 배정 if($turnterm < $admin['turnterm']) { diff --git a/twe/_admin2.php b/twe/_admin2.php index ba5856f6..5d39ba8f 100644 --- a/twe/_admin2.php +++ b/twe/_admin2.php @@ -26,7 +26,7 @@ if(Session::getUserGrade() < 5) { exit(); } -$query = "select conlimit,conweight from game where no=1"; +$query = "select conlimit,conweight from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); ?> diff --git a/twe/_admin2_submit.php b/twe/_admin2_submit.php index 7ec156a8..e79ffb94 100644 --- a/twe/_admin2_submit.php +++ b/twe/_admin2_submit.php @@ -24,7 +24,7 @@ switch($btn) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); break; case "접속가중치": - $query = "update game set conweight='$conweight' where no='1'"; + $query = "update game set conweight='$conweight'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); break; case "블럭 해제": @@ -275,7 +275,7 @@ switch($btn) { } break; case "00턴": - $query = "select turnterm from game where no=1"; + $query = "select turnterm from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -287,7 +287,7 @@ switch($btn) { } break; case "랜덤턴": - $query = "select turnterm from game where no=1"; + $query = "select turnterm from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/_admin4.php b/twe/_admin4.php index a902294b..4ec35ea0 100644 --- a/twe/_admin4.php +++ b/twe/_admin4.php @@ -26,7 +26,7 @@ if(Session::getUserGrade() < 5) { exit(); } -$query = "select conlimit from game where no=1"; +$query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); ?> diff --git a/twe/_admin5.php b/twe/_admin5.php index c7994353..d96891a5 100644 --- a/twe/_admin5.php +++ b/twe/_admin5.php @@ -35,7 +35,7 @@ if($type2 == 0) { $sel[$type] = "selected"; $sel2[$type2] = "selected"; -$query = "select conlimit from game where no=1"; +$query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); ?> diff --git a/twe/_simul.php b/twe/_simul.php index c80ca06d..16f2dcaf 100644 --- a/twe/_simul.php +++ b/twe/_simul.php @@ -54,7 +54,7 @@ $query = "select no,tournament,con,turntime from general where owner='{$_SESSION $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -$query = "select * from game where no='1'"; +$query = "select * from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $game = MYDB_fetch_array($result); diff --git a/twe/a_bestGeneral.php b/twe/a_bestGeneral.php index 1a3decc8..088deda8 100644 --- a/twe/a_bestGeneral.php +++ b/twe/a_bestGeneral.php @@ -8,7 +8,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("명장일람", 2); -$query = "select conlimit from game where no=1"; +$query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/a_genList.php b/twe/a_genList.php index 5db3160b..63b600b5 100644 --- a/twe/a_genList.php +++ b/twe/a_genList.php @@ -8,7 +8,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("장수일람", 2); -$query = "select conlimit from game where no=1"; +$query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/a_history.php b/twe/a_history.php index fc583f06..f2e0cb6a 100644 --- a/twe/a_history.php +++ b/twe/a_history.php @@ -9,7 +9,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("연감", 5); -$query = "select startyear,year,month,conlimit from game where no=1"; +$query = "select startyear,year,month,conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/a_kingdomList.php b/twe/a_kingdomList.php index 7c0fe91c..85082b07 100644 --- a/twe/a_kingdomList.php +++ b/twe/a_kingdomList.php @@ -8,7 +8,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("세력일람", 2); -$query = "select conlimit from game where no=1"; +$query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/a_status.php b/twe/a_status.php index e09b9a22..2b76275c 100644 --- a/twe/a_status.php +++ b/twe/a_status.php @@ -9,7 +9,7 @@ $connect = dbConn(); increaseRefresh("세력도", 2); checkTurn($connect); -$query = "select conlimit from game where no=1"; +$query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/a_traffic.php b/twe/a_traffic.php index b5ac0136..2c5f54a6 100644 --- a/twe/a_traffic.php +++ b/twe/a_traffic.php @@ -6,7 +6,7 @@ include "func.php"; $connect = dbConn(); increaseRefresh("갱신정보", 2); -$query = "select year,month,refresh,maxrefresh,maxonline from game where no='1'"; +$query = "select year,month,refresh,maxrefresh,maxonline from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $game = MYDB_fetch_array($result); diff --git a/twe/a_vote.php b/twe/a_vote.php index e7f94f36..10e6ea3a 100644 --- a/twe/a_vote.php +++ b/twe/a_vote.php @@ -10,7 +10,7 @@ $query = "select no,vote from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -$query = "select develcost,voteopen,vote,votecomment from game where no='1'"; +$query = "select develcost,voteopen,vote,votecomment from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/b_auction.php b/twe/b_auction.php index 4683192e..36234102 100644 --- a/twe/b_auction.php +++ b/twe/b_auction.php @@ -12,7 +12,7 @@ $query = "select no,special,con,turntime from general where owner='{$_SESSION['u $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -$query = "select conlimit from game where no=1"; +$query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/b_battleCenter.php b/twe/b_battleCenter.php index 0c6f133d..cab2abfd 100644 --- a/twe/b_battleCenter.php +++ b/twe/b_battleCenter.php @@ -10,7 +10,7 @@ increaseRefresh("감찰부", 2); //전투 추진을 위해 갱신 checkTurn($connect); -$query = "select conlimit from game where no=1"; +$query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/b_betting.php b/twe/b_betting.php index c809ac83..b159b305 100644 --- a/twe/b_betting.php +++ b/twe/b_betting.php @@ -13,7 +13,7 @@ $query = "select no,tournament,con,turntime,bet0+bet1+bet2+bet3+bet4+bet5+bet6+b $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -$query = "select conlimit,tournament,phase,tnmt_type,develcost,bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from game where no=1"; +$query = "select conlimit,tournament,phase,tnmt_type,develcost,bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/b_chiefcenter.php b/twe/b_chiefcenter.php index d59848cc..01e06902 100644 --- a/twe/b_chiefcenter.php +++ b/twe/b_chiefcenter.php @@ -8,7 +8,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("사령부", 1); -$query = "select conlimit from game where no=1"; +$query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -34,7 +34,7 @@ else { $btn = "hidden"; $btn2 = "hidden"; } $date = date('Y-m-d H:i:s'); // 명령 목록 -$query = "select year,month,turnterm from game where no='1'"; +$query = "select year,month,turnterm from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/b_dipcenter.php b/twe/b_dipcenter.php index 752e2a8e..479ce430 100644 --- a/twe/b_dipcenter.php +++ b/twe/b_dipcenter.php @@ -8,7 +8,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("내무부", 1); -$query = "select conlimit from game where no=1"; +$query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -58,7 +58,7 @@ else { $btn = "hidden"; $read = "readonly"; } 비 고 "; -$query = "select tournament,bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from game where no=1"; +$query = "select tournament,bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $betting = MYDB_fetch_array($result); for($i=0; $i < 16; $i++) { diff --git a/twe/c_auction.php b/twe/c_auction.php index 6be9529f..68f783c5 100644 --- a/twe/c_auction.php +++ b/twe/c_auction.php @@ -8,7 +8,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("입찰", 1); -$query = "select turnterm from game where no=1"; +$query = "select turnterm from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/c_betting.php b/twe/c_betting.php index f2af9f1e..2ec8a1ca 100644 --- a/twe/c_betting.php +++ b/twe/c_betting.php @@ -12,7 +12,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("베팅", 1); -$query = "select tournament,phase,tnmt_type,develcost from game where no='1'"; +$query = "select tournament,phase,tnmt_type,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -34,7 +34,7 @@ for($i=0; $i < 16; $i++) { if($gold + 500 <= $me['gold'] && $gold + $mebet <= 1000 && $gold + $me['bet'] <= 1000) { $query = "update general set gold=gold-'$gold',bet{$i}=bet{$i}+'$gold',betgold=betgold+'$gold' where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $query = "update game set bet{$i}=bet{$i}+'$gold' where no='1'"; + $query = "update game set bet{$i}=bet{$i}+'$gold'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } } diff --git a/twe/c_myBossInfo.php b/twe/c_myBossInfo.php index e7a96362..a7158e76 100644 --- a/twe/c_myBossInfo.php +++ b/twe/c_myBossInfo.php @@ -9,7 +9,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select startyear,year,month from game where no='1'"; +$query = "select startyear,year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -156,7 +156,7 @@ if($btn == "추방") { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}에서 추방됨"); diff --git a/twe/c_tournament.php b/twe/c_tournament.php index a9a51a8f..82c6fc51 100644 --- a/twe/c_tournament.php +++ b/twe/c_tournament.php @@ -9,7 +9,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select tournament,phase,tnmt_type,develcost from game where no='1'"; +$query = "select tournament,phase,tnmt_type,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -189,7 +189,7 @@ if($btn == "자동개최설정" && Session::getUserGrade() >= 5) { } elseif($btn == "배정" && Session::getUserGrade() >= 5) { final16set($connect); } elseif($btn == "베팅마감" && Session::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"; + $query = "update game set tournament='7',phase='0',tnmt_time='$dt'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } elseif($btn == "16강" && Session::getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 16); } elseif($btn == "8강" && Session::getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 8); diff --git a/twe/c_vacation.php b/twe/c_vacation.php index c9bd16ea..88baa9ba 100644 --- a/twe/c_vacation.php +++ b/twe/c_vacation.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select killturn from game where no='1'"; +$query = "select killturn from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/c_vote.php b/twe/c_vote.php index e95407c2..396d95bc 100644 --- a/twe/c_vote.php +++ b/twe/c_vote.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select develcost,vote,votecomment from game where no='1'"; +$query = "select develcost,vote,votecomment from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -38,7 +38,7 @@ else if($btn == "댓글" && $comment != "") { if($admin['votecomment'] != "") { $admin['votecomment'] .= "|"; } $admin['votecomment'] .= "{$nation['name']}:{$me['name']}:{$comment}"; - $query = "update game set votecomment='{$admin['votecomment']}' where no=1"; + $query = "update game set votecomment='{$admin['votecomment']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -57,18 +57,18 @@ if($btn == "수정") { $vote = explode("|", $admin['vote']); $vote[0] = addslashes(SQ2DQ($title)); $admin['vote'] = implode("|", $vote); - $query = "update game set vote='{$admin['vote']}' where no='1'"; + $query = "update game set vote='{$admin['vote']}'"; 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'"; + $query = "update game set vote='{$admin['vote']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } } elseif($btn == "리셋") { - $query = "update game set voteopen=1,vote='',votecomment='' where no='1'"; + $query = "update game set voteopen=1,vote='',votecomment=''"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $query = "update general set vote='0'"; @@ -77,13 +77,13 @@ if($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"; + $query = "update game set voteopen=0"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } elseif($btn == "전체통계만") { - $query = "update game set voteopen=1 where no=1"; + $query = "update game set voteopen=1"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } elseif($btn == "전부") { - $query = "update game set voteopen=2 where no=1"; + $query = "update game set voteopen=2"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } ?> diff --git a/twe/commandlist.php b/twe/commandlist.php index 2d1adbd0..603ad82e 100644 --- a/twe/commandlist.php +++ b/twe/commandlist.php @@ -63,7 +63,7 @@ function myCommandList($connect) { $date = date('Y-m-d H:i:s'); // 명령 목록 - $query = "select year,month,turnterm from game where no='1'"; + $query = "select year,month,turnterm from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/d_ally.php b/twe/d_ally.php index b502fe0b..db7479f7 100644 --- a/twe/d_ally.php +++ b/twe/d_ally.php @@ -9,7 +9,7 @@ $connect = dbConn(); //$when = ($when + 1) * 2; -$query = "select year,month from game where no='1'"; +$query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/d_cancel.php b/twe/d_cancel.php index 883e6097..e2fb69b4 100644 --- a/twe/d_cancel.php +++ b/twe/d_cancel.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(1); $connect = dbConn(); -$query = "select year,month from game where no='1'"; +$query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/d_cease.php b/twe/d_cease.php index 9ceac63a..66e1cd60 100644 --- a/twe/d_cease.php +++ b/twe/d_cease.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(1); $connect = dbConn(); -$query = "select year,month from game where no='1'"; +$query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/d_merge.php b/twe/d_merge.php index 6539b6dd..4587b1f0 100644 --- a/twe/d_merge.php +++ b/twe/d_merge.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(1); $connect = dbConn(); -$query = "select year,month from game where no='1'"; +$query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/d_scout.php b/twe/d_scout.php index 12723618..4bb58633 100644 --- a/twe/d_scout.php +++ b/twe/d_scout.php @@ -13,7 +13,7 @@ include "func.php"; CheckLogin(1); $connect = dbConn(); -$query = "select startyear,year,month,killturn from game where no='1'"; +$query = "select startyear,year,month,killturn from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/d_surrender.php b/twe/d_surrender.php index df359f4e..fa9c80a7 100644 --- a/twe/d_surrender.php +++ b/twe/d_surrender.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(1); $connect = dbConn(); -$query = "select year,month from game where no='1'"; +$query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/func.php b/twe/func.php index 54e6a26f..c4e59536 100644 --- a/twe/func.php +++ b/twe/func.php @@ -338,7 +338,7 @@ function cityInfo($connect) { function myNationInfo($connect) { global $_basecolor, $_basecolor2, $images; - $query = "select startyear,year from game where no='1'"; + $query = "select startyear,year from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -511,7 +511,7 @@ function commandGroup($typename, $type=0) { } function commandTable($connect) { - $query = "select startyear,year,develcost,scenario from game where no='1'"; + $query = "select startyear,year,develcost,scenario from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -745,7 +745,7 @@ function commandTable($connect) { } function CoreCommandTable($connect) { - $query = "select develcost from game where no='1'"; + $query = "select develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -849,7 +849,7 @@ function myInfo($connect) { function generalInfo($connect, $no) { global $_basecolor, $_basecolor2, $image, $images; - $query = "select img from game where no='1'"; + $query = "select img from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1388,7 +1388,7 @@ function addNationHistory($nation, $history) { } function adminMsg($connect) { - $query = "select msg from game where no='1'"; + $query = "select msg from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1405,7 +1405,7 @@ function onlinegen($connect) { $generalID = getGeneralID(); $nationID = DB::db()->queryFirstField('select `nation` from `general` where `no` = %i', $generalID); if($nationID !== null || Util::toInt($nationID) === 0) { - $query = "select onlinegen from game where no='1'"; + $query = "select onlinegen from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $game = MYDB_fetch_array($result); @@ -1421,7 +1421,7 @@ function onlinegen($connect) { } function onlineNation($connect) { - $query = "select onlinenation from game where no='1'"; + $query = "select onlinenation from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $game = MYDB_fetch_array($result); return $game['onlinenation']; @@ -1619,7 +1619,7 @@ function increaseRefresh($type="", $cnt=1) { function updateTraffic() { $online = getOnlineNum(); $db = DB::db(); - $game = $db->queryFirstRow('SELECT year,month,refresh,maxonline,maxrefresh from game where no=1'); + $game = $db->queryFirstRow('SELECT year,month,refresh,maxonline,maxrefresh from game limit 1'); //최다갱신자 $user = $db->queryFirstRow('select name,refresh from general order by refresh desc limit 1'); @@ -1634,7 +1634,7 @@ function updateTraffic() { 'refresh'=>0, 'maxrefresh'=>$game['maxrefresh'], 'maxonline'=>$game['maxonline'] - ], 'no=1'); + ], true); $db->update('general', ['refresh'=>0]); @@ -1687,7 +1687,7 @@ function tryLock() { function unlock() { // 풀림 //NOTE: unlock에는 table lock이 필요없는가? - DB::db()->query("update plock set plock=0 where no=1"); + DB::db()->query("update plock set plock=0"); } function timeover() { @@ -1704,7 +1704,7 @@ function timeover() { function checkDelay($connect) { //서버정보 - $query = "select turnterm,now() as now,TIMESTAMPDIFF(MINUTE,turntime,now()) as offset from game where no='1'"; + $query = "select turnterm,now() as now,TIMESTAMPDIFF(MINUTE,turntime,now()) as offset from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); // 1턴이상 갱신 없었으면 서버 지연 @@ -1762,7 +1762,7 @@ function updateOnline($connect) { $onnationstr .= "【{$nationname[$key]}】, "; if($key == 0) { - $query = "update game set onlinegen='$onnation[0]' where no='1'"; + $query = "update game set onlinegen='$onnation[0]'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } else { $query = "update nation set onlinegen='$onnation[$key]' where nation='$key'"; @@ -1772,7 +1772,7 @@ function updateOnline($connect) { } //접속중인 국가 - $query = "update game set online='$onlinenum',onlinenation='$onnationstr' where no='1'"; + $query = "update game set online='$onlinenum',onlinenation='$onnationstr'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } @@ -1825,7 +1825,7 @@ function checkTurn($connect) { //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', CheckOverhead'); CheckOverhead(); //서버정보 - $query = "select * from game where no='1'"; + $query = "select * from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1948,7 +1948,7 @@ function checkTurn($connect) { //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', '.__LINE__); // 이시각 정각 시까지 업데이트 완료했음 - $query = "update game set turntime='$prevTurn' where no='1'"; + $query = "update game set turntime='$prevTurn'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); // 그 시각 년도,월 저장 @@ -1981,7 +1981,7 @@ function checkTurn($connect) { //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', '.__LINE__); - $query = "update game set turntime='$date' where no='1'"; + $query = "update game set turntime='$date'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); // 3턴 전 시간 @@ -2018,7 +2018,7 @@ function addAge($connect) { $query = "update general set age=age+1,belong=belong+1"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $query = "select startyear,year,month from game where no='1'"; + $query = "select startyear,year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -2057,7 +2057,7 @@ function addAge($connect) { } function turnDate($connect, $curtime) { - $query = "select startyear,starttime,turnterm,year,month from game where no='1'"; + $query = "select startyear,starttime,turnterm,year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -2072,7 +2072,7 @@ function turnDate($connect, $curtime) { // 바뀐 경우만 업데이트 if($admin['month'] != $month || $admin['year'] != $year) { - $query = "update game set year='$year',month='$month' where no='1'"; + $query = "update game set year='$year',month='$month'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } $value[0] = $year; @@ -2082,7 +2082,7 @@ function turnDate($connect, $curtime) { function triggerTournament($connect) { - $query = "select tournament,tnmt_trig from game where no='1'"; + $query = "select tournament,tnmt_trig from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -2175,7 +2175,7 @@ function PreprocessCommand($connect, $no) { function updateTurntime($connect, $no) { - $query = "select year,month,isUnited,turnterm from game where no='1'"; + $query = "select year,month,isUnited,turnterm from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -2420,7 +2420,7 @@ function uniqueItem($connect, $general, $log, $vote=0) { if($general['npc'] >= 2 || $general['betray'] > 1) { return $log; } if($general['weap'] > 6 || $general['book'] > 6 || $general['horse'] > 6 || $general['item'] > 6) { return $log; } - $query = "select year,month,scenario from game where no='1'"; + $query = "select year,month,scenario from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $game = MYDB_fetch_array($result); @@ -2617,7 +2617,7 @@ function checkExperience($connect, $general, $log) { } function getAdmin($connect) { - $query = "select * from game where no='1'"; + $query = "select * from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -2659,7 +2659,7 @@ function getNation($connect, $nation) { function deleteNation($connect, $general) { $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -2688,7 +2688,7 @@ function deleteNation($connect, $general) { } function nextRuler($connect, $general) { - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -2899,7 +2899,7 @@ function CharCritical($rate, $personal) { } function TrickInjury($connect, $city, $type=0) { - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/func_auction.php b/twe/func_auction.php index 65aed423..09001588 100644 --- a/twe/func_auction.php +++ b/twe/func_auction.php @@ -17,7 +17,7 @@ function GetStuffName($stuff) { } function registerAuction($connect) { - $query = "select startyear,year,month,turnterm from game where no=1"; + $query = "select startyear,year,month,turnterm from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -140,7 +140,7 @@ function registerAuction($connect) { function processAuction($connect) { $date = date("Y-m-d H:i:s"); - $query = "select year,month from game where no=1"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/func_command.php b/twe/func_command.php index 7bbdc2a6..b34c5cc4 100644 --- a/twe/func_command.php +++ b/twe/func_command.php @@ -453,7 +453,7 @@ function processCommand($connect, $no) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $general = MYDB_fetch_array($result); - $query = "select month,killturn from game where no='1'"; + $query = "select month,killturn from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); $log = array(); diff --git a/twe/func_converter.php b/twe/func_converter.php index ccc326f6..d95559df 100644 --- a/twe/func_converter.php +++ b/twe/func_converter.php @@ -398,7 +398,7 @@ function getBill($dedication) { function getCost($armtype) { //FIXME: 정말로 side effect가 없으려면 query는 밖으로 이동해야함. //TODO: 병종 값이 column으로 들어있는건 전혀 옳지 않음. key->value 형태로 바꿔야함 - return DB::db()->queryFirstColumn('select %b from game where no=1', sprintf('cst%d', $armtype)); + return DB::db()->queryFirstColumn('select %b from game limit 1', sprintf('cst%d', $armtype)); } function TechLimit($startyear, $year, $tech) { diff --git a/twe/func_gamerule.php b/twe/func_gamerule.php index 434356d4..800df374 100644 --- a/twe/func_gamerule.php +++ b/twe/func_gamerule.php @@ -351,7 +351,7 @@ function preUpdateMonthly($connect) { if($result == false) { return false; } - $query = "select startyear,year,month,normgeneral from game where no='1'"; + $query = "select startyear,year,month,normgeneral from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -439,7 +439,7 @@ function preUpdateMonthly($connect) { $ratio = 100; // 20 ~ 140원 $develcost = ($admin['year'] - $admin['startyear'] + 10) * 2; - $query = "update game set gold_rate='$ratio',rice_rate='$ratio',city_rate='$rate',develcost='$develcost' where no='1'"; + $query = "update game set gold_rate='$ratio',rice_rate='$ratio',city_rate='$rate',develcost='$develcost'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); //매달 사망자 수입 결산 @@ -500,7 +500,7 @@ function preUpdateMonthly($connect) { // 외교 로그처리, 외교 상태 처리 function postUpdateMonthly($connect) { - $query = "select startyear,year,month,scenario from game where no='1'"; + $query = "select startyear,year,month,scenario from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -648,7 +648,7 @@ group by A.nation function checkWander($connect) { - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -677,7 +677,7 @@ function checkWander($connect) { } function checkMerge($connect) { - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -791,7 +791,7 @@ function checkMerge($connect) { } function checkSurrender($connect) { - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -912,7 +912,7 @@ function checkSurrender($connect) { function updateNationState($connect) { $history = array(); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -989,7 +989,7 @@ function updateNationState($connect) { } function checkStatistic($connect) { - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1120,7 +1120,7 @@ function checkStatistic($connect) { } function checkEmperior($connect) { - $query = "select year,month,isUnited from game where no='1'"; + $query = "select year,month,isUnited from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1142,7 +1142,7 @@ function checkEmperior($connect) { if($count == $allcount) { addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}(이)가 전토를 통일"); - $query = "update game set isUnited=2,conlimit=conlimit*100 where no='1'"; + $query = "update game set isUnited=2,conlimit=conlimit*100"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $query = "select no from general where npc<2 and age>=45"; diff --git a/twe/func_legacy.php b/twe/func_legacy.php index 862b4e3d..4ead6ac3 100644 --- a/twe/func_legacy.php +++ b/twe/func_legacy.php @@ -125,7 +125,7 @@ function printCitysName($connect, $cityNo, $distance=1) { function info($connect, $type=0) { - $query = "select year,month,turnterm,maxgeneral from game where no='1'"; + $query = "select year,month,turnterm,maxgeneral from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/func_npc.php b/twe/func_npc.php index a45da7b3..720e6e25 100644 --- a/twe/func_npc.php +++ b/twe/func_npc.php @@ -307,7 +307,7 @@ function SetCrew($connect, $no, $personal, $gold, $leader, $genType, $tech, $reg } function processAI($connect, $no) { - $query = "select startyear,year,month,turnterm,scenario,gold_rate,rice_rate from game where no='1'"; + $query = "select startyear,year,month,turnterm,scenario,gold_rate,rice_rate from game limit 1"; $result = MYDB_query($query, $connect) or Error("processAI00 ".MYDB_error($connect),""); $admin = MYDB_fetch_array($result); // 초반 여부 @@ -1109,7 +1109,7 @@ function RegCity($nation, $name, $cap=0) { function Promotion($connect, $nation, $level) { $lv = getNationChiefLevel($level); - $query = "select scenario,killturn from game where no='1'"; + $query = "select scenario,killturn from game limit 1"; $result = MYDB_query($query, $connect) or Error("processAI00 ".MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/func_process.php b/twe/func_process.php index 2302907a..1f29cf4f 100644 --- a/twe/func_process.php +++ b/twe/func_process.php @@ -167,7 +167,7 @@ function process_1($connect, &$general, $type) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month,develcost from game where no='1'"; + $query = "select startyear,year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -263,7 +263,7 @@ function process_3($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month,develcost from game where no='1'"; + $query = "select startyear,year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -357,7 +357,7 @@ function process_4($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month,develcost from game where no='1'"; + $query = "select startyear,year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -444,7 +444,7 @@ function process_5($connect, &$general, $type) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month,develcost from game where no='1'"; + $query = "select startyear,year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -539,7 +539,7 @@ function process_7($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month,develcost from game where no='1'"; + $query = "select startyear,year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -626,7 +626,7 @@ function process_8($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month,develcost from game where no='1'"; + $query = "select startyear,year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -720,7 +720,7 @@ function process_9($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -811,7 +811,7 @@ function process_11($connect, &$general, $type) { if($type == 1) { $defaultatmos = $_defaultatmos; $defaulttrain = $_defaulttrain; } else { $defaultatmos = $_defaultatmos2; $defaulttrain = $_defaulttrain2; } - $query = "select year,month,startyear from game where no='1'"; + $query = "select year,month,startyear from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -991,7 +991,7 @@ function process_13($connect, &$general) { global $_maxtrain, $_training, $_atmosing; $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1057,7 +1057,7 @@ function process_14($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1116,7 +1116,7 @@ function process_15($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1185,7 +1185,7 @@ function process_16($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month from game where no='1'"; + $query = "select startyear,year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1272,7 +1272,7 @@ function process_17($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1309,7 +1309,7 @@ function process_21($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1375,7 +1375,7 @@ function process_26($connect, &$general) { $troop = getTroop($connect, $general['troop']); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1437,7 +1437,7 @@ function process_28($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1497,7 +1497,7 @@ function process_30($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1560,7 +1560,7 @@ function process_31($connect, &$general) { $date = substr($general['turntime'],11,5); $msg = []; - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1683,7 +1683,7 @@ function process_41($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1748,7 +1748,7 @@ function process_42($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1965,7 +1965,7 @@ function process_43($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -2051,7 +2051,7 @@ function process_44($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -2138,7 +2138,7 @@ function process_48($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -2244,7 +2244,7 @@ function process_49($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -2376,7 +2376,7 @@ function process_50($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select month from game where no='1'"; + $query = "select month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -2399,7 +2399,7 @@ function process_99($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/func_process_chief.php b/twe/func_process_chief.php index 88262a23..fe6e91c4 100644 --- a/twe/func_process_chief.php +++ b/twe/func_process_chief.php @@ -6,7 +6,7 @@ function process_23($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -102,7 +102,7 @@ function process_24($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month,scenario,startyear from game where no='1'"; + $query = "select year,month,scenario,startyear from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -217,7 +217,7 @@ function process_27($connect, &$general) { $who = $command[2]; $where = $command[1]; - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -280,7 +280,7 @@ function process_51($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -345,7 +345,7 @@ function process_52($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -452,7 +452,7 @@ function process_53($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -517,7 +517,7 @@ function process_61($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost,turnterm from game where no='1'"; + $query = "select year,month,develcost,turnterm from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -597,7 +597,7 @@ function process_62($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month from game where no='1'"; + $query = "select startyear,year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -691,7 +691,7 @@ function process_63($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -755,7 +755,7 @@ function process_64($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -819,7 +819,7 @@ function process_65($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -910,7 +910,7 @@ function process_66($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -996,7 +996,7 @@ function process_67($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1083,7 +1083,7 @@ function process_68($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1182,7 +1182,7 @@ function process_71($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1283,7 +1283,7 @@ function process_72($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1393,7 +1393,7 @@ function process_73($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1519,7 +1519,7 @@ function process_74($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1657,7 +1657,7 @@ function process_75($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1778,7 +1778,7 @@ function process_76($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month,develcost,npccount,turnterm from game where no='1'"; + $query = "select startyear,year,month,develcost,npccount,turnterm from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1957,7 +1957,7 @@ function process_76($connect, &$general) { $npcid++; } //npccount - $query = "update game set npccount={$npcid} where no='1'"; + $query = "update game set npccount={$npcid}"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); //국가 기술력 그대로 @@ -1992,7 +1992,7 @@ function process_77($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -2115,7 +2115,7 @@ function process_78($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -2234,7 +2234,7 @@ function process_81($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/func_process_personnel.php b/twe/func_process_personnel.php index ba7b149c..e018df27 100644 --- a/twe/func_process_personnel.php +++ b/twe/func_process_personnel.php @@ -6,7 +6,7 @@ function process_22($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month,develcost from game where no='1'"; + $query = "select startyear,year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -64,7 +64,7 @@ function process_25($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month from game where no='1'"; + $query = "select startyear,year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -177,7 +177,7 @@ function process_29($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month,develcost,npccount,turnterm,scenario from game where no='1'"; + $query = "select startyear,year,month,develcost,npccount,turnterm,scenario from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -387,7 +387,7 @@ function process_29($connect, &$general) { $npcid++; //npccount - $query = "update game set npccount={$npcid} where no='1'"; + $query = "update game set npccount={$npcid}"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); //국가 기술력 그대로 @@ -431,7 +431,7 @@ function process_45($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month from game where no='1'"; + $query = "select startyear,year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -544,7 +544,7 @@ function process_46($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month from game where no='1'"; + $query = "select startyear,year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -628,7 +628,7 @@ function process_47($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month from game where no='1'"; + $query = "select startyear,year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -689,7 +689,7 @@ function process_54($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -752,7 +752,7 @@ function process_55($connect, &$general) { $date = substr($general['turntime'],11,5); - $query = "select startyear,year,month from game where no='1'"; + $query = "select startyear,year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -836,7 +836,7 @@ function process_56($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -885,7 +885,7 @@ function process_57($connect, &$general) { $alllog = array(); $date = substr($general['turntime'],11,5); - $query = "select year,month,killturn from game where no='1'"; + $query = "select year,month,killturn from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/func_process_trick.php b/twe/func_process_trick.php index 2ec981e8..578254a4 100644 --- a/twe/func_process_trick.php +++ b/twe/func_process_trick.php @@ -7,7 +7,7 @@ function process_32($connect, &$general) { global $_firing, $_basefiring, $_firingpower; $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -129,7 +129,7 @@ function process_33($connect, &$general) { //탈취는 0까지 무제한 $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -276,7 +276,7 @@ function process_34($connect, &$general) { global $_firing, $_basefiring, $_firingpower; $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -398,7 +398,7 @@ function process_35($connect, &$general) { global $_firing, $_basefiring, $_firingpower; $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -523,7 +523,7 @@ function process_36($connect, &$general) { global $_firing, $_basefiring, $_firingpower; $date = substr($general['turntime'],11,5); - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/func_regnpc.php b/twe/func_regnpc.php index e17611cb..5f23d644 100644 --- a/twe/func_regnpc.php +++ b/twe/func_regnpc.php @@ -3,7 +3,7 @@ namespace sammo; function RegNPC($connect) { - $query = "select startyear,year,turnterm,scenario,extend,fiction,img from game where no='1'"; + $query = "select startyear,year,turnterm,scenario,extend,fiction,img from game limit 1"; $result = MYDB_query($query, $connect) or Error("scenario_194A ".MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/func_template.php b/twe/func_template.php index 6afc7c9a..71a24e32 100644 --- a/twe/func_template.php +++ b/twe/func_template.php @@ -68,7 +68,7 @@ function CoreTurnTable() { function allButton() { global $_basecolor2; - $npcmode = DB::db()->queryFirstField("select npcmode from game where no='1'"); + $npcmode = DB::db()->queryFirstField("select npcmode from game limit 1"); if($npcmode == 1) { $site = "a_npcList.php"; $call = "빙의일람"; diff --git a/twe/func_time_event.php b/twe/func_time_event.php index 4bb96796..2118ab16 100644 --- a/twe/func_time_event.php +++ b/twe/func_time_event.php @@ -32,7 +32,7 @@ function processSpring($connect) { $query = "update nation set gold=gold*0.99 where gold>1000 and gold<=10000"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -41,7 +41,7 @@ function processSpring($connect) { } function processGoldIncome($connect) { - $query = "select year,month,gold_rate from game where no='1'"; + $query = "select year,month,gold_rate from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -332,7 +332,7 @@ function processFall($connect) { } function processRiceIncome($connect) { - $query = "select year,month,rice_rate from game where no='1'"; + $query = "select year,month,rice_rate from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -513,7 +513,7 @@ function tradeRate($connect) { } function disaster($connect) { - $query = "select startyear,year,month from game where no='1'"; + $query = "select startyear,year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/func_tournament.php b/twe/func_tournament.php index a55220b7..7e34f612 100644 --- a/twe/func_tournament.php +++ b/twe/func_tournament.php @@ -3,7 +3,7 @@ namespace sammo; function processTournament($connect) { - $query = "select tournament,phase,tnmt_type,tnmt_auto,tnmt_time,now() as now,TIMESTAMPDIFF(SECOND,tnmt_time,now()) as offset from game where no=1"; + $query = "select tournament,phase,tnmt_type,tnmt_auto,tnmt_time,now() as now,TIMESTAMPDIFF(SECOND,tnmt_time,now()) as offset from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -80,7 +80,7 @@ function processTournament($connect) { if($betTerm > 3600) { $betTerm = 3600; } //처리 초 더한 날짜 $dt = date("Y-m-d H:i:s", strtotime($admin['tnmt_time']) + $unit * $i + $betTerm); - $query = "update game set tournament='$tnmt',phase='$phase',tnmt_time='$dt' where no=1"; + $query = "update game set tournament='$tnmt',phase='$phase',tnmt_time='$dt'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); return; } @@ -92,7 +92,7 @@ function processTournament($connect) { //지정시간대 넘어가면 중단 20~24시 if($hr < 20) { $dt = substr($dt, 0, 11)."20:00:00"; - $query = "update game set tournament='$tnmt',phase='$phase',tnmt_time='$dt' where no=1"; + $query = "update game set tournament='$tnmt',phase='$phase',tnmt_time='$dt'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); return; } @@ -100,13 +100,13 @@ function processTournament($connect) { } $second = $unit * $iter; - $query = "update game set tournament='$tnmt',phase='$phase',tnmt_time=DATE_ADD(tnmt_time, INTERVAL {$second} SECOND) where no=1"; + $query = "update game set tournament='$tnmt',phase='$phase',tnmt_time=DATE_ADD(tnmt_time, INTERVAL {$second} SECOND)"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } } function getTournamentTerm($connect) { - $query = "select tnmt_auto from game where no=1"; + $query = "select tnmt_auto from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -123,7 +123,7 @@ function getTournamentTerm($connect) { } function getTournamentTime($connect) { - $query = "select tournament,tnmt_time from game where no=1"; + $query = "select tournament,tnmt_time from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -259,7 +259,7 @@ function startTournament($connect, $auto, $type) { default:$unit = 60; break; } - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -280,7 +280,7 @@ function startTournament($connect, $auto, $type) { } function fillLowGenAll($connect) { - $query = "select develcost from game where no='1'"; + $query = "select develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -541,7 +541,7 @@ function finalFight($connect, $tnmt_type, $tnmt, $phase, $type) { } function setGift($connect, $tnmt_type, $tnmt, $phase) { - $query = "select year,month,develcost from game where no='1'"; + $query = "select year,month,develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -665,7 +665,7 @@ function setGift($connect, $tnmt_type, $tnmt, $phase) { $general = MYDB_fetch_array($result); $no = ($general['grp'] - 20) * 2 + $general['grp_no']; - $query = "select bet{$no},bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from game where no=1"; + $query = "select bet{$no},bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); $bet = @round($admin['bet'] / $admin["bet{$no}"], 2); @@ -687,7 +687,7 @@ function setGift($connect, $tnmt_type, $tnmt, $phase) { } function setRefund($connect) { - $query = "select develcost from game where no='1'"; + $query = "select develcost from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/index.php b/twe/index.php index 5d6fdf6f..80fcf219 100644 --- a/twe/index.php +++ b/twe/index.php @@ -43,11 +43,11 @@ if($me['newmsg'] == 1 && $me['newvote'] == 1) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -$query = "select develcost,online,conlimit,tournament,tnmt_type,turnterm,scenario,scenario_text,extend,fiction,npcmode,vote from game where no=1"; +$query = "select develcost,online,conlimit,tournament,tnmt_type,turnterm,scenario,scenario_text,extend,fiction,npcmode,vote from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select plock from plock where no=1"; +$query = "select plock from plock limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $plock = MYDB_fetch_array($result); diff --git a/twe/j_msgsubmit.php b/twe/j_msgsubmit.php index e9e5dd3c..2f8c6e62 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'); +$conlimit = $db->queryFirstField('select conlimit from game limit 1'); $me = $db->queryFirstRow('select `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr` from `general` where `owner` = %i', Session::getUserID()); diff --git a/twe/join.php b/twe/join.php index 806b417c..87fcb57d 100644 --- a/twe/join.php +++ b/twe/join.php @@ -183,7 +183,7 @@ window.abilityPowint = abilityPowint; queryFirstRow("select year,month,scenario,maxgeneral,turnterm,genius,img from game where no='1'"); +$admin = $db->queryFirstRow("select year,month,scenario,maxgeneral,turnterm,genius,img from game limit 1"); $gencount = $db->queryFirstField("select count(no) from general where npc<2"); $id_num = $db->queryFirstField("select count(no) from general where owner= %i", $userID); $name_num = $db->queryFirstField("select count(no) from general where name= %s", $name); @@ -120,7 +120,7 @@ if($id_num) { if($ratio == 50 && $admin['genius'] > 0) { $genius = 1; - $db->query("update game set genius=genius-1 where no='1'"); + $db->query("update game set genius=genius-1"); } else { $genius = 0; } diff --git a/twe/preprocessing.php b/twe/preprocessing.php index f7f15eb2..f0b9af5c 100644 --- a/twe/preprocessing.php +++ b/twe/preprocessing.php @@ -8,7 +8,7 @@ CheckLogin(1); $connect = dbConn(); increaseRefresh("턴입력", 1); -$query = "select conlimit from game where no=1"; +$query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/process_war.php b/twe/process_war.php index 45fa7518..6702fbd2 100644 --- a/twe/process_war.php +++ b/twe/process_war.php @@ -9,7 +9,7 @@ function processWar($connect, $general, $city) { global $_maximumatmos, $_maximumtrain, $_dexLimit; $date = substr($general['turntime'],11,5); - $query = "select * from game where no='1'"; + $query = "select * from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $game = MYDB_fetch_array($result); @@ -1588,7 +1588,7 @@ function getRate($game, $type, $dtype) { } function addConflict($connect, $city, $nationnum, $mykillnum) { - $query = "select year,month from game where no='1'"; + $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error("addConflict ".MYDB_error($connect),""); $game = MYDB_fetch_array($result); diff --git a/twe/processing.php b/twe/processing.php index 2099235e..e132dea9 100644 --- a/twe/processing.php +++ b/twe/processing.php @@ -232,7 +232,7 @@ function GetExplain() { function command_11($connect, $turn, $command) { global $_basecolor, $_basecolor2, $images, $image; starter("징병"); - $query = "select * from game where no='1'"; + $query = "select * from game limit 1"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -437,7 +437,7 @@ function calc(cost, formnum) { function command_12($connect, $turn, $command) { global $_basecolor, $_basecolor2, $images, $image; starter("모병"); - $query = "select * from game where no='1'"; + $query = "select * from game limit 1"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -967,7 +967,7 @@ function command_25($connect, $turn, $command) { starter("임관"); - $query = "select startyear,year from game where no='1'"; + $query = "select startyear,year from game limit 1"; $result = MYDB_query($query, $connect) or Error("command_46 ".MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -1493,7 +1493,7 @@ function command_44($connect, $turn, $command) { function command_46($connect, $turn, $command) { starter("건국"); - $query = "select maxnation from game where no='1'"; + $query = "select maxnation from game limit 1"; $result = MYDB_query($query, $connect) or Error("command_46 ".MYDB_error($connect),""); $admin = MYDB_fetch_array($result); diff --git a/twe/select_npc.php b/twe/select_npc.php index 2ddc03fa..3869b7c2 100644 --- a/twe/select_npc.php +++ b/twe/select_npc.php @@ -36,7 +36,7 @@ $connect = dbConn();