<?
if($ku['id']==1)
{
error_reporting(0); // включаем показ ошибок
ini_set('display_errors',true); // включаем показ ошибок
}
if(empty($ku['ikonka'])){$ku['ikonka']=2;}
mysql_querll("DELETE FROM `kolhoz_mail` WHERE `time` < '".($time-(3600*24*30))."'");

mysql_querll("DELETE FROM `kolhoz_warehouse` WHERE `count` = '0'");
mysql_querll("UPDATE `kolhoz_user` SET `date_last` = '$time' WHERE `id` = '$ku[id]' LIMIT 1");

$timeactiv=$time-$ku['date_last'];
if($timeactiv < 120)
{
$newtimeactiv=$ku['time']+$timeactiv;
mysql_querll("UPDATE `kolhoz_user` SET `time` ='$newtimeactiv' WHERE `id` = '$ku[id]' LIMIT 1");
}
include_once 'q_animals.php';
// Collective
if(mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_collective_user` WHERE `id_user` = '$ku[id]'"),0)!=0)
{
$mcu=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_collective_user` WHERE `id_user` = '$ku[id]'"));
$mc=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_collective` WHERE `id` = '$mcu[id_collective]'"));
$mc['next_level']=$mc['level']+1;
$mc['flowerbed_max']=$mc['level']*10;
$mc['users_max']=($mc['level']*5)+10+$mc['users_add'];
$mc['users']=mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_collective_user` WHERE `id_collective` = '$mc[id]'"),0);
}
include_once 'gos_start.php';
if($ku['expdouble']==NULL)
{
$rand=rand(1,7);
if($rand==1)$day='Mon';elseif($rand==2)$day='Tue';elseif($rand==3)$day='Wed';elseif($rand==4)$day='Thu';elseif($rand==5)$day='Fri';elseif($rand==6)$day='Sat';else $day='Sun';
mysql_querll("UPDATE `kolhoz_user` SET `expdouble` = '$day' WHERE `id` = '$ku[id]'");
$ku['expdouble']=$day;
}
if($ku['expdouble']==date("D"))$dexp=1;
$ku['mdp']=md5($ku['password']);
$ku['autologin']=update_ku('autologin',md5("nick:".$ku['nick'].",password:".$ku['password'].",id:".$ku['id'].""));
if(isset($_GET['outlogin']) && hsc($_GET['outlogin'])==$ku['mdp'])
{
unset($_SESSION['id_user']);
header("Location: http://$_SERVER[HTTP_HOST]");
exit;
}
if(mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_ban` WHERE `id_user` = '$ku[id]' AND `izg` = '1' LIMIT 1"),0)!=0 && (!isset($_GET['user']) || isset($_GET['user']) && $_GET['user']!=$ku['id'])){header("Location:?user=$ku[id]&bans");exit;}
if(mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_ban` WHERE `id_user` = '$ku[id]' AND `time` > '$time' AND `izg` = '0' LIMIT 1"),0)!=0)$molchi=1;
$ban=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_ban` WHERE `id_user` = '$ku[id]' AND `time` > '$time' AND `izg` = '0' ORDER BY `id` DESC LIMIT 1"));
$us_ban=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_user` WHERE `id` = '$ban[id_who]'"));
?>