<?php


if($ank['fermer_oput']>=0 && $ank['fermer_oput']<=150)$level=0;
elseif($ank['fermer_oput']>=151 && $ank['fermer_oput']<=300)$level=1;
elseif($ank['fermer_oput']>=301 && $ank['fermer_oput']<=800)$level=2;
elseif($ank['fermer_oput']>=801 && $ank['fermer_oput']<=1300)$level=3;
elseif($ank['fermer_oput']>=1301 && $ank['fermer_oput']<=2000)$level=4;
elseif($ank['fermer_oput']>=2001 && $ank['fermer_oput']<=3000)$level=5;
elseif($ank['fermer_oput']>=3001 && $ank['fermer_oput']<=4500)$level=6;
elseif($ank['fermer_oput']>=4501 && $ank['fermer_oput']<=6000)$level=7;
elseif($ank['fermer_oput']>=6001 && $ank['fermer_oput']<=9000)$level=8;
elseif($ank['fermer_oput']>=9001 && $ank['fermer_oput']<=12000)$level=9;
elseif($ank['fermer_oput']>=12001 && $ank['fermer_oput']<=16000)$level=10;
elseif($ank['fermer_oput']>=16001 && $ank['fermer_oput']<=20000)$level=11;
elseif($ank['fermer_oput']>=20001 && $ank['fermer_oput']<=25000)$level=12;
elseif($ank['fermer_oput']>=25001 && $ank['fermer_oput']<=30000)$level=13;
elseif($ank['fermer_oput']>=30001 && $ank['fermer_oput']<=35000)$level=14;
elseif($ank['fermer_oput']>=35001 && $ank['fermer_oput']<=40000)$level=15;
elseif($ank['fermer_oput']>=40001 && $ank['fermer_oput']<=50000)$level=16;
elseif($ank['fermer_oput']>=50001 && $ank['fermer_oput']<=60000)$level=17;
elseif($ank['fermer_oput']>=60001 && $ank['fermer_oput']<=70000)$level=18;
elseif($ank['fermer_oput']>=70001 && $ank['fermer_oput']<=85000)$level=19;
elseif($ank['fermer_oput']>=85001 && $ank['fermer_oput']<=90000)$level=20;
elseif($ank['fermer_oput']>=90001 && $ank['fermer_oput']<=105000)$level=21;
elseif($ank['fermer_oput']>=105001 && $ank['fermer_oput']<=115000)$level=22;
elseif($ank['fermer_oput']>=115001 && $ank['fermer_oput']<=130000)$level=23;
elseif($ank['fermer_oput']>=130001 && $ank['fermer_oput']<=155000)$level=24;
elseif($ank['fermer_oput']>=155001 && $ank['fermer_oput']<=170000)$level=25;
elseif($ank['fermer_oput']>=170001 && $ank['fermer_oput']<=190000)$level=26;
elseif($ank['fermer_oput']>=190001 && $ank['fermer_oput']<=210000)$level=27;
elseif($ank['fermer_oput']>=210001 && $ank['fermer_oput']<=230000)$level=28;
elseif($ank['fermer_oput']>=230001 && $ank['fermer_oput']<=250000)$level=29;
elseif($ank['fermer_oput']>=250001 && $ank['fermer_oput']<=270000)$level=30;
elseif($ank['fermer_oput']>=270001 && $ank['fermer_oput']<=290000)$level=31;
elseif($ank['fermer_oput']>=290001 && $ank['fermer_oput']<=320000)$level=32;
elseif($ank['fermer_oput']>=320001 && $ank['fermer_oput']<=340000)$level=33;
elseif($ank['fermer_oput']>=340001 && $ank['fermer_oput']<=360000)$level=34;
elseif($ank['fermer_oput']>=360001 && $ank['fermer_oput']<=400000)$level=35;
elseif($ank['fermer_oput']>=400001 && $ank['fermer_oput']<=450000)$level=36;
elseif($ank['fermer_oput']>=450001 && $ank['fermer_oput']<=500000)$level=37;
elseif($ank['fermer_oput']>=500001 && $ank['fermer_oput']<=550000)$level=38;
elseif($ank['fermer_oput']>=550001 && $ank['fermer_oput']<=600000)$level=39;
elseif($ank['fermer_oput']>=600001 && $ank['fermer_oput']<=650000)$level=40;
elseif($ank['fermer_oput']>=650001 && $ank['fermer_oput']<=700000)$level=41;
elseif($ank['fermer_oput']>=700001 && $ank['fermer_oput']<=750000)$level=42;
elseif($ank['fermer_oput']>=750001 && $ank['fermer_oput']<=800000)$level=43;
elseif($ank['fermer_oput']>=800001 && $ank['fermer_oput']<=850000)$level=44;
elseif($ank['fermer_oput']>=850001 && $ank['fermer_oput']<=900000)$level=45;
elseif($ank['fermer_oput']>=950001 && $ank['fermer_oput']<=1000000)$level=46;
elseif($ank['fermer_oput']>=1000001 && $ank['fermer_oput']<=1100000)$level=47;
elseif($ank['fermer_oput']>=1100001 && $ank['fermer_oput']<=1200000)$level=48;
elseif($ank['fermer_oput']>=1200001 && $ank['fermer_oput']<=1300000)$level=49;
elseif($ank['fermer_oput']>=1300001 && $ank['fermer_oput']<=1400000)$level=50;
elseif($ank['fermer_oput']>=1400001 && $ank['fermer_oput']<=1500000)$level=51;
elseif($ank['fermer_oput']>=1500001 && $ank['fermer_oput']<=1600000)$level=52;
elseif($ank['fermer_oput']>=1600001 && $ank['fermer_oput']<=1700000)$level=53;
elseif($ank['fermer_oput']>=1700001 && $ank['fermer_oput']<=1800000)$level=54;
elseif($ank['fermer_oput']>=1800001 && $ank['fermer_oput']<=1900000)$level=55;
elseif($ank['fermer_oput']>=1900001 && $ank['fermer_oput']<=2000000)$level=56;
elseif($ank['fermer_oput']>=2000001 && $ank['fermer_oput']<=2200000)$level=57;
elseif($ank['fermer_oput']>=2200001 && $ank['fermer_oput']<=2400000)$level=58;
elseif($ank['fermer_oput']>=2400001 && $ank['fermer_oput']<=2600000)$level=59;
elseif($ank['fermer_oput']>=2600001 && $ank['fermer_oput']<=2800000)$level=60;
elseif($ank['fermer_oput']>=2800001 && $ank['fermer_oput']<=3000000)$level=61;
elseif($ank['fermer_oput']>=3000001 && $ank['fermer_oput']<=3300000)$level=62;
elseif($ank['fermer_oput']>=3300001 && $ank['fermer_oput']<=3600000)$level=63;
elseif($ank['fermer_oput']>=3600001 && $ank['fermer_oput']<=3900000)$level=64;
elseif($ank['fermer_oput']>=3900001 && $ank['fermer_oput']<=4300000)$level=65;
elseif($ank['fermer_oput']>=4300001 && $ank['fermer_oput']<=4600000)$level=66;
elseif($ank['fermer_oput']>=4600001 && $ank['fermer_oput']<=4900000)$level=67;
elseif($ank['fermer_oput']>=4900001 && $ank['fermer_oput']<=5200000)$level=68;
elseif($ank['fermer_oput']>=5200001 && $ank['fermer_oput']<=5500000)$level=69;
elseif($ank['fermer_oput']>=5500001 && $ank['fermer_oput']<=5800000)$level=70;
elseif($ank['fermer_oput']>=5800001 && $ank['fermer_oput']<=6100000)$level=71;
elseif($ank['fermer_oput']>=6100001 && $ank['fermer_oput']<=6300000)$level=72;
elseif($ank['fermer_oput']>=6300001 && $ank['fermer_oput']<=6700000)$level=73;
elseif($ank['fermer_oput']>=6700001 && $ank['fermer_oput']<=7100000)$level=74;
elseif($ank['fermer_oput']>=7100001 && $ank['fermer_oput']<=7400000)$level=75;
elseif($ank['fermer_oput']>=7400001 && $ank['fermer_oput']<=7800000)$level=76;
elseif($ank['fermer_oput']>=7800001 && $ank['fermer_oput']<=8200000)$level=77;
elseif($ank['fermer_oput']>=8200001 && $ank['fermer_oput']<=8600000)$level=78;
elseif($ank['fermer_oput']>=8600001 && $ank['fermer_oput']<=9000000)$level=79;
elseif($ank['fermer_oput']>=9000001 && $ank['fermer_oput']<=9500000)$level=80;
elseif($ank['fermer_oput']>=9500001 && $ank['fermer_oput']<=10000000)$level=81;
elseif($ank['fermer_oput']>=10000001 && $ank['fermer_oput']<=10500000)$level=82;
elseif($ank['fermer_oput']>10500001 && $ank['fermer_oput']<=11000000)$level=83;
elseif($ank['fermer_oput']>=11000001 && $ank['fermer_oput']<=11500000)$level=84;
elseif($ank['fermer_oput']>=11500001 && $ank['fermer_oput']<=12000000)$level=85;
elseif($ank['fermer_oput']>=12000001 && $ank['fermer_oput']<=12500000)$level=86;
elseif($ank['fermer_oput']>=12500001 && $ank['fermer_oput']<=13000000)$level=87;
elseif($ank['fermer_oput']>=13000001 && $ank['fermer_oput']<=13500000)$level=88;
elseif($ank['fermer_oput']>=13500001 && $ank['fermer_oput']<=14000000)$level=89;
elseif($ank['fermer_oput']>=14000001 && $ank['fermer_oput']<=14500000)$level=90;
elseif($ank['fermer_oput']>=14500001 && $ank['fermer_oput']<=15000000)$level=91;
elseif($ank['fermer_oput']>=15000001 && $ank['fermer_oput']<=16000000)$level=92;
elseif($ank['fermer_oput']>=16000001 && $ank['fermer_oput']<=17000000)$level=93;
elseif($ank['fermer_oput']>=17000001 && $ank['fermer_oput']<=18000000)$level=94;
elseif($ank['fermer_oput']>=18000001 && $ank['fermer_oput']<=19000000)$level=95;
elseif($ank['fermer_oput']>=19000001 && $ank['fermer_oput']<=20000000)$level=96;
elseif($ank['fermer_oput']>=20000001 && $ank['fermer_oput']<=21000000)$level=97;
elseif($ank['fermer_oput']>=21000001 && $ank['fermer_oput']<=22000000)$level=98;
elseif($ank['fermer_oput']>=22000001 && $ank['fermer_oput'] <=23000000)$level=99;
elseif($ank['fermer_oput']>=23000001 && $ank['fermer_oput']<=220000000)$level=100;

if($ank['fermer_level']!=$level)mysql_query("UPDATE `user` SET `fermer_level` = '".$level."' WHERE `id` = $ank[id] LIMIT 1");
echo "<div class='navig2'>";
echo "Деньги: <b>$ank[fermer_money]</b><br/>";
echo "Уровень : <b>".$level."</b><br/>";
echo "Опыт: <b>$ank[fermer_oput]</b>";
echo "</div>"; 
$i=mysql_query("SELECT * FROM `fermer_gr` WHERE `kol` = '0'");
while($ii=mysql_fetch_array($i)){
$semenk=mysql_fetch_array(mysql_query("SELECT *
FROM `fermer_name` WHERE `id` = '$ii[semen]' LIMIT 1"));

$pt=rand($semenk['rand1'],$semenk['rand2']); 
if($ii['woter']==0)$pt=floor($pt/2);

mysql_query("UPDATE `fermer_gr` SET `kol` = $pt WHERE `id` = '$ii[id]' LIMIT 1");
 }


?>