<?
///TEHNIKA
if($ku['tehnika']>=96){mysql_querll("UPDATE `kolhoz_user` SET `tdlevel` = '5' WHERE `id` = '$ku[id]'");}
elseif($ku['tehnika']>=75){mysql_querll("UPDATE `kolhoz_user` SET `tdlevel` = '4' WHERE `id` = '$ku[id]'");}
elseif($ku['tehnika']>=50){mysql_querll("UPDATE `kolhoz_user` SET `tdlevel` = '3' WHERE `id` = '$ku[id]'");}
elseif($ku['tehnika']>=30){mysql_querll("UPDATE `kolhoz_user` SET `tdlevel` = '2' WHERE `id` = '$ku[id]'");}
elseif($ku['tehnika']>=10){mysql_querll("UPDATE `kolhoz_user` SET `tdlevel` = '1' WHERE `id` = '$ku[id]'");}

///SADOVOD
if($ku['sadovod']>=2000){mysql_querll("UPDATE `kolhoz_user` SET `sdlevel` = '5' WHERE `id` = '$ku[id]'");}
elseif($ku['sadovod']>=1000){mysql_querll("UPDATE `kolhoz_user` SET `sdlevel` = '4' WHERE `id` = '$ku[id]'");}
elseif($ku['sadovod']>=200){mysql_querll("UPDATE `kolhoz_user` SET `sdlevel` = '3' WHERE `id` = '$ku[id]'");}
elseif($ku['sadovod']>=50){mysql_querll("UPDATE `kolhoz_user` SET `sdlevel` = '2' WHERE `id` = '$ku[id]'");}
elseif($ku['sadovod']>=10){mysql_querll("UPDATE `kolhoz_user` SET `sdlevel` = '1' WHERE `id` = '$ku[id]'");}

///RABOTNIK
if($ku['master']>=1000){mysql_querll("UPDATE `kolhoz_user` SET `mslevel` = '5' WHERE `id` = '$ku[id]'");}
elseif($ku['master']>=200){mysql_querll("UPDATE `kolhoz_user` SET `mslevel` = '4' WHERE `id` = '$ku[id]'");}
elseif($ku['master']>=80){mysql_querll("UPDATE `kolhoz_user` SET `mslevel` = '3' WHERE `id` = '$ku[id]'");}
elseif($ku['master']>=20){mysql_querll("UPDATE `kolhoz_user` SET `mslevel` = '2' WHERE `id` = '$ku[id]'");}
elseif($ku['master']>=5){mysql_querll("UPDATE `kolhoz_user` SET `mslevel` = '1' WHERE `id` = '$ku[id]'");}

///VODOLEY
if($ku['vodoley']>=2000){mysql_querll("UPDATE `kolhoz_user` SET `vdlevel` = '5' WHERE `id` = '$ku[id]'");}
elseif($ku['vodoley']>=1000){mysql_querll("UPDATE `kolhoz_user` SET `vdlevel` = '4' WHERE `id` = '$ku[id]'");}
elseif($ku['vodoley']>=200){mysql_querll("UPDATE `kolhoz_user` SET `vdlevel` = '3' WHERE `id` = '$ku[id]'");}
elseif($ku['vodoley']>=50){mysql_querll("UPDATE `kolhoz_user` SET `vdlevel` = '2' WHERE `id` = '$ku[id]'");}
elseif($ku['vodoley']>=10){mysql_querll("UPDATE `kolhoz_user` SET `vdlevel` = '1' WHERE `id` = '$ku[id]'");}

///AGRONOM
if($ku['agronom']>=2000){mysql_querll("UPDATE `kolhoz_user` SET `agdlevel` = '5' WHERE `id` = '$ku[id]'");}
elseif($ku['agronom']>=1000){mysql_querll("UPDATE `kolhoz_user` SET `agdlevel` = '4' WHERE `id` = '$ku[id]'");}
elseif($ku['agronom']>=200){mysql_querll("UPDATE `kolhoz_user` SET `agdlevel` = '3' WHERE `id` = '$ku[id]'");}
elseif($ku['agronom']>=50){mysql_querll("UPDATE `kolhoz_user` SET `agdlevel` = '2' WHERE `id` = '$ku[id]'");}
elseif($ku['agronom']>=10){mysql_querll("UPDATE `kolhoz_user` SET `agdlevel` = '1' WHERE `id` = '$ku[id]'");}

