<?

///TEHNIKA

if($ku['tehnika']>=50)
{
mysql_query("UPDATE `kolhoz_user` SET `tdlevel` = '5' WHERE `id` = '$ku[id]'");
}
elseif($ku['tehnika']>=40)
{
mysql_query("UPDATE `kolhoz_user` SET `tdlevel` = '4' WHERE `id` = '$ku[id]'");
}
elseif($ku['tehnika']>=30)
{
mysql_query("UPDATE `kolhoz_user` SET `tdlevel` = '3' WHERE `id` = '$ku[id]'");
}
elseif($ku['tehnika']>=20)
{
mysql_query("UPDATE `kolhoz_user` SET `tdlevel` = '2' WHERE `id` = '$ku[id]'");
}
elseif($ku['tehnika']>=10)
{
mysql_query("UPDATE `kolhoz_user` SET `tdlevel` = '1' WHERE `id` = '$ku[id]'");
}
///SADOVOD
if($ku['sadovod']>=50000)
{
mysql_query("UPDATE `kolhoz_user` SET `sdlevel` = '5' WHERE `id` = '$ku[id]'");
}
elseif($ku['sadovod']>=10000)
{
mysql_query("UPDATE `kolhoz_user` SET `sdlevel` = '4' WHERE `id` = '$ku[id]'");
}
elseif($ku['sadovod']>=2500)
{
mysql_query("UPDATE `kolhoz_user` SET `sdlevel` = '3' WHERE `id` = '$ku[id]'");
}
elseif($ku['sadovod']>=500)
{
mysql_query("UPDATE `kolhoz_user` SET `sdlevel` = '2' WHERE `id` = '$ku[id]'");
}
elseif($ku['sadovod']>=100)
{
mysql_query("UPDATE `kolhoz_user` SET `sdlevel` = '1' WHERE `id` = '$ku[id]'");
}
///VODOLEY
if($ku['vodoley']>=50000)
{
mysql_query("UPDATE `kolhoz_user` SET `vdlevel` = '5' WHERE `id` = '$ku[id]'");
}
elseif($ku['vodoley']>=10000)
{
mysql_query("UPDATE `kolhoz_user` SET `vdlevel` = '4' WHERE `id` = '$ku[id]'");
}
elseif($ku['vodoley']>=2500)
{
mysql_query("UPDATE `kolhoz_user` SET `vdlevel` = '3' WHERE `id` = '$ku[id]'");
}
elseif($ku['vodoley']>=500)
{
mysql_query("UPDATE `kolhoz_user` SET `vdlevel` = '2' WHERE `id` = '$ku[id]'");
}
elseif($ku['vodoley']>=100)
{
mysql_query("UPDATE `kolhoz_user` SET `vdlevel` = '1' WHERE `id` = '$ku[id]'");
}
///AGRONOM
if($ku['agronom']>=50000)
{
mysql_query("UPDATE `kolhoz_user` SET `agdlevel` = '5' WHERE `id` = '$ku[id]'");
}
elseif($ku['agronom']>=10000)
{
mysql_query("UPDATE `kolhoz_user` SET `agdlevel` = '4' WHERE `id` = '$ku[id]'");
}
elseif($ku['agronom']>=2500)
{
mysql_query("UPDATE `kolhoz_user` SET `agdlevel` = '3' WHERE `id` = '$ku[id]'");
}
elseif($ku['agronom']>=500)
{
mysql_query("UPDATE `kolhoz_user` SET `agdlevel` = '2' WHERE `id` = '$ku[id]'");
}
elseif($ku['agronom']>=100)
{
mysql_query("UPDATE `kolhoz_user` SET `agdlevel` = '1' WHERE `id` = '$ku[id]'");
}
///gifter
$ku['gifter']=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_gifts` WHERE `id_kont` = '$ku[id]'"),0);
if($ku['gifter']>=100)
{
mysql_query("UPDATE `kolhoz_user` SET `gdlevel` = '5' WHERE `id` = '$ku[id]'");
}
elseif($ku['gifter']>=50)
{
mysql_query("UPDATE `kolhoz_user` SET `gdlevel` = '4' WHERE `id` = '$ku[id]'");
}
elseif($ku['gifter']>=25)
{
mysql_query("UPDATE `kolhoz_user` SET `gdlevel` = '3' WHERE `id` = '$ku[id]'");
}
elseif($ku['gifter']>=10)
{
mysql_query("UPDATE `kolhoz_user` SET `gdlevel` = '2' WHERE `id` = '$ku[id]'");
}
elseif($ku['gifter']>=5)
{
mysql_query("UPDATE `kolhoz_user` SET `gdlevel` = '1' WHERE `id` = '$ku[id]'");
}
///botanik
if($ku['botanik']>=5000)
{
mysql_query("UPDATE `kolhoz_user` SET `bdlevel` = '5' WHERE `id` = '$ku[id]'");
}
elseif($ku['botanik']>=1000)
{
mysql_query("UPDATE `kolhoz_user` SET `bdlevel` = '4' WHERE `id` = '$ku[id]'");
}
elseif($ku['botanik']>=250)
{
mysql_query("UPDATE `kolhoz_user` SET `bdlevel` = '3' WHERE `id` = '$ku[id]'");
}
elseif($ku['botanik']>=50)
{
mysql_query("UPDATE `kolhoz_user` SET `bdlevel` = '2' WHERE `id` = '$ku[id]'");
}
elseif($ku['botanik']>=10)
{
mysql_query("UPDATE `kolhoz_user` SET `bdlevel` = '1' WHERE `id` = '$ku[id]'");
}
$ku['planter']=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]'"),0);
///planter
if($ku['planter']>=10)
{
mysql_query("UPDATE `kolhoz_user` SET `pdlevel` = '5' WHERE `id` = '$ku[id]'");
}
elseif($ku['planter']>=9)
{
mysql_query("UPDATE `kolhoz_user` SET `pdlevel` = '4' WHERE `id` = '$ku[id]'");
}
elseif($ku['planter']>=8)
{
mysql_query("UPDATE `kolhoz_user` SET `pdlevel` = '3' WHERE `id` = '$ku[id]'");
}
elseif($ku['planter']>=7)
{
mysql_query("UPDATE `kolhoz_user` SET `pdlevel` = '2' WHERE `id` = '$ku[id]'");
}
elseif($ku['planter']>=6)
{
mysql_query("UPDATE `kolhoz_user` SET `pdlevel` = '1' WHERE `id` = '$ku[id]'");
}
$ku['petplanter']=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]'"),0);
///petplanter
if($ku['petplanter']>=10)
{
mysql_query("UPDATE `kolhoz_user` SET `ppdlevel` = '5' WHERE `id` = '$ku[id]'");
}
elseif($ku['petplanter']>=9)
{
mysql_query("UPDATE `kolhoz_user` SET `ppdlevel` = '4' WHERE `id` = '$ku[id]'");
}
elseif($ku['petplanter']>=8)
{
mysql_query("UPDATE `kolhoz_user` SET `ppdlevel` = '3' WHERE `id` = '$ku[id]'");
}
elseif($ku['petplanter']>=7)
{
mysql_query("UPDATE `kolhoz_user` SET `ppdlevel` = '2' WHERE `id` = '$ku[id]'");
}
elseif($ku['petplanter']>=6)
{
mysql_query("UPDATE `kolhoz_user` SET `ppdlevel` = '1' WHERE `id` = '$ku[id]'");
}
///kormer
if($ku['kormer']>=50000)
{
mysql_query("UPDATE `kolhoz_user` SET `kdlevel` = '5' WHERE `id` = '$ku[id]'");
}
elseif($ku['kormer']>=10000)
{
mysql_query("UPDATE `kolhoz_user` SET `kdlevel` = '4' WHERE `id` = '$ku[id]'");
}
elseif($ku['kormer']>=2500)
{
mysql_query("UPDATE `kolhoz_user` SET `kdlevel` = '3' WHERE `id` = '$ku[id]'");
}
elseif($ku['kormer']>=500)
{
mysql_query("UPDATE `kolhoz_user` SET `kdlevel` = '2' WHERE `id` = '$ku[id]'");
}
elseif($ku['kormer']>=100)
{
mysql_query("UPDATE `kolhoz_user` SET `kdlevel` = '1' WHERE `id` = '$ku[id]'");
}
///pugach
if($ku['pugach']>=5000)
{
mysql_query("UPDATE `kolhoz_user` SET `pgdlevel` = '5' WHERE `id` = '$ku[id]'");
}
elseif($ku['pugach']>=1000)
{
mysql_query("UPDATE `kolhoz_user` SET `pgdlevel` = '4' WHERE `id` = '$ku[id]'");
}
elseif($ku['pugach']>=250)
{
mysql_query("UPDATE `kolhoz_user` SET `pgdlevel` = '3' WHERE `id` = '$ku[id]'");
}
elseif($ku['pugach']>=50)
{
mysql_query("UPDATE `kolhoz_user` SET `pgdlevel` = '2' WHERE `id` = '$ku[id]'");
}
elseif($ku['pugach']>=10)
{
mysql_query("UPDATE `kolhoz_user` SET `pgdlevel` = '1' WHERE `id` = '$ku[id]'");
}
$count=$ku['tdlevel']+$ku['sdlevel']+$ku['vdlevel']+$ku['agdlevel']+$ku['gdlevel']+$ku['bdlevel']+$ku['pdlevel']+$ku['ppdlevel']+$ku['kdlevel']+$ku['pgdlevel'];
mysql_query("UPDATE `kolhoz_user` SET `dostig` = '$count' WHERE `id` = '$ku[id]'");
?>