마지막 남은 iframe 안녕!!!
This commit is contained in:
File diff suppressed because one or more lines are too long
+4
-66
@@ -8,66 +8,10 @@ $session = Session::getInstance()->setReadOnly();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>커맨드리스트</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<script type="text/javascript">
|
||||
<?php
|
||||
if(!$session->isGameLoggedIn()){
|
||||
echo 'window.parent.location.href = "../";';
|
||||
if (!$session->isGameLoggedIn()) {
|
||||
die('<script>window.location.href = "../"</script>');
|
||||
}
|
||||
?>
|
||||
function myclock() {
|
||||
lastday = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
|
||||
|
||||
date = document.clock.clock.value;
|
||||
|
||||
year = parseInt(date.substr(0, 4), 10);
|
||||
month = parseInt(date.substr(5,2), 10);
|
||||
day = parseInt(date.substr(8, 2), 10);
|
||||
hour = parseInt(date.substr(11, 2), 10);
|
||||
min = parseInt(date.substr(14, 2), 10);
|
||||
sec = parseInt(date.substr(17, 2), 10);
|
||||
|
||||
//윤년계산
|
||||
if(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) { lastday[1] = 29; }
|
||||
else { lastday[1] = 28; }
|
||||
|
||||
// if(term > 0) term--;
|
||||
|
||||
sec++;
|
||||
if(sec >= 60) { sec = 0; min++; }
|
||||
if(min >= 60) { min = 0; hour++; }
|
||||
if(hour >= 24) { hour = 0; day++; }
|
||||
if(day > lastday[month-1]) { month++; day = 1; }
|
||||
if(month >= 13) { year++; month = 1; }
|
||||
if(month < 10) { month = '0' + month; }
|
||||
if(day < 10) { day = '0' + day; }
|
||||
if(hour < 10) { hour = '0' + hour; }
|
||||
if(min < 10) { min = '0' + min; }
|
||||
if(sec < 10) { sec = '0' + sec; }
|
||||
date = '' + year + '-' + month + '-' + day + ' ' + hour + ':' + min + ':' + sec;
|
||||
|
||||
document.clock.clock.value = date;
|
||||
|
||||
window.setTimeout("myclock();", 1000);
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body OnLoad='myclock()'>
|
||||
<?php
|
||||
myCommandList();
|
||||
|
||||
function myCommandList() {
|
||||
@@ -88,9 +32,8 @@ function myCommandList() {
|
||||
$turn = getTurn($me, 2);
|
||||
|
||||
echo "<table width=300 height=700 class='tb_layout bg2'>
|
||||
<form name=clock>
|
||||
<tr>
|
||||
<td colspan=4 align=center id=bg0><b>- 명령 목록 - <input value='$date' type=text name=clock size=19 style=background-color:black;color:white;border-style:none;></b></td>
|
||||
<td colspan=4 align=center id=bg0><b>- 명령 목록 - <input value='$date' type=text id=clock size=19 style=background-color:black;color:white;border-style:none;></b></td>
|
||||
</tr>";
|
||||
|
||||
$year = $admin['year'];
|
||||
@@ -120,11 +63,6 @@ function myCommandList() {
|
||||
}
|
||||
|
||||
echo "
|
||||
</form>
|
||||
</table>
|
||||
";
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
+23
-31
@@ -720,8 +720,11 @@ where nation='{$general['nation']}'
|
||||
|
||||
function command_Single($turn, $command) {
|
||||
if(!$turn){
|
||||
header('location:commandlist.php', true, 303);
|
||||
return;
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'nextPage'=>null,
|
||||
'reason'=>'invalid turn'
|
||||
]);
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
@@ -735,7 +738,11 @@ function command_Single($turn, $command) {
|
||||
}
|
||||
$db->update('general', $setValues, 'owner=%i',$userID);
|
||||
|
||||
header('location:commandlist.php', true, 303);
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'nextPage'=>null,
|
||||
'reason'=>'success'
|
||||
]);
|
||||
}
|
||||
|
||||
function command_Chief($turn, $command) {
|
||||
@@ -762,37 +769,22 @@ function command_Chief($turn, $command) {
|
||||
}
|
||||
|
||||
function command_Other($turn, $commandtype) {
|
||||
|
||||
$target = "processing.php?commandtype={$commandtype}";
|
||||
foreach($turn as $turnItem){
|
||||
$target.="&turn[]={$turnItem}";
|
||||
if(!$turn){
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'nextPage'=>null,
|
||||
'reason'=>'invalid turn'
|
||||
]);
|
||||
}
|
||||
$target.="&".mt_rand();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<script>
|
||||
parent.moveProcessing(<?=$commandtype?>, <?=Json::encode($turn)?>);
|
||||
</script>
|
||||
</head>
|
||||
<body style="background-color:black;">
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
$unixNow = time();
|
||||
$turnArg = join('&turn[]=', $turn);
|
||||
|
||||
/*
|
||||
<form name='form1' action='processing.php' method='post' target=_parent>
|
||||
<?php foreach($turn as $turnItem): ?>
|
||||
<input type='hidden' name='turn[]' value='<?=$turnItem?>'>
|
||||
<?php endforeach; ?>
|
||||
<input type=hidden name=commandtype value=<?=$commandtype?>>
|
||||
</form>
|
||||
<script>*/
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'nextPage'=>"processing.php?commandtype={$commandtype}&turn[]={$turnArg}&t={$unixNow}",
|
||||
'reason'=>'success'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+5
-2
@@ -91,6 +91,7 @@ $serverCnt = $db->queryFirstField('SELECT count(*) FROM ng_games');
|
||||
<?=WebUtil::printJS('../e_lib/jquery.redirect.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/moment.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/moment-timezone-with-data-10-year-range.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/linkify/linkify.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/linkify/linkify-string.min.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
@@ -111,6 +112,8 @@ $(function(){
|
||||
setInterval(function(){
|
||||
refreshMsg();
|
||||
}, 5000);
|
||||
|
||||
reloadCommandList();
|
||||
});
|
||||
</script>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
@@ -241,9 +244,9 @@ else if($session->userGrade == 4){
|
||||
<td style='width:700px;height:520px;' colspan=2>
|
||||
<?=getMapHtml($mapTheme)?>
|
||||
</td>
|
||||
<td style='width:300px;' rowspan=4><iframe seamless="seamless" name=commandlist src='commandlist.php' style='width:300px;height:700px;' frameborder=0 marginwidth=0 marginheight=0 topmargin=0 scrolling=no></iframe></td>
|
||||
<td style='width:300px;' rowspan=4 id='commandlist'></td>
|
||||
</tr>
|
||||
<form name=form2 action=preprocessing.php method=post target=commandlist>
|
||||
<form id='form2' name=form2>
|
||||
<tr>
|
||||
<td rowspan=3 width=50 valign=top><?=turnTable()?></td>
|
||||
<td style="width:650px;border:none;text-align:center;"><?php cityInfo(); ?></td>
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$session = Session::requireGameLogin([])->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
@@ -17,8 +17,10 @@ $commandtype = Util::getReq('commandtype', 'int');
|
||||
increaseRefresh("턴입력", 1);
|
||||
|
||||
if(!$turn || $commandtype === null || $sel === null){
|
||||
header('location:commandlist.php', true, 303);
|
||||
die();
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'empty command'
|
||||
]);
|
||||
}
|
||||
|
||||
$count = count($turn);
|
||||
+63
-1
@@ -6,4 +6,66 @@ include "func.php";
|
||||
|
||||
|
||||
|
||||
$session = Session::requireGameLogin([])->setReadOnly();
|
||||
$session = Session::requireGameLogin([])->setReadOnly();
|
||||
|
||||
$type = Util::getReq('type', 'int', 0);
|
||||
$sel = Util::getReq('sel', 'int', 1);
|
||||
|
||||
if($sel <= 0 || $sel > 12){
|
||||
$sel = 1;
|
||||
}
|
||||
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
increaseRefresh("턴반복", 1);
|
||||
|
||||
$myActionCnt = $db->queryFirstField('SELECT con FROM general WHERE `owner`=%i', $userID);
|
||||
|
||||
$con = checkLimit($myActionCnt);
|
||||
if($con >= 2) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'result'=>'접속 제한입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
switch($type) {
|
||||
case 0://반복
|
||||
$valueMap = [];
|
||||
foreach(range($sel, GameConst::$maxTurn - 1) as $idx){
|
||||
$src = $idx % $sel;
|
||||
$valueMap['turn'.$idx] = $db->sqleval('%b', 'turn'.$src);
|
||||
}
|
||||
$db->update('general', $valueMap, 'owner=%i', $userID);
|
||||
break;
|
||||
case 1:
|
||||
$valueMap = [];
|
||||
foreach(range(GameConst::$maxTurn -1, $sel, -1) as $idx){
|
||||
$src = $idx - $sel;
|
||||
$valueMap['turn'.$idx] = $db->sqleval('%b', 'turn'.$src);
|
||||
}
|
||||
foreach(range($sel -1, 0, -1) as $idx){
|
||||
$valueMap['turn'.$idx] = EncodeCommand(0, 0, 0, 0);
|
||||
}
|
||||
$db->update('general', $valueMap, 'owner=%i', $userID);
|
||||
break;
|
||||
case 2:
|
||||
$valueMap = [];
|
||||
foreach(range(0, GameConst::$maxTurn - $sel - 1) as $idx){
|
||||
$src = $idx + $sel;
|
||||
$valueMap['turn'.$idx] = $db->sqleval('%b', 'turn'.$src);
|
||||
}
|
||||
foreach(range(GameConst::$maxTurn - $sel, GameConst::$maxTurn - 1) as $idx){
|
||||
$valueMap['turn'.$idx] = EncodeCommand(0, 0, 0, 0);
|
||||
}
|
||||
$db->update('general', $valueMap, 'owner=%i', $userID);
|
||||
break;
|
||||
}
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'result'=>'success'
|
||||
]);
|
||||
+61
-8
@@ -28,7 +28,7 @@ function refreshing(obj, arg1, arg2) {
|
||||
switch(arg1) {
|
||||
case 0: document.location.reload(); break;
|
||||
case 2: turn(arg2); break;
|
||||
case 3: arg2.submit(); break;
|
||||
case 3: $(arg2).submit(); break;
|
||||
case 4:
|
||||
arg2.submit();
|
||||
message.msg.value = "";
|
||||
@@ -39,14 +39,38 @@ function refreshing(obj, arg1, arg2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function moveProcessing(commandtype, turn){
|
||||
console.log(commandtype, turn);
|
||||
$.redirect("processing.php",{ commandtype: commandtype, turn: turn}, 'post');
|
||||
function turn(type) {
|
||||
$.post({
|
||||
url:'j_turn.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
type:type,
|
||||
sel:form2.sel.value
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data.result){
|
||||
alert(data.reason);
|
||||
}
|
||||
reloadCommandList();
|
||||
});
|
||||
}
|
||||
|
||||
function turn(type) {
|
||||
num = form2.sel.value;
|
||||
commandlist.location.replace('turn.php?type=' + type + '&sel=' + num);
|
||||
function reloadCommandList(){
|
||||
$.get({
|
||||
url:'commandlist.php',
|
||||
cache: false,
|
||||
}).then(function(rdata){
|
||||
$('#commandlist').html(rdata);
|
||||
});
|
||||
}
|
||||
|
||||
function myclock() {
|
||||
|
||||
$('#clock').val(moment().tz('Asia/Seoul').format('YYYY-MM-DD HH:mm:ss'));
|
||||
|
||||
window.setTimeout(function(){
|
||||
myclock();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
jQuery(function($){
|
||||
@@ -54,11 +78,40 @@ jQuery(function($){
|
||||
var $this = $(this);
|
||||
var target = $('[name="genlist"]').val();
|
||||
var msg = $('#msg').val();
|
||||
console.log(target, msg);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#mainBtnSubmit').click(function(){
|
||||
|
||||
});
|
||||
|
||||
$('#form2').submit(function(){
|
||||
var values = $(this).serializeArray();
|
||||
console.log(values);
|
||||
$.post({
|
||||
url:'j_preprocessing.php',
|
||||
dataType:'json',
|
||||
data:values
|
||||
}).then(function(data){
|
||||
if(!data.result){
|
||||
alert(data.reason);
|
||||
reloadCommandList();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!data.nextPage){
|
||||
reloadCommandList();
|
||||
return;
|
||||
}
|
||||
|
||||
document.location = data.nextPage;
|
||||
return;
|
||||
}, function(){
|
||||
alert('알 수 없는 에러');
|
||||
location.reload();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
myclock();
|
||||
});
|
||||
@@ -1,65 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
|
||||
$type = Util::getReq('type', 'int', 0);
|
||||
$sel = Util::getReq('sel', 'int', 1);
|
||||
|
||||
if($sel <= 0 || $sel > 12){
|
||||
$sel = 1;
|
||||
}
|
||||
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$connect=$db->get();
|
||||
|
||||
increaseRefresh("턴반복", 1);
|
||||
|
||||
$myActionCnt = $db->queryFirstField('SELECT con FROM general WHERE `owner`=%i', $userID);
|
||||
|
||||
$con = checkLimit($myActionCnt);
|
||||
if($con >= 2) {
|
||||
header('location:commandlist.php', true, 303);
|
||||
exit();
|
||||
}
|
||||
|
||||
switch($type) {
|
||||
case 0://반복
|
||||
$valueMap = [];
|
||||
foreach(range($sel, GameConst::$maxTurn - 1) as $idx){
|
||||
$src = $idx % $sel;
|
||||
$valueMap['turn'.$idx] = $db->sqleval('%b', 'turn'.$src);
|
||||
}
|
||||
$db->update('general', $valueMap, 'owner=%i', $userID);
|
||||
break;
|
||||
case 1:
|
||||
$valueMap = [];
|
||||
foreach(range(GameConst::$maxTurn -1, $sel, -1) as $idx){
|
||||
$src = $idx - $sel;
|
||||
$valueMap['turn'.$idx] = $db->sqleval('%b', 'turn'.$src);
|
||||
}
|
||||
foreach(range($sel -1, 0, -1) as $idx){
|
||||
$valueMap['turn'.$idx] = EncodeCommand(0, 0, 0, 0);
|
||||
}
|
||||
$db->update('general', $valueMap, 'owner=%i', $userID);
|
||||
break;
|
||||
case 2:
|
||||
$valueMap = [];
|
||||
foreach(range(0, GameConst::$maxTurn - $sel - 1) as $idx){
|
||||
$src = $idx + $sel;
|
||||
$valueMap['turn'.$idx] = $db->sqleval('%b', 'turn'.$src);
|
||||
}
|
||||
foreach(range(GameConst::$maxTurn - $sel, GameConst::$maxTurn - 1) as $idx){
|
||||
$valueMap['turn'.$idx] = EncodeCommand(0, 0, 0, 0);
|
||||
}
|
||||
$db->update('general', $valueMap, 'owner=%i', $userID);
|
||||
break;
|
||||
}
|
||||
|
||||
header('location:commandlist.php', true, 303);
|
||||
Reference in New Issue
Block a user