
<?
    include './system/common.php';
    
 include './system/functions.php';
        
      include './system/user.php';
 
$id = _string(_num($_GET['id']));

if($id) {
  $uss= mysql_query('SELECT * FROM `access` WHERE `user` = "'.$id.'"');
  $uss = mysql_fetch_array($uss);
 
$us = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$id.'"');  
  $us= mysql_fetch_array($us);
}
if(!$us){header('location: /');exit;}

	   $title = $us['login'];
include './system/h.php';

$ady = mysql_query('SELECT * FROM `access` WHERE `user` = "'.$user['id'].'"');  
  $ady = mysql_fetch_array($ady);

  if(!$ady) {
    mysql_query('INSERT INTO `access` (`user`) VALUES ("'.$user['id'].'")');}
?>

    <div class="content"><div class="block center color3 s125"><a href="/user/<?=$us['id']?>"><?=$us['login']?></a>/ Печатки</div>
            <div class="line"></div>
<?
$pr=array('1'=>'30000','2'=>'50000','3'=>'70000','4'=>'90000','5'=>'110000');

$lvlup=array('1'=>'70','2'=>'100','3'=>'120','4'=>'135','5'=>'150');

$resy=array('1'=>'2100000','2'=>'5000000','3'=>'8400000','4'=>'12150000','5'=>'16500000');

$resy0=array('1'=>'15000','2'=>'25000','3'=>'35000','4'=>'45000','5'=>'55000');

$kas=array('1'=>'12','2'=>'17','3'=>'29','4'=>'63','5'=>'153');

$aren=array('1'=>'108','2'=>'164','3'=>'612','4'=>'4196','5'=>'32868');

$podv=array('1'=>'108','2'=>'164','3'=>'612','4'=>'4196','5'=>'32868');

$days=array('1'=>'5','2'=>'10','3'=>'15','4'=>'20','5'=>'25');

$days2=array('1'=>'5','2'=>'10','3'=>'15','4'=>'20','5'=>'25');

if($user['id'] == $uss['user']){
if(isset($_GET['z1']) && $uss['b1']==0 && _timp($user['timon'])>= $days[1] && $user['pod']>= $podv[1] && $user['aren']>= $aren[1] && $user['skill']>= $kas[1] && $user['s']>= $resy[1] && $user['g']>= $resy0[1] && $user['level']>= $lvlup[1]){

mysql_query('UPDATE `users` SET `str` = `str` + '.$pr[1].',`vit`=`vit` + '.$pr[1].',`def`=`def` + '.$pr[1].',`g`=`g` - '.$resy0[1].',`s`=`s` - '.$resy[1].',`aren`="0",`pod`= "0" WHERE `id` = \''.$user['id'].'\'');
mysql_query('UPDATE `access` SET `b1` = "1",`time1` = "'.time().'" WHERE `user` = "'.$user['id'].'"');

echo "<div class='alert'><div><div>
<div class='green s125'>Бонус</div></div><div class='a_separator'></div><div>                                     <div class='blue'>+$pr[1]
 к параметрам:</div>
</div></div></div>";
}}
if($user['id'] == $uss['user']){
if(isset($_GET['z2']) && $uss['b2']==0 && _timp($user['timon'])>= $days[2] && $user['pod']>= $podv[2] && $user['aren']>= $aren[2] && $user['skill']>= $kas[2] && $user['s']>= $resy[2] && $user['g']>= $resy0[2] && $user['level']>= $lvlup[2]){

mysql_query('UPDATE `users` SET `str` = `str` + '.$pr[2].',`vit`=`vit` + '.$pr[2].',`def`=`def` + '.$pr[2].',`g`=`g` - '.$resy0[2].',`s`=`s` - '.$resy[2].',`aren`="0",`pod`="0" WHERE `id` = \''.$user['id'].'\'');
mysql_query('UPDATE `access` SET `b2` = "1",`time2` = "'.time().'" WHERE `user` = "'.$user['id'].'"');

echo "<div class='alert'><div><div>
<div class='green s125'>Бонус</div></div><div class='a_separator'></div><div>                                     <div class='blue'>+$pr[2]
 к параметрам:</div>
</div></div></div>";
}}
if($user['id'] == $uss['user']){
if(isset($_GET['z3']) && $uss['b3']==0 && _timp($user['timon'])>= $days[3] && $user['pod']>= $podv[3] && $user['aren']>= $aren[3] && $user['skill']>= $kas[3] && $user['s']>= $resy[3] && $user['g']>= $resy0[3] && $user['level']>= $lvlup[3]){

mysql_query('UPDATE `users` SET `str` = `str` + '.$pr[3].',`vit`=`vit` + '.$pr[3].',`def`=`def` + '.$pr[3].', `g`=`g` - '.$resy0[3].',`s`=`s` - '.$resy[3].',`aren`="0",`pod`="0" WHERE `id` = \''.$user['id'].'\'');
mysql_query('UPDATE `access` SET `b3` = "1",`time3` = "'.time().'" WHERE `user` = "'.$user['id'].'"');

echo "<div class='alert'><div><div>
<div class='green s125'>Бонус</div></div><div class='a_separator'></div><div>                                     <div class='blue'>+$pr[3]
 к параметрам:</div>
</div></div></div>";
}}
if($user['id'] == $uss['user']){
if(isset($_GET['z4']) && $uss['b4']==0 && _timp($user['timon'])>= $days[4] && $user['pod']>= $podv[4] && $user['aren']>= $aren[4] && $user['skill']>= $kas[4] && $user['s']>= $resy[4] && $user['g']>= $resy0[4] && $user['level']>= $lvlup[4]){

mysql_query('UPDATE `users` SET `str` = `str` + '.$pr[4].',`vit`=`vit` + '.$pr[4].',`def`=`def` + '.$pr[4].', `g`=`g` - '.$resy0[4].',`s`=`s` - '.$resy[4].',`aren`="0",`pod`="0" WHERE `id` = \''.$user['id'].'\'');
mysql_query('UPDATE `access` SET `b4` = "1",`time4` = "'.time().'" WHERE `user` = "'.$user['id'].'"');

echo "<div class='alert'><div><div>
<div class='green s125'>Бонус</div></div><div class='a_separator'></div><div>                                     <div class='blue'>+$pr[4]
 к параметрам:</div>
</div></div></div>";
}}
if($user['id'] == $uss['user']){
if(isset($_GET['z5']) && $uss['b5']==0 && _timp($user['timon'])>= $days[5] && $user['pod']>= $podv[5] && $user['aren']>= $aren[5] && $user['skill']>= $kas[1] && $user['s']>= $resy[5] && $user['g']>= $resy0[5] && $user['level']>= $lvlup[5]){

mysql_query('UPDATE `users` SET `str` = `str` + '.$pr[5].',`vit`=`vit` + '.$pr[5].',`def`=`def` + '.$pr[5].',`g`=`g` - '.$resy0[5].',`s`=`s` - '.$resy[5].',`aren`="0",`pod`="0" WHERE `id` = \''.$user['id'].'\'');
mysql_query('UPDATE `access` SET `b5` = "1",`time5` = "'.time().'" WHERE `user` = "'.$user['id'].'"');

echo "<div class='alert'><div><div>
<div class='green s125'>Бонус</div></div><div class='a_separator'></div><div>                                     <div class='blue'>+$pr[5]
 к параметрам:</div>
</div></div></div>";
}}



