diff --git a/hwe/b_myPage.php b/hwe/b_myPage.php index a2109d55..cc9f2bd6 100644 --- a/hwe/b_myPage.php +++ b/hwe/b_myPage.php @@ -12,28 +12,32 @@ $connect=$db->get(); increaseRefresh("내정보", 1); $query = "select myset from general where owner='{$session->userID}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $me = MYDB_fetch_array($result); -if($me['myset'] > 0) { +if ($me['myset'] > 0) { $submit = 'submit'; } else { $submit = 'hidden'; } -if($btn == "설정저장" && $me['myset'] > 0) { - if($me['myset'] > 1) { +if ($btn == "설정저장" && $me['myset'] > 0) { + if ($me['myset'] > 1) { $submit = 'submit'; } else { $submit = 'hidden'; } - $query = "update general set myset=myset-1,map='$map',mode='$mode',tnmt='$tnmt' where owner='{$session->userID}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('general', [ + 'myset'=>$db->sqleval('myset-1'), + 'map'=>$map, + 'mode'=>$mode, + 'tnmt'=>$tnmt + ], 'owner=%i', $session->userID); } $query = "select no,map,mode,tnmt,myset from general where owner='{$session->userID}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $me = MYDB_fetch_array($result); ?> diff --git a/hwe/c_auction.php b/hwe/c_auction.php index 8a849f80..b843c323 100644 --- a/hwe/c_auction.php +++ b/hwe/c_auction.php @@ -12,19 +12,19 @@ $connect=$db->get(); increaseRefresh("입찰", 1); $query = "select turnterm from game limit 1"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $admin = MYDB_fetch_array($result); $query = "select no,name,gold,rice,special from general where owner='{$session->userID}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $me = MYDB_fetch_array($result); $query = "select no from auction where no1='{$me['no']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $tradeCount = MYDB_num_rows($result); $query = "select no from auction where no2='{$me['no']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $bidCount = MYDB_num_rows($result); $btCount = $tradeCount + $bidCount; @@ -35,10 +35,12 @@ $amount = round($amount / 10) * 10; $cost = round($cost / 10) * 10; $topv = round($topv / 10) * 10; $value = round($value / 10) * 10; -if($term > 24) $term = 24; +if ($term > 24) { + $term = 24; +} $valid = 1; -if($session->userGrade >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) { +if ($session->userGrade >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) { } else { $msg = "ㆍ더이상 등록할 수 없습니다."; $msg2 = "ㆍ더이상 등록할 수 없습니다."; @@ -46,42 +48,145 @@ if($session->userGrade >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['s $btn = "hidden"; } -if($btn == "판매") { - if($stuff != 0) { +if ($btn == "판매") { + if ($stuff != 0) { $msg = "ㆍ현재 쌀만 거래 가능합니다."; $valid = 0; } - if($term < 0 || $term > 24) { + if ($term < 0 || $term > 24) { $msg = "ㆍ종료기한은 1 ~ 24 턴 이어야 합니다."; $valid = 0; } - if($amount < 100 || $amount > 10000) { + if ($amount < 100 || $amount > 10000) { $msg = "ㆍ거래량은 100 ~ 10000 이어야 합니다."; $valid = 0; } - if($cost > $amount * 2 || $cost * 2 < $amount) { + if ($cost > $amount * 2 || $cost * 2 < $amount) { $msg = "ㆍ시작판매가는 50% ~ 200% 이어야 합니다."; $valid = 0; } - if($topv < $amount*1.1 || $topv > $amount * 2) { + if ($topv < $amount*1.1 || $topv > $amount * 2) { $msg = "ㆍ즉시판매가는 110% ~ 200% 이어야 합니다."; $valid = 0; } - if($topv < $cost*1.1) { + if ($topv < $cost*1.1) { $msg = "ㆍ즉시판매가는 시작판매가의 110% 이상이어야 합니다."; $valid = 0; } - if($amount > $me['rice'] - 1000) { + if ($amount > $me['rice'] - 1000) { $msg = "ㆍ기본 군량 1000은 거래할 수 없습니다."; $valid = 0; } - if($valid == 1) { + if ($valid == 1) { $msg = "ㆍ등록 성공."; $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit * $term); $db->insert('auction', [ - 'type'=>0, - 'no1'=>$me['no'], - 'name1'=>$me['name'], + 'type'=>0, + 'no1'=>$me['no'], + 'name1'=>$me['name'], + 'stuff'=>$stuff, + 'amount'=>$amount, + 'cost'=>$cost, + 'value'=>$cost, + 'topv'=>$topv, + 'expire'=>$date + ]); + } +} elseif ($btn == "구매시도") { + $query = "select no2,value,topv,expire,amount from auction where no='$sel'"; + $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); + $auction = MYDB_fetch_array($result); + + if ($value == $auction['topv']) { + $valid = 2; + } + if (!$auction) { + $msg = "ㆍ종료된 거래입니다."; + $valid = 0; + } + /* + if($stuff != 0) { + $msg = "ㆍ현재 쌀만 거래 가능합니다."; + $valid = 0; + } + */ + if ($auction['no2'] > 0 && $value <= $auction['value']) { + $msg = "ㆍ현재판매가보다 높게 입찰해야 합니다."; + $valid = 0; + } + if ($value < $auction['value']) { + $msg = "ㆍ현재판매가보다 높게 입찰해야 합니다."; + $valid = 0; + } + if ($value > $auction['topv']) { + $msg = "ㆍ즉시판매가보다 높을 수 없습니다."; + $valid = 0; + } + if ($value > $me['gold'] - 1000) { + $msg = "ㆍ기본 자금 1000은 거래할 수 없습니다."; + $valid = 0; + } + if ($valid == 1) { + $msg = "ㆍ입찰 성공. 거래완료는 빨라도 현재로부터 1턴 뒤입니다."; + $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit); + if ($auction['expire'] > $date) { + $date = $auction['expire']; + } + + $db->update('auction', [ + 'value'=>$value, + 'no2'=>$me['no'], + 'name2'=>$me['name'], + 'expire'=>$date, + ], 'no=%i', $sel); + } elseif ($valid == 2) { + $msg = "ㆍ즉시판매 성공. 거래완료는 빨라도 현재로부터 1턴 뒤입니다."; + $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit); + + $db->update('auction', [ + 'value'=>$value, + 'no2'=>$me['no'], + 'name2'=>$me['name'], + 'expire'=>$date, + ], 'no=%i', $sel); + } +} elseif ($btn == "구매") { + if ($stuff != 0) { + $msg2 = "ㆍ현재 쌀만 거래 가능합니다."; + $valid = 0; + } + if ($term < 0 || $term > 24) { + $msg2 = "ㆍ종료기한은 1 ~ 24 턴 이어야 합니다."; + $valid = 0; + } + if ($amount < 100 || $amount > 10000) { + $msg2 = "ㆍ거래량은 100 ~ 10000 이어야 합니다."; + $valid = 0; + } + if ($cost > $amount * 2 || $cost * 2 < $amount) { + $msg2 = "ㆍ시작구매가는 50% ~ 200% 이어야 합니다."; + $valid = 0; + } + if ($topv < $amount * 0.5 || $topv > $amount * 0.9) { + $msg2 = "ㆍ즉시구매가는 50% ~ 90% 이어야 합니다."; + $valid = 0; + } + if ($topv > $cost * 0.9) { + $msg2 = "ㆍ즉시구매가는 시작구매가의 90% 이하이어야 합니다."; + $valid = 0; + } + if ($cost > $me['gold'] - 1000) { + $msg2 = "ㆍ기본 자금 1000은 거래할 수 없습니다."; + $valid = 0; + } + if ($valid == 1) { + $msg2 = "ㆍ등록 성공."; + $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit * $term); + + $db->insert('auction', [ + 'type'=>1, + 'no1'=>$me['no'], + 'name1'=>$me['name'], 'stuff'=>$stuff, 'amount'=>$amount, 'cost'=>$cost, @@ -90,132 +195,62 @@ if($btn == "판매") { 'expire'=>$date ]); } -} elseif($btn == "구매시도") { +} elseif ($btn == "판매시도") { $query = "select no2,value,topv,expire,amount from auction where no='$sel'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $auction = MYDB_fetch_array($result); - if($value == $auction['topv']) { + if ($value == $auction['topv']) { $valid = 2; } - if(!$auction) { - $msg = "ㆍ종료된 거래입니다."; - $valid = 0; - } -/* - if($stuff != 0) { - $msg = "ㆍ현재 쌀만 거래 가능합니다."; - $valid = 0; - } -*/ - if($auction['no2'] > 0 && $value <= $auction['value']) { - $msg = "ㆍ현재판매가보다 높게 입찰해야 합니다."; - $valid = 0; - } - if($value < $auction['value']) { - $msg = "ㆍ현재판매가보다 높게 입찰해야 합니다."; - $valid = 0; - } - if($value > $auction['topv']) { - $msg = "ㆍ즉시판매가보다 높을 수 없습니다."; - $valid = 0; - } - if($value > $me['gold'] - 1000) { - $msg = "ㆍ기본 자금 1000은 거래할 수 없습니다."; - $valid = 0; - } - if($valid == 1) { - $msg = "ㆍ입찰 성공. 거래완료는 빨라도 현재로부터 1턴 뒤입니다."; - $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit); - if($auction['expire'] > $date) $date = $auction['expire']; - $query = "update auction set value='$value',no2='{$me['no']}',name2='{$me['name']}',expire='$date' where no='$sel'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } elseif($valid == 2) { - $msg = "ㆍ즉시판매 성공. 거래완료는 빨라도 현재로부터 1턴 뒤입니다."; - $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit); - $query = "update auction set value='$value',no2='{$me['no']}',name2='{$me['name']}',expire='$date' where no='$sel'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } -} elseif($btn == "구매") { - if($stuff != 0) { - $msg2 = "ㆍ현재 쌀만 거래 가능합니다."; - $valid = 0; - } - if($term < 0 || $term > 24) { - $msg2 = "ㆍ종료기한은 1 ~ 24 턴 이어야 합니다."; - $valid = 0; - } - if($amount < 100 || $amount > 10000) { - $msg2 = "ㆍ거래량은 100 ~ 10000 이어야 합니다."; - $valid = 0; - } - if($cost > $amount * 2 || $cost * 2 < $amount) { - $msg2 = "ㆍ시작구매가는 50% ~ 200% 이어야 합니다."; - $valid = 0; - } - if($topv < $amount * 0.5 || $topv > $amount * 0.9) { - $msg2 = "ㆍ즉시구매가는 50% ~ 90% 이어야 합니다."; - $valid = 0; - } - if($topv > $cost * 0.9) { - $msg2 = "ㆍ즉시구매가는 시작구매가의 90% 이하이어야 합니다."; - $valid = 0; - } - if($cost > $me['gold'] - 1000) { - $msg2 = "ㆍ기본 자금 1000은 거래할 수 없습니다."; - $valid = 0; - } - if($valid == 1) { - $msg2 = "ㆍ등록 성공."; - $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit * $term); - $query = "insert into auction (type, no1, name1, stuff, amount, cost, value, topv, expire) values (1, '{$me['no']}', '{$me['name']}', '$stuff', '$amount', '$cost', '$cost', '$topv', '$date')"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } -} elseif($btn == "판매시도") { - $query = "select no2,value,topv,expire,amount from auction where no='$sel'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $auction = MYDB_fetch_array($result); - - if($value == $auction['topv']) { - $valid = 2; - } - if(!$auction) { + if (!$auction) { $msg2 = "ㆍ종료된 거래입니다."; $valid = 0; } - if($stuff != 0) { + if ($stuff != 0) { $msg2 = "ㆍ현재 쌀만 거래 가능합니다."; $valid = 0; } - if($auction['no2'] > 0 && $value >= $auction['value']) { + if ($auction['no2'] > 0 && $value >= $auction['value']) { $msg2 = "ㆍ현재구매가보다 낮게 입찰해야 합니다."; $valid = 0; } - if($value > $auction['value']) { + if ($value > $auction['value']) { $msg2 = "ㆍ현재구매가보다 낮게 입찰해야 합니다."; $valid = 0; } - if($value < $auction['topv']) { + if ($value < $auction['topv']) { $msg2 = "ㆍ즉시구매가보다 낮을 수 없습니다."; $valid = 0; } - if($value > $me['rice'] - 1000) { + if ($value > $me['rice'] - 1000) { $msg2 = "ㆍ기본 군량 1000은 거래할 수 없습니다."; $valid = 0; } - if($valid == 1) { + if ($valid == 1) { $msg2 = "ㆍ입찰 성공. 거래완료는 빨라도 현재로부터 1턴 뒤입니다."; $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit); - if($auction['expire'] > $date) $date = $auction['expire']; - $query = "update auction set value='$value',no2='{$me['no']}',name2='{$me['name']}',expire='$date' where no='$sel'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } elseif($valid == 2) { + if ($auction['expire'] > $date) { + $date = $auction['expire']; + } + + $db->update('auction', [ + 'value'=>$value, + 'no2'=>$me['no'], + 'name2'=>$me['name'], + 'expire'=>$date, + ], 'no=%i', $sel); + } elseif ($valid == 2) { $msg2 = "ㆍ즉시구매 성공. 거래완료는 빨라도 현재로부터 1턴 뒤입니다."; $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit); - $query = "update auction set value='$value',no2='{$me['no']}',name2='{$me['name']}',expire='$date' where no='$sel'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + + $db->update('auction', [ + 'value'=>$value, + 'no2'=>$me['no'], + 'name2'=>$me['name'], + 'expire'=>$date, + ], 'no=%i', $sel); } } Submit("b_auction.php", $msg, $msg2); - diff --git a/hwe/c_betting.php b/hwe/c_betting.php index cd3eae40..8af40dc0 100644 --- a/hwe/c_betting.php +++ b/hwe/c_betting.php @@ -31,7 +31,7 @@ $me = MYDB_fetch_array($result); for($i=0; $i < 16; $i++) { if(${"btn{$i}"} == "베팅!") { - $gold = ${"gold{$i}"}; + $gold = Util::toInt(${"gold{$i}"}); $mebet = $me["bet{$i}"]; if($gold >= 10 && $gold <= 1000) { if($gold + 500 <= $me['gold'] && $gold + $mebet <= 1000 && $gold + $me['bet'] <= 1000) { diff --git a/hwe/c_chiefboard.php b/hwe/c_chiefboard.php index ca573f57..7cc1598b 100644 --- a/hwe/c_chiefboard.php +++ b/hwe/c_chiefboard.php @@ -3,6 +3,10 @@ namespace sammo; include "lib.php"; include "func.php"; + +$title = Util::array_get($_POST['title']); +$msg = Util::array_get($_POST['msg']); +$num = Util::toInt(Util::array_get($_POST['num'])); // $title, $msg, $num //로그인 검사 diff --git a/hwe/c_dipcenter.php b/hwe/c_dipcenter.php index c2f25fde..b0eac691 100644 --- a/hwe/c_dipcenter.php +++ b/hwe/c_dipcenter.php @@ -33,16 +33,19 @@ if($btn == "국가방침") { $query = "update nation set scoutmsg='$scoutmsg' where nation='{$me['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } elseif($btn == "세율") { + $rate = (int)$rate; if($rate < 5) { $rate = 5; } if($rate > 30) { $rate = 30; } $query = "update nation set rate='$rate' where nation='{$me['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } elseif($btn == "지급율") { + $bill = (int)$bill; if($bill < 20) { $bill = 20; } if($bill > 200) { $bill = 200; } $query = "update nation set bill='$bill' where nation='{$me['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } elseif($btn == "기밀권한") { + $secretlimit = (int)$secretlimit; if($secretlimit < 1) { $secretlimit = 1; } if($secretlimit > 99) { $secretlimit = 99; } $query = "update nation set secretlimit='$secretlimit' where nation='{$me['nation']}'"; diff --git a/hwe/c_double.php b/hwe/c_double.php index 183b473a..4b026e67 100644 --- a/hwe/c_double.php +++ b/hwe/c_double.php @@ -34,18 +34,17 @@ if($command == 46) { if($name == "") { $name = "무명"; } $name = StringUtil::SubStrForWidth($name, 0, 12); - $query = "update general set makenation='{$name}' where owner='{$session->userID}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('general', [ + 'makenation'=>$name + ], 'owner=%i', $session->userID); $count = sizeof($turn); - $str = "con=con"; - for($i=0; $i < $count; $i++) { - $str .= ",turn{$turn[$i]}='{$comStr}'"; + $query = ['con'=>$db->eval('con')]; + foreach($turn as $turnIdx){ + $query['turn'.$turnIdx] = $comStr; } - $query = "update general set {$str} where owner='{$session->userID}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - //echo ""; - echo 'index.php';//TODO:debug all and replace + $db->upate('general', $query, 'owner=%i', $session->userID); + header('Location:index.php'); //통합제의 } elseif($command == 53) { $query = "select nation,level from general where owner='{$session->userID}'"; diff --git a/hwe/c_myBossInfo.php b/hwe/c_myBossInfo.php index 36d23191..eabdbab6 100644 --- a/hwe/c_myBossInfo.php +++ b/hwe/c_myBossInfo.php @@ -5,6 +5,11 @@ include "lib.php"; include "func.php"; // $btn, $level, $genlist, $outlist +$btn = Util::array_get($_POST['btn']); +$level = Util::toInt(Util::array_get($_POST['level'])); +$genlist = Util::toInt(Util::array_get($_POST['genlist'])); +$outlist = Util::toInt(Util::array_get($_POST['outlist'])); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); @@ -24,6 +29,13 @@ $query = "select no from general where nation='{$me['nation']}' and level=12"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $ruler = MYDB_fetch_array($result); +//수뇌가 아니면 아무것도 할 수 없음 +if($meLevel < 5){ + echo 'b_myBossInfo.php';//TODO:debug all and replace + exit(); +} + + if($btn == "임명") { $query = "select no,nation,level,leader,power,intel from general where no='$genlist'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -48,6 +60,12 @@ if($btn == "임명") { } } +//나와 대상 장수는 국가가 같아야 함 +if($me['nation'] != $general['nation']){ + echo 'b_myBossInfo.php';//TODO:debug all and replace + exit(); +} + if($btn == "추방") { $query = "select name,l{$meLevel}set,chemi from nation where nation='{$me['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -220,10 +238,16 @@ if($btn == "추방") { case 2: $lv = 3; break; } - $query = "select gen{$lv} from city where city='$citylist'"; + $query = "select gen{$lv} from city where nation='{$me['nation']}' and city='$citylist'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $city = MYDB_fetch_array($result); + if(!$city){ + //echo ""; + echo 'b_myBossInfo.php';//TODO:debug all and replace + die(); + } $oldlist = $city["gen{$lv}"]; + if($oldlist != 0) { //기존 장수 일반으로 $query = "update general set level=1 where no='$oldlist'"; @@ -239,6 +263,7 @@ if($btn == "추방") { case 3: if($general['intel'] >= GameConst::$goodgenintel) { $valid = 1; } break; default: $valid = 1; break; } + if($valid == 1) { // 신임 장수의 원래 자리 해제 $query = "update city set gen1=0 where gen1='$genlist'"; diff --git a/hwe/c_nationboard.php b/hwe/c_nationboard.php index 8abd231d..70ca196a 100644 --- a/hwe/c_nationboard.php +++ b/hwe/c_nationboard.php @@ -4,6 +4,9 @@ namespace sammo; include "lib.php"; include "func.php"; // $title, $msg, $num +$title = Util::array_get($_POST['title']); +$msg = Util::array_get($_POST['msg']); +$num = Util::toInt(Util::array_get($_POST['num'])); //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); diff --git a/hwe/c_tournament.php b/hwe/c_tournament.php index 0c545e67..11fa0eb0 100644 --- a/hwe/c_tournament.php +++ b/hwe/c_tournament.php @@ -5,6 +5,9 @@ include "lib.php"; include "func.php"; // $btn, $msg +$gen = Util::toInt(Util::array_get($_POST['gen'])); +$sel = Util::toInt(Util::array_get($_POST['sel'])); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); @@ -29,13 +32,15 @@ case 3: $tp = "intel"; $tp2 = "설전"; $tp3 = "intel"; break; if($me['tournament'] == 1 && $session->userGrade < 5) { echo ""; exit(); } if($btn == "자동개최설정" && $session->userGrade >= 5) { - $query = "update game set tnmt_trig={$trig}"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('game', ['tnmt_trig'=>$trig], true); } elseif($btn == "개최" && $session->userGrade >= 5) { startTournament($auto, $type); } elseif($btn == "중단" && $session->userGrade >= 5) { - $query = "update game set tnmt_auto=0, tournament=0, phase=0"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('game', [ + 'tnmt_auto'=>0, + 'tournament'=>0, + 'phase'=>0 + ], true); } elseif((($btn == "투입" || $btn == "무명투입" || $btn == "쪼렙투입" || $btn == "일반투입" || $btn == "굇수투입" || $btn == "랜덤투입") && $session->userGrade >= 5) || $btn == "참가") { if($btn == "투입") { $query = "select no,name,npc,leader,power,intel,explevel,gold,horse,weap,book from general where no='$gen'"; diff --git a/hwe/c_vote.php b/hwe/c_vote.php index f5e88037..48031658 100644 --- a/hwe/c_vote.php +++ b/hwe/c_vote.php @@ -3,6 +3,9 @@ namespace sammo; include "lib.php"; include "func.php"; + +$sel = Util::toInt(Util::array_get($_POST['sel'])); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); diff --git a/hwe/d_ally.php b/hwe/d_ally.php index 94359184..bcc92f80 100644 --- a/hwe/d_ally.php +++ b/hwe/d_ally.php @@ -6,6 +6,8 @@ include "func.php"; //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); +//FIXME: 망했음. CriticalFailure. 재 구현. + $db = DB::db(); $connect=$db->get(); diff --git a/hwe/d_cancel.php b/hwe/d_cancel.php index a6e32471..49c9cc40 100644 --- a/hwe/d_cancel.php +++ b/hwe/d_cancel.php @@ -6,6 +6,8 @@ include "func.php"; //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); +//FIXME: 망했음. CriticalFailure. 재 구현. + $db = DB::db(); $connect=$db->get(); diff --git a/hwe/d_cease.php b/hwe/d_cease.php index a5b93183..22a7c540 100644 --- a/hwe/d_cease.php +++ b/hwe/d_cease.php @@ -6,6 +6,8 @@ include "func.php"; //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); +//FIXME: 망했음. CriticalFailure. 재 구현. + $db = DB::db(); $connect=$db->get(); diff --git a/hwe/d_merge.php b/hwe/d_merge.php index 5ad31eed..d7e4fbea 100644 --- a/hwe/d_merge.php +++ b/hwe/d_merge.php @@ -9,6 +9,8 @@ $session = Session::requireGameLogin()->setReadOnly(); $db = DB::db(); $connect=$db->get(); +//FIXME: 망했음. CriticalFailure. 재 구현. + $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/hwe/d_scout.php b/hwe/d_scout.php index f380b0ed..52c3a6a5 100644 --- a/hwe/d_scout.php +++ b/hwe/d_scout.php @@ -12,6 +12,8 @@ include "func.php"; $session = Session::requireGameLogin()->setReadOnly(); +//FIXME: 망했음. CriticalFailure. 재 구현. + $db = DB::db(); $connect=$db->get(); diff --git a/hwe/d_surrender.php b/hwe/d_surrender.php index 200f1bf7..d660b932 100644 --- a/hwe/d_surrender.php +++ b/hwe/d_surrender.php @@ -6,6 +6,8 @@ include "func.php"; //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); +//FIXME: 망했음. CriticalFailure. 재 구현. + $db = DB::db(); $connect=$db->get(); diff --git a/hwe/index.php b/hwe/index.php index 4fed7443..90e039ff 100644 --- a/hwe/index.php +++ b/hwe/index.php @@ -34,15 +34,11 @@ $session->setReadOnly(); -if($me['newmsg'] == 1 && $me['newvote'] == 1) { - $query = "update general set newmsg=0,newvote=0 where owner='{$session->userID}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif($me['newmsg'] == 1) { - $query = "update general set newmsg=0 where owner='{$session->userID}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif($me['newvote'] == 1) { - $query = "update general set newvote=0 where owner='{$session->userID}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +if($me['newmsg'] == 1 || $me['newvote'] == 1) { + $db->update('general', [ + 'newmsg'=>0, + 'newvote'=>0 + ], 'owner=%i', $session->userID); } $query = "select develcost,online,conlimit,tournament,tnmt_type,turnterm,scenario,scenario_text,extended_general,fiction,npcmode,vote from game limit 1";