<?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{
	$pl=$_GET['p'];
	$q = mysql_query("SELECT * FROM `planet` WHERE `id`='".check(mysql_real_escape_string($pl))."'");
	$f = mysql_fetch_array($q);
			switch ($act) {
	default:
	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="razd"></div>';
	echo '<div class="top-nav1"><b>Добыча ресурсов</b></div>';
	echo '<div class="razd"></div>';
	$PAGINGS = mysql_query("SELECT * FROM `planet` WHERE `uid` = '".$use_id."' ORDER BY `id` ASC");
	if($PAGINGS > 0)
	{
		while($row = mysql_fetch_array($PAGINGS))
		{

	echo '<center><div class="ch">';		
	echo '<a href="sector.php?x='.$row['x'].'&amp;y='.$row['y'].'"><img src="../images/planet_small/'.$row['type'].'.jpg" alt="" /></a> <a href="?act=list&amp;p='.$row['id'].'">'.$row['name'].'</a> [x:'.$row['x'].' y:'.$row['y'].']';
	echo '</div></center>';	
	}

	}
	break;
	case 'list':
	echo "<title>Планета ".$f['name']."</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="razd"></div>';
	echo '<div class="top-nav1"><b>Планета '.$f['name'].'</b></div>';
	echo '<div class="razd"></div>';
	echo '<div class="top-nav"><img src="/images/images_main/metall.png" width="25px" alt="" /> <a href="?act=pl&amp;p='.$f['id'].'&amp;t=2"><b>Металл</b></a></div><div class="top-nav"><img src="/images/images_main/minerall.png" width="25px"  alt="" /> <a href="?act=pl&amp;p='.$f['id'].'&amp;t=3"><b>Минерал</b></a></div><div class="top-nav"><img src="/images/images_main/gelium.png" width="25px"  alt="" /> <a href="?act=pl&amp;p='.$f['id'].'&amp;t=4"><b>Гелий</b></a></div><div class="top-nav"><img src="/images/images_main/energi.png" width="25px alt="" /> <a href="?act=pl&amp;p='.$f['id'].'&amp;t=5"><b>Энергия</b></a></div><div class="top-nav"><img src="/images/images_main/ozon.png" width="25px" alt="" /> <a href="?act=pl&amp;p='.$f['id'].'&amp;t=6"><b>Озон</b></a></div><div class="top-nav"><img src="/images/images_main/trit.png" width="25px"  alt="" /> <a href="?act=pl&amp;p='.$f['id'].'&amp;t=7"><b>Тритий</b></a></div>';
	echo '<div class="razd"></div>';
	echo '<div class="blok"><a href="res.php"><b>Назад</b></a></div>';
	break;
	case 'pl':
	$tres=$_GET['t'];
	if($f['uid']==$use_id AND $tres!='' AND $tres>=2 AND $tres<=7){
	echo "<title>Планета ".$f['name']."</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="razd"></div>';
	echo '<div class="top-nav1"><b>Планета '.$f['name'].'</b></div>';
	echo '<div class="razd"></div>';

	$PAGINGS = mysql_query("SELECT * FROM `planet_loc` WHERE `uid` = '".$use_id."' AND `planet_id`='".$f['id']."' AND `occupy`=0 AND `type`='".check($tres)."'");
	if($PAGINGS > 0)
	{
		while($row = mysql_fetch_array($PAGINGS))
		{
	$s='s'.$row['type'].'';	
	$science = mysql_result(mysql_query("SELECT ($s) FROM `science` WHERE `planet_id`='".$f['id']."';"), 0);
	echo '<div class="ch">';
	echo '<a href="production.php?p='.$row['planet_id'].'&amp;l='.$row['id'].'">'.res($row['type']).'</a>: <font color="#4EEE94">['.$row['res'].']</font>(-'.$row['rab'].'/+'.$row['rab']*($science*0.3).')<div class="razd"></div>'.rab($rasa).': '.$row['rab'].'';	
	echo '</div>';	
	}

	}
	echo '<div class="razd"></div>';
	echo '<div class="blok"><a href="res.php"><b>Назад</b></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';
?>