for($i = 1; $i <= 5; $i++){
?>
<div class="block center">
    <img src="/images/accessories/<?=$i?>.png" width="64" height="64" alt=""></div>
<div class="dotted"></div>
<div class="block center">
    Бонус: <span class="green">+<?=$pr[$i]?> к параметрам</span>
</div>
    <div class="dotted"></div>
<?
if($uss['b'.$i]==0){
?>
    <div class="block center">
        <div class="bold">Для получения необходимо:</div>
        <div class="m3"></div>
                    <div></div>
           <?=($us['level']>= $lvlup[$i] ? '<img src=\'/images/icons/ok.png\'>':'<img src=\'/images/icons/cross.png\'>')?>          Достичь уровня: <span class="green">(<?=$us['level']?> из <?=$lvlup[$i]?>)</span>
                            <div></div>
             <?=($us['g']>= $resy0[$i] ? '<img src=\'/images/icons/ok.png\'>':'<img src=\'/images/icons/cross.png\'>')?>           Деньги: <span class="green">(<img src="/images/icons/silver.png" width="16" height="16" alt=""><?=$us['s']?> <img src="/images/icons/gold.png" width="16" height="16" alt=""><?=$us['g']?>  из
                <img src="/images/icons/silver.png" width="16" height="16" alt=""><?=$resy[$i]?> <img src="/images/icons/gold.png" width="16" height="16" alt=""><?=$resy0[$i]?> )</span>
                            <div></div>
             <?=($us['skill']>= $kas[$i] ? '<img src=\'/images/icons/ok.png\'>':'<img src=\'/images/icons/cross.png\'>')?>           Качалка: <span class="green">(<?=$us['skill']?> из
                <?=$kas[$i]?>)</span>
                            <div></div>
             <?=($us['aren']>= $aren[$i] ? '<img src=\'/images/icons/ok.png\'>':'<img src=\'/images/icons/cross.png\'>')?>           Побед на арене: <span class="green">(<?=$us['aren']?> из
                <?=$aren[$i]?>)</span>
                            <div></div>
               <?=($us['pod']>= $podv[$i] ? '<img src=\'/images/icons/ok.png\'>':'<img src=\'/images/icons/cross.png\'>')?>         Побед в подвале: <span class="green">(<?=$us['pod']?> из
                <?=$podv[$i]?>)</span>
                            <div></div>
            <?=(_timp($us['timon'])>= $days[$i] ? '<img src=\'/images/icons/ok.png\'>':'<img src=\'/images/icons/cross.png\'>')?>            Онлайн дней: <span class="green">(<?=_timp($us['timon'])?> из
                <?=$days[$i]?>)</span>
<?
if($user['id'] == $uss['user']){
if($uss['b'.$i]==0 && _timp($user['timon'])>= $days[$i] && $user['pod']>= $podv[$i] && $user['aren']>= $aren[$i] && $user['skill']>= $kas[$i] && $user['s']>= $resy[$i] && $user['g']>= $resy0[$i] && $user['level']>= $lvlup[$i]){
?>
</br><span class="btn_start"><span class="btn_end"><a class="btn" href="?z<?=$i?>">Забрать</a></span> </span>
<?}}}else{?>
<div class="block center">
<span class="green">Получено <?=(date('d ', $uss['time'.$i]). $monthes[(date('n', $uss['time'.$i]))]);?> </span>
<?}?>
            </div>
        <div class="line"></div>

<?}?>
</div>
           
<?
include './system/f.php';
?>