Файл: tankon.mobi/tanks/obmen.php
Строк: 225
<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
include_once '../sys/inc/thead.php';
title();aut();err();
echo '<link rel="stylesheet" href="style.css" type="text/css" />';
include_once 'function.php';
if ($tanks_code['obmen']==0 && $tanks_code['time_obmen']<=time()){$serebra=500;}
elseif ($tanks_code['obmen']==1 && $tanks_code['time_obmen']<=time()){$serebra=1000;}
elseif($tanks_code['obmen']==2 && $tanks_code['time_obmen']<=time()){$serebra=2500;}
elseif($tanks_code['obmen']==3 && $tanks_code['time_obmen']<=time()){$serebra=5000;}
elseif ($tanks_code['obmen']==4 && $tanks_code['time_obmen']<=time()){$serebra=10000;}
elseif ($tanks_code['obmen']==5 && $tanks_code['time_obmen']<=time()){$serebra=50000;}
elseif ($tanks_code['time_obmen']<=time()) {$serebra=100000;}
if(isset($_GET['ser1'])){
if($tanks_code['zolota']>=10)
{
mysql_querll("UPDATE `tanks` SET `zolota` = '".($tanks_code['zolota']-10)."', `serebro` = '".($tanks_code['serebro']+2000)."' WHERE `id`='".$user['id']."'");
header("Location:/obmen");
}
else {$_SESSION['no_zolota']=$need_mcr-$tanks_code['zolota'];
header("Location:/obmen");
exit;}
}
elseif(isset($_GET['ser2'])){
$need_mcr=50;
if($tanks_code['zolota']>=50)
{
mysql_querll("UPDATE `tanks` SET `zolota` = '".($tanks_code['zolota']-50)."', `serebro` = '".($tanks_code['serebro']+10000)."' WHERE `id`='".$user['id']."'");
header("Location:/obmen");
}
else {$_SESSION['no_zolota']=$need_mcr-$tanks_code['zolota'];
header("Location:/obmen");
exit;}
}
elseif(isset($_GET['ser3'])){
$need_mcr=100;
if($tanks_code['zolota']>=100)
{
mysql_querll("UPDATE `tanks` SET `zolota` = '".($tanks_code['zolota']-100)."', `serebro` = '".($tanks_code['serebro']+25000)."' WHERE `id`='".$user['id']."'");
header("Location:/obmen");
}
else {$_SESSION['no_zolota']=$need_mcr-$tanks_code['zolota'];
header("Location:/obmen");
exit;}
}
elseif(isset($_GET['ser4'])){
$need_mcr=500;
if($tanks_code['zolota']>=500)
{
mysql_querll("UPDATE `tanks` SET `zolota` = '".($tanks_code['zolota']-500)."', `serebro` = '".($tanks_code['serebro']+175000)."' WHERE `id`='".$user['id']."'");
header("Location:/obmen");
}
else {$_SESSION['no_zolota']=$need_mcr-$tanks_code['zolota'];
header("Location:/obmen");
exit;}
}
if ($tanks_code['time_obmen']<=time()){
if(isset($_POST['zoloto'])){
$need_mcr=$serebra;
$tos=time()+4*60*60;
if($tanks_code['serebro']>=$need_mcr)
{
mysql_query("UPDATE `tanks` SET `zolota` = '".($tanks_code['zolota']+3)."', `serebro` = '".($tanks_code['serebro']-$need_mcr)."', `obmen` = '".($tanks_code['obmen']+1)."', `time_obmen` = '".$tos."' WHERE `id`='".$user['id']."'");
}
else $_SESSION['no_serebra']=$need_mcr-$tanks_code['serebro'];
echo'';
header("Location:/obmen");
exit;
}}
$time_obmen=time();
$obmenka_time=time_left($tanks_code['time_obmen']-$time_obmen);
echo'<table><tr>
<td style="width:50%;padding-right:2px;">
<div style="position:relative;">
<a class="simple-but mb5 gray" w:id="selectUssr" href="/price"><span><span>Банк</span></span></a>
</div>
</td>
<td style="width:50%;padding:0 2px;">
<div style="position:relative;">
<div class="simple-but mb5 blue" href="/obmen"><span><span>Обменник</span></span></div>
</div>
</td>
</tr></table>
';
echo'<a class="simple-but grey" style="margin-bottom:3px;" href="/obmen?ser1"><span><span>Обменять <img src="/tanks/images/icons/gold.png"> 10 золота на <img src="/tanks/images/icons/silver.png"> 2к серебра</span></span></a></div>';
echo'<a class="simple-but blue" style="margin-bottom:3px;" href="/obmen?ser2"><span><span>Обменять <img src="/tanks/images/icons/gold.png"> 50 золота на <img src="/tanks/images/icons/silver.png"> 10к серебра</span></span></a></div>';
echo'<a class="simple-but grey" style="margin-bottom:3px;" href="/obmen?ser3"><span><span>Обменять <img src="/tanks/images/icons/gold.png"> 100 золота на <img src="/tanks/images/icons/silver.png"> 25к серебра</span></span></a></div>';
echo'<a class="simple-but blue" style="margin-bottom:3px;" href="/obmen?ser4"><span><span>Обменять <img src="/tanks/images/icons/gold.png"> 500 золота на <img src="/tanks/images/icons/silver.png"> 175к серебра</span></span></a></div>';
if ($tanks_code['time_obmen']<=time()){
if ($tanks_code['time_obmen']<=time()){
echo '<div class="trnt-blocks p5" style="margin-bottom:15px;"><div class="wrap-content"><div class=" small white cntr sh_b bold">';
}else{
echo '<div class="trnt-blocks p5" style="margin-bottom:5px;"><div class="wrap-content"><div class=" small white cntr sh_b bold">';
}
echo '<div class="medium cntr white sh_b bold">Вы можете обменять:</div>';
echo "<form method='post'>n";
echo ''.$serebra.' серебра на 3 золота';
}else {
err_game('Подождите '.$obmenka_time.' для обмена</div>');
}
if ($tanks_code['time_obmen']<=time()){
echo'<div class="bot">
<span class="input-but border"><span>';
echo "<input name='zoloto' value="Обменять" class='w100' type="submit" /></span></span>
</div></form>";}
echo '</div></div></div></div></div></div></div></div></div></div></div>';
include_once 'foots.php';
?>