File size: 1.94Kb
<?
require_once'../core/system.php';
echo only_reg();
echo ban();
echo blok();
$header='Открытие слота';
require_once'../core/head.php';
if($user['level']<7){
header('location: /');
$_SESSION['err'] = 'Доступно только с 7 уровня';}
$lot = intval($_GET['id']);
if($lot>8 or $lot<=1){$_SESSION['err'] = "Ошибка";
header('Location: /master/');
exit();}
if($lot==2){$gold=5000;}
if($lot==3){$gold=20000;}
if($lot==4){$gold=50000;}
if($lot==5){$gold=80000;}
if($lot==6){$gold=120000;}
if($lot==7){$gold=250000;}
if($lot==8){$gold=400000;}
//$gold=floor($gold*0.70);
$cena=$gold/100;
echo "</div><div class='foot center'><table class='d-grey' width='100%' border='0' cellpadding='0' cellspacing='0' style='padding-top: 5px;'>
<tbody>
<tr>";//(Скидка <font color="F2F745">30%</font>)
echo '<div class="inpc-ar"><div class="empty2"></div>Вы хотите открыть cлот за <img src="/images/icon/gold.png">'.$cena.'? </div><div class="empty2"></div>
<td width="40%"><a class="big-but" href="/master/open?id='.abs(intval($_GET['id'])).'&yes"><div class="imgwrap"><img src="/images/icon/ok.png"></div>Открыть cлот</a></td>';
echo '<td width="40%"><a class="big-but" href="/master/"><div class="imgwrap"><img src="/images/icon/error.png"></div>Отмена</a></td></tbody></table></div></div>';
echo "</div>";
if(isset($_GET['yes'])) {
if($user['gold']<$gold){
header("Location: /master/");
$_SESSION['err'] = 'Недостаточно золота';exit;}
if($user['lot'.$lot.'']==1){$_SESSION['err'] = "Ошибка";
header('Location: /master/');
exit();}
$t=time();
mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'лот', `time` = '".$t."', `kol`='$gold', `kto`='-'");
mysql_query("UPDATE `user` SET `gold`=`gold`-'$gold', `lot$lot`='1' WHERE `id`='$user[id]'");
header("Location: /master/");
$_SESSION['message'] = " Вы открыли лот";
}
require_once'../core/foot.php';
?>