<?php
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';
$set['title']='Авторитет на зоне';
include_once '../../sys/inc/thead.php';
title();
aut();
################################################################################
if(!isset($user)){
header("Location:/aut.php");
break;
}
$arr=mysql_fetch_array(mysql_query("SELECT * FROM `zona` WHERE `ids`='$user[id]'"));
################################################################################
function sictime($timediff){
$oneMinute=60;
$oneHour=60*60;
$oneDay=60*60*24;
$dayfield=floor($timediff/$oneDay);
$hourfield=floor(($timediff-$dayfield*$oneDay)/$oneHour);
$minutefield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour)/$oneMinute);
$secondfield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour-$minutefield*$oneMinute));
$time_1="$dayfield";
return $time_1;
}
################################################################################
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `zona` WHERE `ids`='".$user['id']."'"),0)=='0'){
mysql_query("INSERT INTO `zona`(`ids`, `time_sila`, `date_reg`) VALUES('".$user['id']."', '".time()."', '".time()."')");
header("location:index.php?".$passgen."");
exit;
}


if(mysql_result(mysql_query("SELECT COUNT(*) FROM `zona` WHERE `ids`='".$user['id']."'"),0)=='0'){
mysql_query("INSERT INTO `zona`(`ids`, `time_sila`, `date_reg`) VALUES('".$user['id']."', '".time()."', '".time()."')");
header("location:index.php?".$passgen."");
exit;
}


$vrem=1;

if(time($vrem)>($arr['zona_time']+$vrem)){

mysql_query("UPDATE `user` SET `energiy`=`energiy`+1,`zona_time`='".time()."' WHERE `ids`='".$user['id']."'");

}


################################################################################
$all_zona=mysql_fetch_array(mysql_query("SELECT * FROM `zona` WHERE `ids`='$user[id]'"));

echo "<center>";

echo "<div class='f1'>";

echo "<table border='1'>";
echo "<tr>\n";
echo "<td>\n";  
//
if($all_zona['time_sila']<time()){
echo "<a href='av.php?id=".$all_zona['id']."'><img src='img/1.gif'></a>\n";
}
else
{
echo "<a href='av.php?id=".$all_zona['id']."'><img src='img/1_1.png'></a>\n";
}
//
echo "</td>\n";
echo "<td>\n";
//
if($all_zona['time_lovkost']<time()){
echo "<a href='av2.php?id=".$all_zona['id']."'><img src='img/2.gif'></a>\n";
}
else
{
echo "<a href='av2.php?id=".$all_zona['id']."'><img src='img/2_2.png'></a>\n";
}
//
echo "</td>\n";
echo "<td>\n";
//
if($all_zona['time_lovkost2']<time()){
echo "<a href='av3.php?id=".$all_zona['id']."'><img src='img/3.gif'></a>\n";
}
else
{
echo "<a href='av3.php?id=".$all_zona['id']."'><img src='img/3_3.png'></a>\n";
}
//
echo "</td>\n";
echo "<td>\n";
//
if($all_zona['time_lovkost3']<time()){
echo "<a href='av4.php?id=".$all_zona['id']."'><img src='img/4.gif'></a>\n";
}
else
{
echo "<a href='av4.php?id=".$all_zona['id']."'><img src='img/4_4.png'></a>\n";
}
//
echo "</td>\n";
echo "<td>\n";
//
if($all_zona['time_lovkost4']<time()){
echo "<a href='av5.php?id=".$all_zona['id']."'><img src='img/5.gif'></a>\n";
}
else
{
echo "<a href='av5.php?id=".$all_zona['id']."'><img src='img/5_5.png'></a>\n";
}
//
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";

