Файл: ferma/inc/station_act.php
Строк: 24
<?
if($mc['station']==1)
{
$cena2=0;
$q=mysql_query("SELECT * FROM `kolhoz_collective_heli` WHERE `id_collective` = '$mc[id]' AND `heli` != '0' ORDER BY `time` DESC");
while($post=mysql_fetch_array($q))
{
$post['max_gaz']=250;
if($post['heli']==3)$post['max_gaz']=500;
if($post['heli']==4)$post['max_gaz']=2500;
$gaz=($post['max_gaz']/100)*10;
$gaz2=$post['max_gaz']-$post['gaz'];
if($post['gaz']<=$gaz)
{
$cena=$gaz2*1000;
if($mc['money']>=$cena)
{
mysql_query("UPDATE `kolhoz_collective_heli` SET `gaz` = '".($post['gaz']+$gaz2)."' WHERE `id` = '$post[id]'");
mysql_query("UPDATE `kolhoz_collective` SET `money` = '".($mc['money']-$cena)."' WHERE `id` = '$mc[id]'");
$mc['money']=$mc['money']-$cena;
}
elseif($mc['money']>=1000)
{
$gaz2=floor($mc['money']/1000);
$cena=$mdil*1000;
mysql_query("UPDATE `kolhoz_collective_heli` SET `gaz` = '".($post['gaz']+$gaz2)."' WHERE `id` = '$post[id]'");
mysql_query("UPDATE `kolhoz_collective` SET `money` = '".($mc['money']-$cena)."' WHERE `id` = '$mc[id]'");
$mc['money']=$mc['money']-$cena;
}
$cena2=$cena2+$cena;
}
}
}
?>