Файл: zfarm.mobi/inc/center/converter.php
Строк: 149
<?
$title='Обменник';
include_once '../system/config.php';
$count1=6;
$count1=floor($ku['dostig']/5)+$count1;
if($ku['forum']+$ku['chat']>1000)$count1=floor(3)+$count1;
if($ku['forum']+$ku['chat']>2000)$count1=floor(5)+$count1;
if($ku['forum']+$ku['chat']>4000)$count1=floor(10)+$count1;
$count1=floor($ku['cook_mas']/1000)+$count1;
if(isset($flowerbed_act))$count1=$count1+$flowerbed_act;
$time_rub=floor(86400/$count1);
$time1=$time-$ku['time_obmen'];
$col_rub=floor($time1/$time_rub);
if($col_rub>$count1)$col_rub=$count1;
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:/exchange");
exit;
}
elseif(isset($_GET['one']) && $col_rub > 0)
{
$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:/exchange");
exit;
}
elseif(isset($_GET['money_one']))
{
$need_mcr=1;
$mok=2000;
if($ku['rubies']>=$need_mcr)
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$need_mcr)."', `money` = '".($ku['money']+$mok)."' WHERE `id` = '$ku[id]'");
}
else $_SESSION['no_rubies']=$need_mcr-$ku['rubies'];
header("Location:/exchange");
exit;
}
elseif(isset($_GET['money_all']))
{
$need_mcr=10;
$mok=20000;
if($ku['rubies']>=$need_mcr)
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$need_mcr)."', `money` = '".($ku['money']+$mok)."' WHERE `id` = '$ku[id]'");
}
else $_SESSION['no_rubies']=$need_mcr-$ku['rubies'];
header("Location:/exchange");
exit;
}
?>
<div class='rzd2'></div><div class='menuin2'>
<div class="title">Обменный пункт</h2></div>
<div class="content">
<div class="div">
<h3>Обменять на монеты</h3>
<ul>
<li>
<img src="/img/icons/convert.png" alt="o"> <a href="/exchange/moneyOne">Обменять</a> <img src="/img/icons/ruby.png" alt="o"> 1 рубин
на <img src="/img/icons/money.png" alt="o"> 2000 монет.
</li>
<li>
<img src="/img/icons/convert.png" alt="o"> <a href="/exchange/moneyAll">Обменять</a> <img src="/img/icons/ruby.png" alt="o"> 10 рубинов на <img src="/img/icons/money.png" alt="o"> 20000 монет.
</li>
</ul>
<h3>Обменять на рубины</h3>
<div>
<img src="/img/icons/convert.png" alt="o">
<?
if($col_rub>0)echo "<a href='/exchange/one'>Обменять</a> <img src='/img/icons/money.png' alt='o'> 1000 монет на <img src='/img/icons/ruby.png' alt='o'> 1 рубин.<br></div><div><img src='/img/icons/convert.png' alt='o'> <a href='/exchange/all'>Обменять</a> <img src='/img/icons/money.png' alt='o'> <span>".($col_rub*1000)."</span> монет на <img src='/img/icons/ruby.png' alt='o'> <span>$col_rub</span> рубинов.<br/>";
else echo "<span>Обменять</span> <img src='/img/icons/money.png' alt='o'> 1000 монет на <img src='/img/icons/ruby.png' alt='o'> 1 рубин.<br>";
echo "</div>
<div class='minor ptm'>Сейчас доступно к обмену:
<span class='n'>$col_rub</span> / <span class='n'>$count1</span>";
?>
(зависит от <a href='/shop/flowerbed'>Клумбы</a>, кулинарного мастерства и от медалей.).</div><h3>Купить рубины</h3>
<div>
<img src="/img/icons/ruby.png" alt="o"> <a href="/payment">Купить</a>
</div>
</div>
<?
echo"</div></div><div class='rzd2'></div>";
include_once '../system/foot.php';
?>