<?php

require_once '../includes/start.php';
require_once '../includes/function.php';
require_once '../includes/header1.php';

if($game==0 OR $level==0 OR $ban!=0){
		echo "<title>Доступ закрыт!!!</title>";
	 	echo "<script type=\"text/javascript\">createPopup().show( 0, 0, 0, 0, 0 );</script>";
	 	echo "<body oncontextmenu=\"return false;\"><body onselectstart='return false' oncopy='return false'><body onselectstart=\"return false\" oncopy=\"return false\"><body onload=\"digitalWatch()\">";
		echo '<div class="blok3"><img src="/images/errors.png" width="200px"/></div><div class="blok3"><b>Вы не авторизованный или заблокированный пользователь или вы не достигли условий для доступа на страницу!!!</b><br/><a href="/?sign_in=1"><font color="#4EEE94"><b>Авторизуйтесь</font></a></b> или <a href="/reg.php"><font color="#4EEE94"><b>Зарегистрируйтесь</b></font></a></div>';
}else{
$a1=$_GET['a1'];
$a2=$_GET['a2'];
$s = mysql_query("SELECT * FROM `army` WHERE `id`='".check(mysql_real_escape_string($a1))."'");
$a1 = mysql_fetch_array($s);
$q = mysql_query("SELECT * FROM `army` WHERE `id`='".check(mysql_real_escape_string($a2))."'");
$a2 = mysql_fetch_array($q);
		$units=$a2['u1']+$a2['u2']+$a2['u3']+$a2['u4']+$a2['u5']+$a2['u6']+$a2['u7']+$a2['u8']+$a2['u9']+$a2['u10']+$a2['u11']+$a2['u12'];
		$units1=$a2['u8']+$a2['u9']+$a2['u10']+$a2['u11']+$a2['u12'];
		$units2=$a2['u1']+$a2['u2']+$a2['u3']+$a2['u4'];
		$units3=$a2['u5']+$a2['u6']+$a2['u7'];
	switch ($act) {
	default:
	if($a1['onpl']==$a2['onpl'] AND $a1['xpl']==$a2['xpl'] AND $a1['ypl']==$a2['ypl'] AND $a1['uid']!=$a2['uid'] AND (($a1['fr_id']==$a2['fr_id'] AND $a1['fr_id']==0 AND $a2['fr_id']==0) OR ($a1['fr_id']!=$a2['fr_id'] AND $a1['fr_id']!=0 AND $a2['fr_id']==0) OR ($a1['fr_id']!=$a2['fr_id'] AND $a1['fr_id']==0 AND $a2['fr_id']!=0) OR ($a1['fr_id']!=$a2['fr_id'] AND $a1['fr_id']!=0 AND $a2['fr_id']!=0))){
	div('<a href="../game/pl_army.php?a='.$a1['id'].'">Отряд '.$a1['name'].'</a> | Разведка отряда','top');
	echo '<div class="cont">Отряд <span class="'.crasa($a2['rasa']).'">'.$a2['name'].'</span> ';
	if($a2['fr_id']==$fr_id AND $fr_id!=0 AND $a2['uid']!=$use_id)echo '[<span class="blue">союзник</span>]';
	if($a2['uid']!=$use_id AND (($a1['fr_id']==$a2['fr_id'] AND $a1['fr_id']==0 AND $a2['fr_id']==0) OR ($a1['fr_id']!=$a2['fr_id'] AND $a1['fr_id']!=0 AND $a2['fr_id']==0) OR ($a1['fr_id']!=$a2['fr_id'] AND $a1['fr_id']==0 AND $a2['fr_id']!=0)))echo '[<span class="red">противник</span>]';
	echo '<br/>Расположение x:'.$a2['xpl'].' y:'.$a2['ypl'].'</div>';
	if($units1!=0){
	echo '<div class="top">Воздушные войска</div><div class="conts">';
	if($a2['u8']!=0)echo ''.rasa($a2['rasa']).' '.units(8, $a2['rasa']).': '.$a2['u8'].'<br/>';
	if($a2['u9']!=0)echo ''.rasa($a2['rasa']).' '.units(9, $a2['rasa']).': '.$a2['u9'].'<br/>';
	if($a2['u10']!=0)echo ''.rasa($a2['rasa']).' '.units(10, $a2['rasa']).': '.$a2['u10'].'<br/>';
	if($a2['u11']!=0)echo ''.rasa($a2['rasa']).' '.units(11, $a2['rasa']).': '.$a2['u11'].'<br/>';
	if($a2['u12']!=0)echo ''.rasa($a2['rasa']).' '.units(12, $a2['rasa']).': '.$a2['u12'].'<br/>';
	echo '</div>';}
	if($units2!=0){
	echo '<div class="top">Легкие наземные войска</div>';
	echo '<div class="conts">';
	if($a2['u1']!=0)echo ''.rasa($a2['rasa']).' '.units(1, $a2['rasa']).': '.$a2['u1'].'<br/>';
	if($a2['u2']!=0)echo ''.rasa($a2['rasa']).' '.units(2, $a2['rasa']).': '.$a2['u2'].'<br/>';
	if($a2['u3']!=0)echo ''.rasa($a2['rasa']).' '.units(3, $a2['rasa']).': '.$a2['u3'].'<br/>';
	if($a2['u4']!=0)echo ''.rasa($a2['rasa']).' '.units(4, $a2['rasa']).': '.$a2['u4'].'<br/>';
	echo '</div>';}
	if($units3!=0){
	echo '<div class="top">Тяжелые наземные войска</div>';
	echo '<div class="conts">';
	if($a2['u5']!=0)echo ''.rasa($a2['rasa']).' '.units(5, $a2['rasa']).': '.$a2['u5'].'<br/>';
	if($a2['u6']!=0)echo ''.rasa($a2['rasa']).' '.units(6, $a2['rasa']).': '.$a2['u6'].'<br/>';
	if($a2['u7']!=0)echo ''.rasa($a2['rasa']).' '.units(7, $a2['rasa']).': '.$a2['u7'].'<br/>';
	echo '</div>';}
	if($a2['uid']!=$use_id AND(($a1['fr_id']==$a2['fr_id'] AND $a1['fr_id']==0 AND $a2['fr_id']==0) OR ($a1['fr_id']!=$a2['fr_id'] AND $a1['fr_id']!=0 AND $a2['fr_id']==0) OR ($a1['fr_id']!=$a2['fr_id'] AND $a1['fr_id']==0 AND $a2['fr_id']!=0) OR ($a1['fr_id']!=$a2['fr_id'] AND $a1['fr_id']!=0 AND $a2['fr_id']!=0))){

	if($a1['time']>=$realtime){echo '<div class="top"><img src="../images/time.gif" alt="image" /> Отдых '. intval(($a1['time']-$realtime)/60) .' минут</div>';}else{
	echo '<div class="top"><img src="../images/war.jpg" alt="image" /> <a href="ataka.php?a1='.$a1['id'].'&amp;a2='.$a2['id'].'">Атаковать отряд</a></div>';}}
	echo '<div class="conts"><a href="../game/pl_army.php?act=loc&a='.$a1['id'].'"><<Назад</a></div>';
	}
	break;
	}
}
echo '<div class="razd"></div>';
echo '<center><div class="blok2"><a href="../"><b>На Главную</b></a></div></center>';
echo '<div class="razd"></div>';
require_once '../includes/footer1.php';
?>