///gifter
$ku['gifter'] = mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_gifts` WHERE `id_kont` = '$ku[id]'"),0);
if($ku['gifter']>=30){mysql_querll("UPDATE `kolhoz_user` SET `gdlevel` = '5' WHERE `id` = '$ku[id]'");}
elseif($ku['gifter']>=20){mysql_querll("UPDATE `kolhoz_user` SET `gdlevel` = '4' WHERE `id` = '$ku[id]'");}
elseif($ku['gifter']>=10){mysql_querll("UPDATE `kolhoz_user` SET `gdlevel` = '3' WHERE `id` = '$ku[id]'");}
elseif($ku['gifter']>=5){mysql_querll("UPDATE `kolhoz_user` SET `gdlevel` = '2' WHERE `id` = '$ku[id]'");}
elseif($ku['gifter']>=1){mysql_querll("UPDATE `kolhoz_user` SET `gdlevel` = '1' WHERE `id` = '$ku[id]'");}

///botanik
if($ku['botanik']>=2000){mysql_querll("UPDATE `kolhoz_user` SET `bdlevel` = '5' WHERE `id` = '$ku[id]'");}
elseif($ku['botanik']>=1000){mysql_querll("UPDATE `kolhoz_user` SET `bdlevel` = '4' WHERE `id` = '$ku[id]'");}
elseif($ku['botanik']>=200){mysql_querll("UPDATE `kolhoz_user` SET `bdlevel` = '3' WHERE `id` = '$ku[id]'");}
elseif($ku['botanik']>=50){mysql_querll("UPDATE `kolhoz_user` SET `bdlevel` = '2' WHERE `id` = '$ku[id]'");}
elseif($ku['botanik']>=10){mysql_querll("UPDATE `kolhoz_user` SET `bdlevel` = '1' WHERE `id` = '$ku[id]'");}

///planter
$ku['planter'] = mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]'"),0);
if($ku['planter']>=10){mysql_querll("UPDATE `kolhoz_user` SET `pdlevel` = '5' WHERE `id` = '$ku[id]'");}
elseif($ku['planter']>=9){mysql_querll("UPDATE `kolhoz_user` SET `pdlevel` = '4' WHERE `id` = '$ku[id]'");}
elseif($ku['planter']>=8){mysql_querll("UPDATE `kolhoz_user` SET `pdlevel` = '3' WHERE `id` = '$ku[id]'");}
elseif($ku['planter']>=7){mysql_querll("UPDATE `kolhoz_user` SET `pdlevel` = '2' WHERE `id` = '$ku[id]'");}
elseif($ku['planter']>=6){mysql_querll("UPDATE `kolhoz_user` SET `pdlevel` = '1' WHERE `id` = '$ku[id]'");}

///petplanter
$ku['petplanter'] = mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]'"),0);
if($ku['petplanter']>=10){mysql_querll("UPDATE `kolhoz_user` SET `ppdlevel` = '5' WHERE `id` = '$ku[id]'");}
elseif($ku['petplanter']>=9){mysql_querll("UPDATE `kolhoz_user` SET `ppdlevel` = '4' WHERE `id` = '$ku[id]'");}
elseif($ku['petplanter']>=8){mysql_querll("UPDATE `kolhoz_user` SET `ppdlevel` = '3' WHERE `id` = '$ku[id]'");}
elseif($ku['petplanter']>=7){mysql_querll("UPDATE `kolhoz_user` SET `ppdlevel` = '2' WHERE `id` = '$ku[id]'");}
elseif($ku['petplanter']>=6){mysql_querll("UPDATE `kolhoz_user` SET `ppdlevel` = '1' WHERE `id` = '$ku[id]'");}

///kormer
if($ku['kormer']>=2000){mysql_querll("UPDATE `kolhoz_user` SET `kdlevel` = '5' WHERE `id` = '$ku[id]'");}
elseif($ku['kormer']>=1000){mysql_querll("UPDATE `kolhoz_user` SET `kdlevel` = '4' WHERE `id` = '$ku[id]'");}
elseif($ku['kormer']>=200){mysql_querll("UPDATE `kolhoz_user` SET `kdlevel` = '3' WHERE `id` = '$ku[id]'");}
elseif($ku['kormer']>=50){mysql_querll("UPDATE `kolhoz_user` SET `kdlevel` = '2' WHERE `id` = '$ku[id]'");}
elseif($ku['kormer']>=10){mysql_querll("UPDATE `kolhoz_user` SET `kdlevel` = '1' WHERE `id` = '$ku[id]'");}

///pugach
if($ku['pugach']>=1000){mysql_querll("UPDATE `kolhoz_user` SET `pgdlevel` = '5' WHERE `id` = '$ku[id]'");}
elseif($ku['pugach']>=200){mysql_querll("UPDATE `kolhoz_user` SET `pgdlevel` = '4' WHERE `id` = '$ku[id]'");}
elseif($ku['pugach']>=50){mysql_querll("UPDATE `kolhoz_user` SET `pgdlevel` = '3' WHERE `id` = '$ku[id]'");}
elseif($ku['pugach']>=10){mysql_querll("UPDATE `kolhoz_user` SET `pgdlevel` = '2' WHERE `id` = '$ku[id]'");}
elseif($ku['pugach']>=2){mysql_querll("UPDATE `kolhoz_user` SET `pgdlevel` = '1' WHERE `id` = '$ku[id]'");}

$count = $ku['tdlevel'] + $ku['sdlevel'] + $ku['mslevel'] + $ku['vdlevel'] + $ku['agdlevel'] + $ku['gdlevel'] + $ku['bdlevel'] + $ku['pdlevel'] + $ku['ppdlevel'] + $ku['kdlevel'] + $ku['pgdlevel'];
mysql_querll("UPDATE `kolhoz_user` SET `dostig` = '$count' WHERE `id` = '$ku[id]'");
?>