Файл: KOSMOS/inc/lombard.php
Строк: 104
<?
$kulinar=1;
$kulinar=floor($ku['cook_mas']/500)+$kulinar;
$count1=6;
$count1=floor($ku['dostig']/5)+$count1;
if(isset($flowerbed_act))$count1=$count1+$flowerbed_act+$kulinar_master;
if(isset($moto1_act))$count1=$count1+$moto1_act;
if(isset($garazh1_act))$count1=$count1+$garazh1_act;
if(isset($bassein_act))$count1=$count1+$bassein_act;
$time_rub=floor(86400/$count1);
$time1=$time-$ku['time_obmen'];
$col_rub=floor($time1/$time_rub);
if($col_rub>$count1)$col_rub=$count1+$kulinar;
if(isset($_GET['all']))
{
$need_mcr=1000*$col_rub;
if($ku['money']>=$need_mcr)
{
if($col_rub>=$count1)
{
mysql_query("UPDATE `kolhoz_user` SET `time_obmen` = '$time', `rubies` = '".($ku['rubies']+$col_rub)."', `money` = '".($ku['money']-$need_mcr)."' WHERE `id` = '$ku[id]'");
}
else mysql_query("UPDATE `kolhoz_user` SET `time_obmen` = '".($ku['time_obmen']+($col_rub*$time_rub))."', `rubies` = '".($ku['rubies']+$col_rub)."', `money` = '".($ku['money']-$need_mcr)."' WHERE `id` = '$ku[id]'");
}
else $_SESSION['no_money']=$need_mcr-$ku['money'];
header("Location:?converter");
exit;
}
elseif(isset($_GET['one']))
{
$need_mcr=1000;
if($ku['money']>=$need_mcr)
{
if($col_rub>=$count1)
{
$tkt=$col_rub-1;
$tt=$time_rub*$tkt;
$ttt=$time-$tt;
mysql_query("UPDATE `kolhoz_user` SET `time_obmen` = '$ttt', `rubies` = '".($ku['rubies']+1)."', `money` = '".($ku['money']-$need_mcr)."' WHERE `id` = '$ku[id]'");
}
else mysql_query("UPDATE `kolhoz_user` SET `time_obmen` = '".($ku['time_obmen']+$time_rub)."', `rubies` = '".($ku['rubies']+1)."', `money` = '".($ku['money']-$need_mcr)."' WHERE `id` = '$ku[id]'");
}
else $_SESSION['no_money']=$need_mcr-$ku['money'];
header("Location:?converter");
exit;
}
elseif(isset($_GET['rubies_one']))
{
$need_mcr=10;
$mok=10;
if($ku['almaz']>=$need_mcr)
{
mysql_query("UPDATE `kolhoz_user` SET `almaz` = '".($ku['almaz']-$need_mcr)."', `rubies` = '".($ku['rubies']+$mok)."' WHERE `id` = '$ku[id]'");
}
else $_SESSION['no_rubies']=$need_mcr-$ku['rubies'];
header("Location:?lombard");
exit;
}
elseif(isset($_GET['rubies_all']))
{
$need_mcr=100;
$mok=100;
if($ku['almaz']>=$need_mcr)
{
mysql_query("UPDATE `kolhoz_user` SET `almaz` = '".($ku['almaz']-$need_mcr)."', `rubies` = '".($ku['rubies']+$mok)."' WHERE `id` = '$ku[id]'");
}
else $_SESSION['no_almaz']=$need_mcr-$ku['almaz'];
header("Location:?lombard");
exit;
}
?>
<div class="event"><h1>Ломбард</h1></div>
<div class="content">
<div class="block">
<img width='64' height='64' src='images/icons/lombard.png' alt='o'><span class='epic'>Приветствую Вас, Сегодня вы можете обменять кристаллы по курсу <img width="16" height="16" src="images/icons/almaz.png" alt="o">1 к <img width="16" height="16" src="images/icons/ruby.png" alt="o">1 рубин.</span>
<h3>Обменять кристаллы на рубины</h3>
<ul>
<li>
<img width="16" height="16" src="images/icons/convert.png" alt="o"> <a href="?lombard&rubies_one">Обменять</a> <img width="16" height="16" src="images/icons/almaz.png" alt="o"> 10 кристаллов
на <img width="16" height="16" src="images/icons/ruby.png" alt="o"> 10 рубинов.
</li>
<li>
<img width="16" height="16" src="images/icons/convert.png" alt="o"> <a href="?lombard&rubies_all">Обменять</a> <img width="16" height="16" src="images/icons/almaz.png" alt="o"> 100 кристаллов на <img width="16" height="16" src="images/icons/ruby.png" alt="o"> 100 рубинов.
</li>
</div>
<?
include_once 'inc/foot.php';
?>