Вход Регистрация
Файл: inc/cellar/sell.php
Строк: 47
<?
include_once '../system/config.php';
if(isset(
$_GET['sell']) && intval($_GET['sell'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka` WHERE `id` = '".intval($_GET['sell'])."' AND `id_user` = '$ku[id]' AND `id_recipes` != '0'"),0)!=0)
{
$polka=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_polka` WHERE `id` = '".intval($_GET['sell'])."' AND `id_user` = '$ku[id]' AND `id_recipes` != '0'"));
$recipes=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_recipes` WHERE `id` = '$polka[id_recipes]'"));
if(
$polka['time']<=$time)
{
if(
$recipes['id']==$gos['id_recipes'] && isset($mc))
{
$harv=(isset($harvester2_act)?$harvester2_act/100:0);
$hawk=(isset($yastreb2_act)?3:0);
$exp=$recipes['time_soil']+($recipes['time_soil']*$harv)+($recipes['time_soil']*$hawk);
if(
$gos['type']=='harvest2')$exp=$exp*2;
mysql_query("INSERT INTO `kolhoz_collective_rating_gos` SET `id_user` = '$ku[id]', `id_collective` = '$mc[id]', `count` = '$exp', `time` = '$time'");
}
$rat=$recipes['rating'];
$rat_sc_act=0;
$rat_drakon_act=0;
$rat_school_act=0;
$rat_kulinary_act=0;
$rat_lib_act=0;
if(isset(
$sc_act))$rat_sc_act=$rat*2;
if(isset(
$drakon_act))$rat_drakon_act=(($recipes['rating']/100)*300);
if(isset(
$school_act))$rat_school_act=$rat*2;
if(isset(
$lib_act))$rat_lib_act=$rat*2;
if(
$mc['MedalRating']>0)$rat_medal=(($rat/100)*($mc['MedalRating']*0.5));
if(isset(
$kulinary_act))$rat_kulinary_act=($rat/100)*$kulinary_ps_r;
$ratt=$rat_drakon_act+$rat_medal+$rat_sc_act+$rat_kulinary_act+$rat_school_act+$rat_lib_act;
if(
$ratt==0)$rat=$rat;
else 
$rat=$ratt;
if(isset(
$dexp))$rat=$rat*2;if(isset($exp3))$rat=$rat*3;
$count=$recipes['count'];
$count=$count_harvester2_act+$count_yastreb2_act+$count+$count_greenhouse_act;
$money=($count*$recipes['money']);
mysql_query("UPDATE `kolhoz_polka` SET `id_recipes` = '0', `soil` = '0', `clean` = '0' WHERE `id` = '".intval($_GET['sell'])."' LIMIT 1");
$_SESSION['mon']=$money;
$_SESSION['rating']=$rat;
update_mc($rat);

mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$rat)."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_user` SET `money` = '".($ku['money']+$money)."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_polka` SET `id_recipes` = '0', `soil` = '0', `clean` = '0' WHERE `id` = '".intval($_GET['sell'])."' LIMIT 1");
  
header("Location:/cellar/");
}
  else 
header("Location:/cellar/");
exit;
}
?>
Онлайн: 1
Реклама