getValues(['year','month']);
$query = "select nation,name,color,power,gennum from nation order by power desc";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$nationcount = MYDB_num_rows($result);
for ($i=0; $i < $nationcount; $i++) {
$nation = MYDB_fetch_array($result);
// 아국표시
if ($nation['nation'] == $me['nation']) {
//속령수
$query = "select city from city where nation='{$nation['nation']}'";
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$citycount = MYDB_num_rows($result2);
echo "
{$nation['name']}
{$nation['power']}
{$nation['gennum']}
$citycount
-
-
-
-
";
continue;
}
$query = "select state,term,fixed,reserved,showing from diplomacy where me='{$me['nation']}' and you='{$nation['nation']}'";
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$dip = MYDB_fetch_array($result2);
$query = "select reserved,showing from diplomacy where you='{$me['nation']}' and me='{$nation['nation']}'";
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$dip2 = MYDB_fetch_array($result2);
//속령수
$query = "select city from city where nation='{$nation['nation']}'";
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$citycount = MYDB_num_rows($result2);
switch ($dip['state']) {
case 0: $state = "교 전"; break;
case 1: $state = "선포중"; break;
case 2: $state = "통 상"; break;
case 3: $state = "통합수락중"; break;
case 4: $state = "통합제의중"; break;
case 5: $state = "합병수락중"; break;
case 6: $state = "합병제의중"; break;
case 7: $state = "불가침"; break;
}
$term = $admin['year'] * 12 + $admin['month'] + $dip['term'];
$year = intdiv($term, 12);
$month = $term % 12;
if ($month == 0) {
$month = 12;
$year--;
}
$date = date('Y-m-d H:i:s');
$note = "";
if ($dip['fixed'] != "") {
if ($dip['state'] == 7) {
$note .= $dip['fixed'];
} else {
$note .= "{$dip['fixed']}";
}
if ($dip['reserved'] != "" || $dip2['reserved'] != "") {
$note .= " ";
}
}
if ($dip['showing'] >= $date) {
if ($dip['reserved'] != "") {
$note .= "아국측 제의: ".$dip['reserved'];
if ($dip2['reserved'] != "") {
$note .= " ";
}
}
}
if ($dip2['showing'] >= $date) {
if ($dip2['reserved'] != "") {
$note .= "상대측 제의: ".$dip2['reserved'];
}
}
if ($note == "") {
$note = " ";
}
echo "