echo "</div>";
################################################################################
echo "</center>";
################################################################################
echo "<center>";
echo "<div class='glav'>";
################################################################################
if($all_zona['sila']>=0 && $all_zona['sila']<=50)echo " <img src='images/0.png'>\n";
if($all_zona['sila']>=51 && $all_zona['sila']<=100)echo " <img src='images/1.png'>\n";
if($all_zona['sila']>=101 && $all_zona['sila']<=150)echo " <img src='images/2.png'>\n";
if($all_zona['sila']>=151 && $all_zona['sila']<=200)echo " <img src='images/3.png'>\n";
if($all_zona['sila']>=201 && $all_zona['sila']<=250)echo " <img src='images/5.png'>\n";
if($all_zona['sila']>=251 && $all_zona['sila']<=300)echo " <img src='images/6.png'>\n";
if($all_zona['sila']>=301 && $all_zona['sila']<=350)echo " <img src='images/7.png'>\n";
if($all_zona['sila']>=351 && $all_zona['sila']<=400)echo " <img src='images/8.png'>\n";
if($all_zona['sila']>=401 && $all_zona['sila']<=450)echo " <img src='images/9.png'>\n";
if($all_zona['sila']>=451 && $all_zona['sila']<=500)echo " <img src='images/10.png'>\n";
if($all_zona['sila']>=501 && $all_zona['sila']<=550)echo " <img src='images/11.png'>\n";
if($all_zona['sila']>=551 && $all_zona['sila']<=600)echo " <img src='images/12.png'>\n";
if($all_zona['sila']>=601 && $all_zona['sila']<=650)echo " <img src='images/13.png'>\n";
if($all_zona['sila']>=651 && $all_zona['sila']<=700)echo " <img src='images/14.png'>\n";
if($all_zona['sila']>=701 && $all_zona['sila']<=750)echo " <img src='images/15.png'>\n";
if($all_zona['sila']>=751 && $all_zona['sila']<=800)echo " <img src='images/16.png'>\n";
if($all_zona['sila']>=801 && $all_zona['sila']<=850)echo " <img src='images/17.png'>\n";
if($all_zona['sila']>=851 && $all_zona['sila']<=900)echo " <img src='images/18.png'>\n";
if($all_zona['sila']>=901 && $all_zona['sila']<=950)echo " <img src='images/19.png'>\n";
if($all_zona['sila']>=951 && $all_zona['sila']<=1000)echo " <img src='images/20.png'>\n";
if($all_zona['sila']>=1001 && $all_zona['sila']<=1050)echo " <img src='images/21.png'>\n";
if($all_zona['sila']>=1051 && $all_zona['sila']<=1100)echo " <img src='images/22.png'>\n";
if($all_zona['sila']>=1101 && $all_zona['sila']<=1150)echo " <img src='images/23.png'>\n";
if($all_zona['sila']>=1151 && $all_zona['sila']<=1200)echo " <img src='images/24.png'>\n";
if($all_zona['sila']>=1201 && $all_zona['sila']<=1250)echo " <img src='images/25.png'>\n";
if($all_zona['sila']>=1251 && $all_zona['sila']<=1300)echo " <img src='images/26.png'>\n";
if($all_zona['sila']>=1301 && $all_zona['sila']<=1350)echo " <img src='images/27.png'>\n";
if($all_zona['sila']>=1351 && $all_zona['sila']<=1400)echo " <img src='images/28.png'>\n";
if($all_zona['sila']>=1401 && $all_zona['sila']<=1450)echo " <img src='images/29.png'>\n";
if($all_zona['sila']>=1451 && $all_zona['sila']<=99999999999999999999999999)echo " <img src='images/30.png'>\n";
echo "</div>";
################################################################################
echo "</center>\n";

/*
###
echo "<div class='f1'>";
echo "<img src='img/on.png'> <a href='online.php'>Онлайн (";
echo mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `date_last` > '".(time()-600)."' AND `url` like '/zona/%'"), 0).')<br /></a>';
$zakl=mysql_result(mysql_query("SELECT COUNT(*) FROM `zona`",$db), 0);
echo "<img src='img/zak.png'> <a href='user.php'>Все заключенные (".$zakl.")</a>\n";
echo "</div>";
*/





echo "<div class='f1'>";

echo "<table border='1'>";
echo "<tr>\n";
//
echo "<td>\n";
echo "Авторитет: ".$all_zona['sila']."<br />\n";
echo "День отсидки: ".sictime(time()-$all_zona['date_reg'])."<hr/>\n";
echo "<a href='shop.php'><img src='img/shop.png'></a><br />\n";
echo "</td>\n";
echo "<td>\n";
echo "<a href='top.php'>ТОП</a><hr/>\n";
echo "<a href='user.php'>ВСЕ</a>\n";
echo "</td>\n";
//
echo "<td>\n";
echo "Энергии: $all_zona[energiy]<br /><hr/>";
echo "<a href='toomb.php'><img src='img/tumb.png'></a><br />\n";
echo "</td>\n";
//
echo "<td>\n";
echo "<a href='go.php'><img src='img/nadvijuxa.png'></a><br />\n";
echo "</td>\n";

echo "</tr>\n";
echo "</table>\n";

echo "</div>";








include_once '../../sys/inc/tfoot.php';
?>