Файл: inc/center/converter.php
Строк: 164
<?
$title='Обменник';
include_once '../system/config.php';
echo '<img src="http://subdomain.test1.ru/img/logo.gif">';
$count=6;
$countMedalB=0;
$countMedalS=0;
$countMedalZ=0;
$countDostig=0;
$countFlower=0;
$countCook=0;
$countDostig=floor($ku['dostig']/5);
if($ku['forum']+$ku['chat']>1000)$countMedalB=3;
if($ku['forum']+$ku['chat']>2000)$countMedalS=5;
if($ku['forum']+$ku['chat']>4000)$countMedalZ=10;
$countCook=floor($ku['cook_mas']/1000);
if(isset($flowerbed_act))$countFlower=(4 + (2 * $flowerbed_act));
$count=$count+$countMedalB+$countMedalS+$countMedalZ+$countDostig+$countFlower+$countCook;
$time_rub=floor(86400/$count);
$time1=$time-$ku['time_obmen'];
$col_rub=floor($time1/$time_rub);
if($col_rub>$count)$col_rub=$count;
if(isset($_GET['all']))
{
$need_mcr=1000*$col_rub;
if($ku['money']>=$need_mcr)
{
if($col_rub>=$count)
{
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>=$count)
{
$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>
<div class="menu-foot"><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>
<div class="menu-foot"><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></div>
</ul>
<div class="content">
<div class="div">
<h3>Обменять на рубины</h3>
<div>
<div class="menu-foot"><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 class='menu-foot'><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></div>";
echo "</div>
<div class='minor ptm'>Сейчас доступно к обмену:
<span class='n'>$col_rub</span> / <span class='n'>$count</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';
?>