<?
ob_start();
require'../../sys/head.php';
require'../../sys/conf.php';
require'../../sys/sess.php';
if($re0['status']==2){
if(empty($_GET[e])){
echo'<FORM ACTION="index.php?e=v1&der='.$key.'" METHOD="POST">';
echo 'Выберете пункт меню:<br/>
<select name="p">
<option value="1" selected="selected">Управление</option>
<option value="2" >Техподдержка</option>
<option value="3" >Карта мира</option>
<option value="4" >Проверить игрока</option>
<option value="5" >Статистика</option>
</select><br/>';?>
<INPUT TYPE='submit'VALUE='ОК'>
</FORM><br/><?
}
if($_GET[e]=='v1'){
$z=$_POST[p];header("Location: index.php?e=$z&der=$key");
}
if($_GET[e]=='v2'){
$z=$_POST[p];header("Location: index.php?e=1&a=$z&der=$key");
}
if($_GET[e]==1){
echo"<u>Управление</u> :<br/>";
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(empty($_GET[a])){
echo'<FORM ACTION="index.php?e=v2&der='.$key.'" METHOD="POST">';
echo 'Выберете пункт меню:<br/>
<select name="p">
<option value="1" selected="selected">Рассылка</option>
<option value="2" >Очистка чатов</option>
<option value="3" >Разблокировать профиля</option>
<option value="4" >резерв</option>
</select><br/>';?>
<INPUT TYPE='submit'VALUE='ОК'>
</FORM><br/><?
}
if($_GET[a]==1){
if($_GET[h]!=1){
echo'<FORM ACTION="index.php?der='.$key.'&a=1&h=1&e=1" METHOD="POST">';?>
Сообщение<br/> <INPUT TYPE="text" NAME="mail" VALUE=""><br/>
<input type="submit"  value="Написать">
</FORM><br/><?
}else{
$mess=$_POST['mail'];$s1=date("H");$s2=date("i");
$money = mysql_query("SELECT strana FROM gos  WHERE login!='K'");
while($array = mysql_fetch_array($money)){
$cant = $array[strana];$tm=time();
 qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$cant','{Цива(МП)рассылка}','$tm','0','0','$mess')");
}
echo"Сообщения отправлены!<br/>";
}
}
if($_GET[a]==2){
echo"<u>Очистка чатов</u> :<br/>";
if(empty($_GET[u])){
echo"Вы уверены что нужно очистить ассамблею и учёный совет?<br/>";
echo'<a href="index.php?e=1&a=2&u=1&der='.$key.'">Да</a><br/>';
echo'<a href="index.php?e=1&der='.$key.'">Нет</a><br/>';
}
if($_GET[u]==1){
$file = fopen('../../hk777.txt', 'w');
mysql_query("TRUNCATE TABLE chat ");mysql_query("TRUNCATE TABLE chat2 ");
echo"Ассамблея и учёный совет очищены!<br/>";
echo'<a href="index.php?e=1&der='.$key.'">Назад</a><br/>';
}
}
if($_GET[a]==3){
mysql_query("UPDATE users SET blok='0'");
echo"Все профиля разблокированы!<br/>";
}
if($_GET[a]==4){

}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
 if($_GET[e]==2){
 echo"<u>Техподдержка</u> :<br/>";
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(empty($_GET[v])){
echo "<a href=index.php?e=2&v=6&m=0&der=$key>Вопросы по игре</a><br/>";
echo "<a href=index.php?e=2&v=6&m=1&der=$key>Ошибки и глюки</a><br/>";
echo "<a href=index.php?e=2&v=6&m=2&der=$key>Проверки</a><br/>";
}

if($_GET[v]==6){
$tp=zif($_GET[m]);
$th = qw("SELECT * FROM tehno  WHERE vid='$tp'");
while($t = mysql_fetch_array($th)){
$w="<a href=index.php?e=2&v=1&log=$t[login]&id=$t[id]&m=4&der=$key>Ответить</a>";

echo"[$t[data]]($t[login])($t[strana])<br/>$t[text] $w$del<br/>-----<br/>";
}
}
if($_GET[v]==1){
if(empty($_POST[text])){
$w1=mysql_fetch_array(qw("SELECT strana FROM gos WHERE login='$_GET[log]'"));
echo'<FORM ACTION="index.php?id='.$_GET[id].'&e=2&v=1&st='.$w1[strana].'&der='.$key.'" METHOD=POST>';?>
Сообщение:
<br/>
<input type="text" name="text" maxlength="180"/><br/>
<INPUT TYPE='submit'VALUE='Написать'></FORM><br/><?
}else{
$w1=mysql_fetch_array(qw("SELECT data FROM tehno WHERE id='$_GET[id]'"));
$dat=time();$y="Ответ на запрос от ($w1[data]) : $_POST[text]";
$y=text($y);
mysql_query("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$_GET[st]','{Техподдержка}','$dat','0','0','$y'),
('RD!КипчаК','{ТП}','$dat','0','0','$y($re1[strana]')");
header("Location: index.php?e=2&v=11&der=$key");
}
}
if($_GET[v]==11){
echo"Сообщение отправлено!<br/>";
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
 if($_GET[e]==3){
 echo"<u>Карта мира</u> :<br/>";
$sum = 20; // число записей на странице
$result = qw("SELECT count(*) as a from gos"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];
if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;
$v=0;
$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}

$r = qw("SELECT * FROM gos order by `datareg` asc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){
////////////////вывод
$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$v. </b><a href='index.php?e=4&der=$key&strana=$m[strana]'>$m[strana]</a>($m[ip])($m[ip2])<br/>";
////////////////
}
///////////////навигация

if ($str > 0){$p = $str - 1;
echo "<a href=index.php?e=3&der=$key&str=$p>На запад</a>";}
$str++;if($start + $n < $rec)
echo"<b>||</b>";
echo "<a href=index.php?e=3&der=$key&str=$str>На восток</a>"; 
$go=round($rec/$sum);

echo"<br/>-------";
echo "<br><a href=index.php?e=3&der=$key&str=>начало запада</a>";
echo "<br><a href=index.php?e=3&der=$key&str=$go>конец востока</a>"; 
}
 if($_GET[e]==4){
 echo"<u>Проверка игрока</u> :<br/>";
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 if(empty($_POST[strana])){$strana=$_GET[strana];}else{$strana=$_POST[strana];}
$st=mysql_fetch_array(qw("SELECT id,login FROM gos WHERE strana ='$strana'"));
if(empty($strana)){
echo'<FORM ACTION="index.php?e=4&der='.$key.'" METHOD=POST>';?>
Страна игрока:
<br/>
<input type="text" name="strana" maxlength="255"/><br/>
<INPUT TYPE='submit'VALUE='Ok'></FORM><br/><?
}else{
if($st[id]>0){
$lne=mysql_fetch_array(qw("SELECT * FROM users WHERE login='$st[login]'"));
echo"<b>$strana</b>(<b>$st[login]</b>)<br/>";
if($lne[blok]==1){echo"<b>$lne[mod]</b> блокировал доступ<br/>По причине <b><br/>$lne[povod]</b><br/>";}
////////////////////////////////////////////////////////////////////////////////////
if(empty($_GET[v])){
echo'<FORM ACTION="index.php?e=4&v=v1&der='.$key.'&strana='.$_REQUEST[strana].'" METHOD="POST">';
echo 'Выберете пункт меню:<br/>
<select name="p">
<option value="24" selected="selected">Написать в страну</option>
<option value="1" >Информация</option>
<option value="2" >Параметры</option>
<option value="19" >Население</option>
<option value="15" >Ресурсы</option>
<option value="3" >Здания</option>
<option value="5" >Наука</option>
<option value="6" >Войны</option>
<option value="7" >Вторжения</option>
<option value="8" >Логи действий</option>
<option value="22" >Сжечь ресурсы</option>
<option value="9" >Дать игнор</option>
<option value="10" >Снять игнор</option>
<option value="11" >Заблокировать по IP</option>
<option value="12" >Заблокировать</option>
<option value="13" >Разблокировать</option>
<option value="20" >Удалить</option>
<option value="16" >Страны игрока</option>
</select><br/>';?>
<INPUT TYPE='submit'VALUE='ОК'>
</FORM><br/><?
}
if($_GET[v]=='v1'){
$z=$_POST[p];header("Location: index.php?e=4&v=$z&strana=$_GET[strana]&der=$key");
}
if($_GET[v]==1){
echo"<u>Информация</u> :<br/>";
$ss=mysql_fetch_array(qw("SELECT datareg,ip,ip2,soft FROM gos WHERE strana ='$strana'"));
$time1=time();
$dr=$time1-$ss['datareg'];
$sec2=$dr;
$hou2=floor($sec2/3600);
$sec2-=$hou2*3600;
$min2=floor($sec2/60);
$sec2-=$min2*60;
if($hou2>0){echo"Возраст [<b>$hou2</b> ч.<b>$min2</b> м.]<br/>";}else{echo"Возраст [<b>$min2</b> м.<b>$sec2</b> с.]<br/>";}
echo"Ip :<br/>$ss[ip]<br/>Ip2 :<br/>$ss[ip2]<br/>Soft :<br/>$ss[soft]<br/>";
}
if($_GET[v]==2){
echo"<u>Параметры</u> :<br/>";
$md1=mysql_fetch_array(qw("SELECT wpk,sab,vor,ver FROM gos WHERE strana ='$strana'"));
$md2=mysql_fetch_array(qw("SELECT * FROM gos2 WHERE strana ='$strana'"));
echo"<u>Генерал</u> :<br/> возр.($md2[genv]) нав.($md2[genn]) мор.($md2[genm]) оп.($md2[geno])<br/>";
echo"<u>Цитадель(Ратуша)</u> :<br/>шпн.($md1[wpk]) саб.($md1[sab]) вор.($md1[vor]) врб.($md1[ver])<br/>";
echo"<u>Параметры войск</u> :<br/>пех($md2[peh1]/$md2[peh2])кав($md2[kav1]/$md2[kav2])стр($md2[str1]/$md2[str2])
пуш($md2[puh1]/$md2[puh2])тан($md2[tan1]/$md2[tan2])сам($md2[sam1]/$md2[sam2])<br/>";
$md1=mysql_fetch_array(qw("SELECT stena FROM domik WHERE strana ='$strana'"));
echo"Уровень стены ($md1[stena])<br/>";
}
if($_GET[v]==3){
echo"<u>Здания</u> :<br/>";
$sp=mysql_fetch_array(qw("SELECT * FROM domik WHERE strana ='$strana'"));
if($sp[12]==1){echo'Ратуша<br>';}
if($sp[12]==2){echo'Цитадель<br>';}
if($sp[13]==1){echo'Казарма<br>';}
if($sp[13]==2){echo'Дом войны<br>';}
if($sp[14]==1){echo'Хранилище<br>';}
if($sp[14]==2){echo'Рынок<br>';}
if($sp[15]==1){echo'Университет<br>';}
if($sp[15]==2){echo'Научный центр<br>';}
if($sp[16]==1){echo'Деревня<br>';}
if($sp[17]==1){echo'Стена<br>';}
if($sp[18]==1){echo'Фабрика<br>';}
if($sp[18]==2){echo'Завод<br>';}
if($sp[19]==1){echo'Нефтевышка<br>';}
if($sp[20]==1){echo'Бункер<br>';}
if($sp[21]==1){echo'Сторожевая башня<br>';}
}
if($_GET[v]==5){
echo"<u>Наука</u> :<br/>";
$b1 = mysql_fetch_array(qw("SELECT * FROM gos WHERE strana='$strana'"));
echo"<u>Технологии</u> :<br/>";
echo"
Научный уровень: <b>$b1[naukur]</b><br/>
Выплавка железа: <b>$b1[naukmet]</b><br/>
Добыча камня: <b>$b1[naukkam]</b><br/>
Переработка древесины: <b>$b1[naukder]</b><br/>
Выращивание зерна: <b>$b1[naukzer]</b><br/>
Нефтедобыча: <b>$b1[nauknef]</b><br/>
Прирост населения: <b>$b1[naukpri]</b><br/>
Демонтаж зданий: <b>$b1[naukdem]</b><br/>";
$b2 = mysql_fetch_array(qw("SELECT * FROM gos2 WHERE strana='$strana'"));
echo"<u>Открытия</u> :<br/>";
if($b2[otk1]==1){echo'открытие-переплавка железа<br/>';}
if($b2[otk2]==1){echo'открытие-распиловка древесины<br/>';}
if($b2[otk3]==1){echo'открытие-удобрение зерновых<br/>';}
if($b2[otk4]==1){echo'открытие-обработка камней<br/>';}
if($b2[otk5]==1){echo'открытие-синтез нефти<br/>';}
if($b2[otk6]==1){echo'открытие-берсерк<br/>';}
if($b2[otk7]==1){echo'открытие-бомба<br/>';}
}
if($_GET[v]==6){
echo"<u>Войны</u> :<br/>";
$query="SELECT * FROM voyna WHERE strana='$strana'";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$zh1=mysql_result($result,$i,"vrag");
$zh2=mysql_result($result,$i,"peh");
$zh3=mysql_result($result,$i,"kon");
$zh4=mysql_result($result,$i,"str");
$zh8=mysql_result($result,$i,"puh");
$zh66=mysql_result($result,$i,"tan");
$zh7=mysql_result($result,$i,"sam");
$zh5=mysql_result($result,$i,"datanap");
$array[id]=mysql_result($result,$i,"id");
$tim=time();
$zh6=$tim-$zh5;
$sec1=$zh6;
$hou1=floor($sec1/3600);
$sec1-=$hou1*3600;
$min1=floor($sec1/60);
$sec1-=$min1*60;
echo"<b>$zh1</b>(<b>$zh2</b> пех.)(<b>$zh3</b> кав.)(<b>$zh4</b> стр.)(<b>$zh8</b> пух.)(<b>$zh66</b> тан.)(<b>$zh7</b> сам.)[<b>$hou1</b> час.<b>$min1</b> мин.]<br/>";
$i++;
}
}
if($_GET[v]==7){
echo"<u>Вторжения</u> :<br/>";
$query="SELECT * FROM voyna WHERE vrag='$strana'";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$zh1=mysql_result($result,$i,"strana");
$zh2=mysql_result($result,$i,"peh");
$zh3=mysql_result($result,$i,"kon");
$zh4=mysql_result($result,$i,"str");
$zh8=mysql_result($result,$i,"puh");
$zh66=mysql_result($result,$i,"tan");
$zh7=mysql_result($result,$i,"sam");
$zh5=mysql_result($result,$i,"datanap");
$array[id]=mysql_result($result,$i,"id");
$tim=time();
$zh6=$tim-$zh5;
$sec1=$zh6;
$hou1=floor($sec1/3600);
$sec1-=$hou1*3600;
$min1=floor($sec1/60);
$sec1-=$min1*60;
echo"<b>$zh1</b>(<b>$zh2</b> пех.)(<b>$zh3</b> кав.)(<b>$zh4</b> стр.)(<b>$zh8</b> пух.)(<b>$zh66</b> тан.)(<b>$zh7</b> сам.)[<b>$hou1</b> час.<b>$min1</b> мин.]<br/>";
$i++;
}
}
if($_GET[v]==8){
echo"<u>Логи действий</u> :<br/>";
if(empty($_GET[w])){
echo'<FORM ACTION="index.php?e=4&v=8&w=v1&der='.$key.'&strana='.$_REQUEST[strana].'" METHOD="POST">';
echo 'Выберете пункт меню:<br/>
<select name="p">
<option value="1" selected="selected">Строительство</option>
<option value="2" >Цитадель(вор и т.д.)</option>
<option value="3" >Ведение войн</option>
<option value="4" >Логи НГ</option>
<option value="5" >Логи боёв</option>
<option value="6" >Добыча ресурсов</option>
<option value="7" >Союзные обмены</option>
<option value="8" >Потеря зданий</option>
<option value="9" >Захваты</option>
<option value="10" >Генерал и цитадель</option>
<option value="11" >Союзы и кланы</option>
<option value="12" >Рынок и налог</option>
<option value="13" >Обучение и увольнение</option>
<option value="14" >Сжигания</option>
</select><br/>';?>
<INPUT TYPE='submit'VALUE='ОК'>
</FORM><br/><?
}
if($_GET[w]=='v1'){
$z=$_POST[p];header("Location: index.php?e=4&v=8&w=$z&strana=$_GET[strana]&der=$key");
}
if($_GET[w]==1){
$sum = 10;$vid=1;
$result = qw("SELECT count(id) as a from logistik WHERE strana='$strana' and vid='$vid'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;$v=0;$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}
$r = mysql_query("SELECT * FROM logistik WHERE strana='$strana' and vid='$vid' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$m[data]</b><br/>$m[text]<br/>---<br/>";}if ($str > 0){$p = $str - 1;
echo '<a href="index.php?e=4&w=1&v=8&der='.$key.'&str='.$p.'&strana='.$strana.'">Назад</a>';}
$str++;if($start + $n < $rec)echo"<b>||</b>";echo '<a href="index.php?e=4&w=1&v=8&der='.$key.'&str='.$str.'&strana='.$strana.'">Вперёд</a>'; 
}
/////////////////////
if($_GET[w]==2){
$sum = 5;$vid=2;
$result = qw("SELECT count(id) as a from logistik WHERE strana='$strana' and vid='$vid'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;$v=0;$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}
$r = mysql_query("SELECT * FROM logistik WHERE strana='$strana' and vid='$vid' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$m[data]</b><br/>$m[text]<br/>---<br/>";}if ($str > 0){$p = $str - 1;
echo '<a href="index.php?e=4&w=2&v=8&der='.$key.'&str='.$p.'&strana='.$strana.'">Назад</a>';}
$str++;if($start + $n < $rec)echo"<b>||</b>";echo '<a href="index.php?e=4&w=2&v=8&der='.$key.'&str='.$str.'&strana='.$strana.'">Вперёд</a>'; 
}
/////////////////////
if($_GET[w]==3){
$sum = 10;$vid=6;
$result = qw("SELECT count(id) as a from logistik WHERE strana='$strana' and vid='$vid'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;$v=0;$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}
$r = mysql_query("SELECT * FROM logistik WHERE strana='$strana' and vid='$vid' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$m[data]</b><br/>$m[text]<br/>---<br/>";}if ($str > 0){$p = $str - 1;
echo '<a href="index.php?e=4&w=3&v=8&der='.$key.'&str='.$p.'&strana='.$strana.'">Назад</a>';}
$str++;if($start + $n < $rec)echo"<b>||</b>";echo '<a href="index.php?e=4&w=3&v=8&der='.$key.'&str='.$str.'&strana='.$strana.'">Вперёд</a>'; 
}
/////////////////////
if($_GET[w]==4){
$sum = 2;$vid=5;
$result = qw("SELECT count(id) as a from logistik WHERE strana='$strana' and vid='$vid'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;$v=0;$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}
$r = mysql_query("SELECT * FROM logistik WHERE strana='$strana' and vid='$vid' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$m[data]</b><br/>$m[text]<br/>---<br/>";}if ($str > 0){$p = $str - 1;
echo '<a href="index.php?e=4&w=4&v=8&der='.$key.'&str='.$p.'&strana='.$strana.'">Назад</a>';}
$str++;if($start + $n < $rec)echo"<b>||</b>";echo '<a href="index.php?e=4&w=4&v=8&der='.$key.'&str='.$str.'&strana='.$strana.'">Вперёд</a>'; 
}
/////////////////////
if($_GET[w]==5){
$sum = 1;$vid=7;
$result = qw("SELECT count(id) as a from logistik WHERE strana='$strana' and vid='$vid'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;$v=0;$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}
$r = mysql_query("SELECT * FROM logistik WHERE strana='$strana' and vid='$vid' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$m[data]</b><br/>$m[text]<br/>---<br/>";}if ($str > 0){$p = $str - 1;
echo '<a href="index.php?e=4&w=5&v=8&der='.$key.'&str='.$p.'&strana='.$strana.'">Назад</a>';}
$str++;if($start + $n < $rec)echo"<b>||</b>";echo '<a href="index.php?e=4&w=5&v=8&der='.$key.'&str='.$str.'&strana='.$strana.'">Вперёд</a>'; 
}
/////////////////////
if($_GET[w]==6){
$sum = 10;$vid=8;
$result = qw("SELECT count(id) as a from logistik WHERE strana='$strana' and vid='$vid'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;$v=0;$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}
$r = mysql_query("SELECT * FROM logistik WHERE strana='$strana' and vid='$vid' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$m[data]</b><br/>$m[text]<br/>---<br/>";}if ($str > 0){$p = $str - 1;
echo '<a href="index.php?e=4&w=6&v=8&der='.$key.'&str='.$p.'&strana='.$strana.'">Назад</a>';}
$str++;if($start + $n < $rec)echo"<b>||</b>";echo '<a href="index.php?e=4&w=6&v=8&der='.$key.'&str='.$str.'&strana='.$strana.'">Вперёд</a>'; 
}
/////////////////////
if($_GET[w]==7){
$sum = 10;$vid=9;
$result = qw("SELECT count(id) as a from logistik WHERE strana='$strana' and vid='$vid'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;$v=0;$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}
$r = mysql_query("SELECT * FROM logistik WHERE strana='$strana' and vid='$vid' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$m[data]</b><br/>$m[text]<br/>---<br/>";}if ($str > 0){$p = $str - 1;
echo '<a href="index.php?e=4&w=7&v=8&der='.$key.'&str='.$p.'&strana='.$strana.'">Назад</a>';}
$str++;if($start + $n < $rec)echo"<b>||</b>";echo '<a href="index.php?e=4&w=7&v=8&der='.$key.'&str='.$str.'&strana='.$strana.'">Вперёд</a>'; 
}
/////////////////////
if($_GET[w]==8){
$sum = 10;$vid=11;
$result = qw("SELECT count(id) as a from logistik WHERE strana='$strana' and vid='$vid'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;$v=0;$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}
$r = mysql_query("SELECT * FROM logistik WHERE strana='$strana' and vid='$vid' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$m[data]</b><br/>$m[text]<br/>---<br/>";}if ($str > 0){$p = $str - 1;
echo '<a href="index.php?e=4&w=8&v=8&der='.$key.'&str='.$p.'&strana='.$strana.'">Назад</a>';}
$str++;if($start + $n < $rec)echo"<b>||</b>";echo '<a href="index.php?e=4&w=8&v=8&der='.$key.'&str='.$str.'&strana='.$strana.'">Вперёд</a>'; 
}
/////////////////////
if($_GET[w]==9){
$sum = 2;$vid=12;
$result = qw("SELECT count(id) as a from logistik WHERE strana='$strana' and vid='$vid'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;$v=0;$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}
$r = mysql_query("SELECT * FROM logistik WHERE strana='$strana' and vid='$vid' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$m[data]</b><br/>$m[text]<br/>---<br/>";}if ($str > 0){$p = $str - 1;
echo '<a href="index.php?e=4&w=9&v=8&der='.$key.'&str='.$p.'&strana='.$strana.'">Назад</a>';}
$str++;if($start + $n < $rec)echo"<b>||</b>";echo '<a href="index.php?e=4&w=9&v=8&der='.$key.'&str='.$str.'&strana='.$strana.'">Вперёд</a>'; 
}
/////////////////////
if($_GET[w]==10){
$sum = 10;$vid=13;
$result = qw("SELECT count(id) as a from logistik WHERE strana='$strana' and vid='$vid'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;$v=0;$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}
$r = mysql_query("SELECT * FROM logistik WHERE strana='$strana' and vid='$vid' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$m[data]</b><br/>$m[text]<br/>---<br/>";}if ($str > 0){$p = $str - 1;
echo '<a href="index.php?e=4&w=10&v=8&der='.$key.'&str='.$p.'&strana='.$strana.'">Назад</a>';}
$str++;if($start + $n < $rec)echo"<b>||</b>";echo '<a href="index.php?e=4&w=10&v=8&der='.$key.'&str='.$str.'&strana='.$strana.'">Вперёд</a>'; 
}
/////////////////////
if($_GET[w]==11){
$sum = 10;$vid=17;
$result = qw("SELECT count(id) as a from logistik WHERE strana='$strana' and vid='$vid'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;$v=0;$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}
$r = mysql_query("SELECT * FROM logistik WHERE strana='$strana' and vid='$vid' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$m[data]</b><br/>$m[text]<br/>---<br/>";}if ($str > 0){$p = $str - 1;
echo '<a href="index.php?e=4&w=11&v=8&der='.$key.'&str='.$p.'&strana='.$strana.'">Назад</a>';}
$str++;if($start + $n < $rec)echo"<b>||</b>";echo '<a href="index.php?e=4&w=11&v=8&der='.$key.'&str='.$str.'&strana='.$strana.'">Вперёд</a>'; 
}
/////////////////////
if($_GET[w]==12){
$sum = 10;$vid=20;
$result = qw("SELECT count(id) as a from logistik WHERE strana='$strana' and vid='$vid'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;$v=0;$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}
$r = mysql_query("SELECT * FROM logistik WHERE strana='$strana' and vid='$vid' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$m[data]</b><br/>$m[text]<br/>---<br/>";}if ($str > 0){$p = $str - 1;
echo '<a href="index.php?e=4&w=12&v=8&der='.$key.'&str='.$p.'&strana='.$strana.'">Назад</a>';}
$str++;if($start + $n < $rec)echo"<b>||</b>";echo '<a href="index.php?e=4&w=12&v=8&der='.$key.'&str='.$str.'&strana='.$strana.'">Вперёд</a>'; 
}
/////////////////////
if($_GET[w]==13){
$sum = 10;$vid=21;
$result = qw("SELECT count(id) as a from logistik WHERE strana='$strana' and vid='$vid'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;$v=0;$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}
$r = mysql_query("SELECT * FROM logistik WHERE strana='$strana' and vid='$vid' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$m[data]</b><br/>$m[text]<br/>---<br/>";}if ($str > 0){$p = $str - 1;
echo '<a href="index.php?e=4&w=13&v=8&der='.$key.'&str='.$p.'&strana='.$strana.'">Назад</a>';}
$str++;if($start + $n < $rec)echo"<b>||</b>";echo '<a href="index.php?e=4&w=13&v=8&der='.$key.'&str='.$str.'&strana='.$strana.'">Вперёд</a>'; 
}
/////////////////////
/////////////////////
if($_GET[w]==14){
$sum = 5;$vid=22;
$result = qw("SELECT count(id) as a from logistik WHERE strana='$strana' and vid='$vid'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;$v=0;$s1=$sum*$str;$v=$v+$s1;
$fn=round(((1+$num)/$sum)-1);if($fn<0){$fn=0;}else{}
$r = mysql_query("SELECT * FROM logistik WHERE strana='$strana' and vid='$vid' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){$m= mysql_fetch_array($r);	$v++;		   
echo"<b>$m[data]</b><br/>$m[text]<br/>---<br/>";}if ($str > 0){$p = $str - 1;
echo '<a href="index.php?e=4&w=14&v=8&der='.$key.'&str='.$p.'&strana='.$strana.'">Назад</a>';}
$str++;if($start + $n < $rec)echo"<b>||</b>";echo '<a href="index.php?e=4&w=14&v=8&der='.$key.'&str='.$str.'&strana='.$strana.'">Вперёд</a>'; 
}
/////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
if($_GET[v]==9){
echo"<u>Игнор</u> :<br/>";
mysql_query("UPDATE users SET `ignor`='1' WHERE login=(SELECT login FROM gos WHERE strana ='$strana')");
echo"Гос-во $strana в игноре!<br/>";
}
if($_GET[v]==10){
echo"<u>Игнор</u> :<br/>";
mysql_query("UPDATE users SET `ignor`='0' WHERE login=(SELECT login FROM gos WHERE strana ='$strana')");
echo"С гос-ва $strana снят игнор!<br/>";
}
if($_GET[v]==11){
$ips=mysql_fetch_array(mysql_query("SELECT ip,ip2,soft FROM gos WHERE strana='$strana'"));
chmod('.htaccess', 0666);
$ip = "deny from $ips[ip]\r\n";
$fp = @fopen("../../.htaccess", "a+");
fwrite($fp, $ip);
fclose($fp);
chmod('.htaccess', 0600);
echo"IP успешно заблокирован!<br/>";
}
if($_GET[v]==12){
echo"<u>Блокирование</u> :<br/>";
$bb=$_POST['povod'];
if(empty($bb)){
echo'<FORM ACTION="index.php?e=4&v=12&der='.$key.'&strana='.$strana.'" METHOD="POST">';?>
Напишите причину<br/> <INPUT TYPE='text' NAME='povod'VALUE=""><br/>
<INPUT TYPE='submit'VALUE='Заблокировать'>
</FORM><br/><?
}else{
$ips1=mysql_fetch_array(mysql_query("SELECT status FROM users WHERE login=(SELECT login FROM gos WHERE strana ='$strana')"));
if($ips1['status']==0){mysql_query("UPDATE users SET `blok`='1',`povod`='$bb',`mod`='$re1[strana]' WHERE login=(SELECT login FROM gos WHERE strana ='$strana')");
echo"Вы блокировали доступ стране $strana !<br/>";
}else{

echo"Вы не можете блокировать модератора!<br/>";
}
}
}
if($_GET[v]==13){
echo"<u>Разблокирование</u> :<br/>";
mysql_query("UPDATE users SET `blok`='0' WHERE login=(SELECT login FROM gos WHERE strana ='$strana')");
echo"Гос-во $strana разблокировано!<br/>";
}
if($_GET[v]==14){

}
if($_GET[v]==15){
$b3 = mysql_fetch_array(qw("SELECT land,gora,lesa,dengi,metal,derevo,zerno,kamen,neft FROM gos2 WHERE strana='$strana'"));
echo"<u>Ресурсы</u> :<br/>
Деньги : <b>$b3[dengi]</b><br/>
Железо : <b>$b3[metal]</b><br/>
Дерево : <b>$b3[derevo]</b><br/>
Зерно : <b>$b3[zerno]</b><br/>
Камень : <b>$b3[kamen]</b><br/>
Нефть : <b>$b3[neft]</b><br/>";
echo"<u>Территория</u> :<br/>
Свободная земля : <b>$b3[land]</b><br/>
Горы : <b>$b3[gora]</b><br/>
Леса : <b>$b3[lesa]</b><br/>";
}
if($_GET[v]==16){
echo"<u>Страны игрока</u> :<br/>";
$ips=mysql_fetch_array(mysql_query("SELECT ip,ip2 FROM gos WHERE strana='$strana'"));
$ip=$ips['ip'];$ip2=$ips['ip2'];if($ip2==0){$ip2=$ip;}
$query="SELECT strana FROM gos WHERE ip='$ip' or ip2='$ip2'";
$result=mysql_query($query);$num=mysql_numrows($result);
$i=0;while ($i < $num) {
$p1=mysql_result($result,$i,"strana");
$i++;echo "$p1,";}
}
if($_GET[v]==17){

}

if($_GET[v]==19){
echo"<u>Население</u> :<br/>";
$w=mysql_fetch_array(qw("SELECT * FROM gos2 WHERE strana = '$strana'"));
$wr=mysql_fetch_array(qw("SELECT
 sum(peh)as a,sum(kon) as b,sum(str) as c ,sum(puh)as d,sum(tan) as e,sum(sam) as f FROM voyna WHERE strana='$strana'"));
$re=mysql_fetch_array(qw("SELECT sum(rab) as rab FROM res WHERE strana='$strana'"));
$s1=mysql_fetch_array(qw("SELECT sum(rab) as rab FROM stroyka WHERE strana='$strana'"));
$b4=mysql_fetch_array(qw("SELECT rab FROM nef WHERE strana='$strana'"));
$s2=mysql_fetch_array(qw("SELECT sum(rab) as rab FROM stroyka2 WHERE strana='$strana'"));
$rb=$re[rab]+$s1[rab]+$s2[rab]+$b4[rab];
$b1=mysql_fetch_array(qw("SELECT sum(bot) as bot FROM botan WHERE strana='$strana'"));
$b2=mysql_fetch_array(qw("SELECT sum(bot) as bot FROM kmb WHERE strana='$strana'"));
$b3=mysql_fetch_array(qw("SELECT sum(bot) as bot FROM nauka WHERE strana='$strana'"));
$bt=$b1[bot]+$b2[bot]+$b3[bot];
$bn=mysql_fetch_array(qw("SELECT peh3,kon3,str3,puh3,tan3,sam3 FROM gos WHERE strana='$strana'"));

echo"Свободное население :<br>рабочие ($w[rab])<br>учёные ($w[bot])<br>пехота ($w[peh])<br>
кавалерия ($w[kon])<br>стрелки ($w[str])<br>пушки ($w[puh])<br>танки ($w[tan])<br>самолёты ($w[sam])<br>";
echo"Войска на войнах :<br>пехота ($wr[a])<br>кавалерия ($wr[b])<br>стрелки ($wr[c])<br>пушки ($wr[d])<br>
танки ($wr[e])<br>самолёты ($wr[f])<br>";
echo"Занятые рабочие ($rb),учёные($bt)<br/>";
echo"Войска в бункере :<br>пехота ($bn[peh3])<br>кавалерия ($bn[kon3])<br>стрелки ($bn[str3])<br>пушки ($bn[puh3])<br>
танки ($bn[tan3])<br>самолёты ($bn[sam3])<br>";
}
if($_GET[v]==20){
echo"<u>Удаление</u> :<br/>";
$wr[vrag]=$strana;
qw("DELETE FROM gos WHERE strana='$wr[vrag]'");
qw("DELETE FROM gos2 WHERE strana='$wr[vrag]'");
qw("DELETE FROM botan WHERE strana='$wr[vrag]'");
qw("DELETE FROM domik WHERE strana='$wr[vrag]'");
qw("DELETE FROM voyna WHERE strana='$wr[vrag]'");
qw("DELETE FROM kmb WHERE strana='$wr[vrag]'");
qw("DELETE FROM nauka WHERE strana='$wr[vrag]'");
qw("DELETE FROM rynok WHERE strana='$wr[vrag]'");
qw("DELETE FROM soyuz WHERE strana1='$wr[vrag]' or strana2='$wr[vrag]'");
qw("DELETE FROM sosed WHERE strana1='$wr[vrag]' or strana2='$wr[vrag]'");
qw("DELETE FROM nef WHERE strana='$wr[vrag]'");
qw("DELETE FROM mess WHERE komu='$wr[vrag]'");
qw("DELETE FROM res WHERE strana='$wr[vrag]'");
qw("DELETE FROM stroyka WHERE strana='$wr[vrag]'");
qw("DELETE FROM stroyka2 WHERE strana='$wr[vrag]'");
qw("UPDATE users SET kill='Вы удалены страной $re1[strana]' WHERE login=(SELECT login FROM gos WHERE strana ='$strana')");
echo"Гос-во $strana удалено!<br/>";
}
if($_GET[v]==22){
echo"<u>Сжигание ресурсов</u> :<br/>";
if(empty($_POST[a]) or empty($_POST[b])){
echo'<FORM ACTION="index.php?e=4&v=22&der='.$key.'&strana='.$_REQUEST[strana].'" METHOD="POST">';
?>Количество:<br/><input type="text" name="a" maxlength="15"><br/><?
echo 'Что сжигаем:<br/>
<select name="b">
<option value="1" selected="selected">Деньги</option>
<option value="2" >Железо</option>
<option value="3" >Камень</option>
<option value="4" >Дерево</option>
<option value="5" >Нефть</option>
<option value="6" >Зерно</option>
<option value="7" >Горы</option>
<option value="8" >Леса</option>
</select><br/>';?>
<INPUT TYPE='submit'VALUE='Cжечь'>
</FORM><br/><?
}else{
$sum=zif($_POST[a]);$res=zif($_POST[b]);
if($sum<1){header("Location: index.php?e=4&v=22&strana=$_GET[strana]&der=$key");}else{
switch($res){
case 1:
$r='dengi';$q='денег';
break;
case 2:
$r='metal';$q='железа';
break;
case 3:
$r='kamen';$q='камня';
break;
case 4:
$r='derevo';$q='дерева';
break;
case 5:
$r='neft';$q='нефти';
break;
case 6:
$r='zerno';$q='зерна';
break;
case 7:
$r='gora';$q='гор';
break;
case 8:
$r='lesa';$q='леса';
break;
}
$m=mysql_fetch_array(qw("SELECT $r FROM gos2 WHERE strana='$strana'"));
if($sum>$m[$r]){echo"Нет столько $q !<br/>";}else{
mysql_query("UPDATE gos2 SET `$r`=`$r`-'$sum' WHERE strana ='$strana'");
$dt1=date("d");$dt2=date("m");$dt3=date("H");$dt4=date("i");
mysql_query("INSERT INTO logistik (vid,data,strana,text) VALUES('22','[$dt1:$dt2]($dt3:$dt4)','$strana',
'[$re1[strana]] сжёг $sum $q')");
header("Location: index.php?e=4&v=23&strana=$_GET[strana]&der=$key&a=$sum&b=$q");
}
}}}
if($_GET[v]==23){
echo"<u>Сжигание ресурсов</u> :<br/>";
echo"Вы сожгли $_GET[a] $_GET[b]<br/>";
}
if($_GET[v]==24){
if(empty($_POST[text])){
echo'<FORM ACTION="index.php?e=4&v=24&strana='.$_GET[strana].'&der='.$key.'" METHOD=POST>';?>
Сообщение:
<br/>
<input type="text" name="text" maxlength="180"/><br/>
<INPUT TYPE='submit'VALUE='Написать'></FORM><br/><?
}else{
$dat=time();$y=$_POST[text];
if(!empty($y)){
$y=text($y);
mysql_query("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$_GET[strana]','$re1[strana]','$dat','0','1','$y')");
echo"Сообщение отправлено!<br/>";
}else{
echo"Уже отправлено!<br/>";}
}
}
////////////////////////////////////////////////////////////////////////////////////
}else{
echo"Нет такой страны[$strana][$_REQUEST[strana]]<br/>";
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
 if($_GET[e]==5){
 echo"<u>Общая статистика</u> :<br/>";
$sta1=mysql_query("SELECT COUNT(id)FROM gos ");$row1=mysql_fetch_row($sta1);{$tot1=$row1[0];}
echo"Стран на карте (<b>$tot1</b>)<br/>";
$sta1=mysql_query("SELECT COUNT(id)FROM users ");$row1=mysql_fetch_row($sta1);{$tot1=$row1[0];}
echo"Регистраций (<b>$tot1</b>)<br/>";
$sta1=mysql_query("SELECT COUNT(id)FROM users WHERE tema='1' ");$row1=mysql_fetch_row($sta1);{$tot1=$row1[0];}
echo"Стальная тема (<b>$tot1</b>)<br/>";
$sta1=mysql_query("SELECT COUNT(id)FROM users WHERE tema='2'");$row1=mysql_fetch_row($sta1);{$tot1=$row1[0];}
echo"Зелёная тема (<b>$tot1</b>)<br/>";
$sta1=mysql_query("SELECT COUNT(id)FROM users WHERE tema='3'");$row1=mysql_fetch_row($sta1);{$tot1=$row1[0];}
echo"Чёрная тема (<b>$tot1</b>)<br/>";
$sta1=mysql_query("SELECT COUNT(id)FROM users WHERE tema='4'");$row1=mysql_fetch_row($sta1);{$tot1=$row1[0];}
echo"Красная тема (<b>$tot1</b>)<br/>";
$sta1=mysql_query("SELECT COUNT(id)FROM users WHERE tema='5'");$row1=mysql_fetch_row($sta1);{$tot1=$row1[0];}
echo"Имперская тема (<b>$tot1</b>)<br/>";
$sta1=mysql_query("SELECT COUNT(id)FROM voyna ");$row1=mysql_fetch_row($sta1);{$tot1=$row1[0];}
echo"Войн (<b>$tot1</b>)<br/>";
$sta2=mysql_query("SELECT COUNT(id)FROM soyuz ");$row2=mysql_fetch_row($sta2);{$tot2=$row2[0];}$tot2=$tot2/2;
echo"Союзов (<b>$tot2</b>)<br/>";
$sta3=mysql_query("SELECT COUNT(id)FROM klan ");$row3=mysql_fetch_row($sta3);{$tot3=$row3[0];}
echo"Кланов (<b>$tot3</b>)<br/>";
}
echo'</div><div class="knews">';
?>|<a href='javascript:history.go(-1)'>Назад</a><br/><?
echo'<a href="index.php?der='.$key.'">В панель</a><br/>';
echo'<a href="../../game.php?der='.$key.'">В страну</a><br/>';
}else{ header("Location: ../../game.php?der=$key");}
require'../../sys/foot.php';
?>