Файл: ubiznes.mobi/inc/shop/chest.php
Строк: 82
<?
echo'<div class="b-top"> <h2> <a href=/?shop> Магазин </a> / Сундуки </h2> </div>';
if(isset($_GET['buy'])){
$id=abs(intval($_GET['buy']));
if($id==1){$price=50;}
elseif($id==2){$price=250;}
else{$price=500;}
if($user['chat_ball']>=$price){
if($id==1){
$rand=rand(1,3);
if($rand==1){$baks=rand(10,50);$_SESSION['baks']=$baks;}
elseif($rand==2){$money=rand(1,100).'000'; $_SESSION['money']=$money;}
else{$adv=rand(1,5)*3600; $_SESSION['msg']="Вы получили: <font color='lime'> Адвоката </font> на ".img_ic(16,16,'icons/time')." <font color='yellow'>".time_left($adv)."</font>";}
}elseif($id==1){
$rand=rand(1,3);
if($rand==1){$baks=rand(50,250);$_SESSION['baks']=$baks;}
elseif($rand==2){$money=rand(5,500).'000'; $_SESSION['money']=$money;}
else{$adv=rand(1,24)*3600; $_SESSION['msg']="Вы получили: <font color='lime'> Адвоката </font> на ".img_ic(16,16,'icons/time')." <font color='yellow'>".time_left($adv)."</font>";}
}else{
$rand=rand(1,3);
if($rand==1){$baks=rand(100,500);$_SESSION['baks']=$baks;}
elseif($rand==2){$money=rand(1,100).'0000'; $_SESSION['money']=$money;}
else{$adv=rand(1,24)*3600; $_SESSION['msg']="Вы получили: <font color='lime'> Адвоката </font> на ".img_ic(16,16,'icons/time')." <font color='yellow'>".time_left($adv)."</font>";}
}
if($baks>0){
mysql_query("UPDATE `user` SET `baks` = `baks` + '$baks' WHERE `id` = '$user[id]'");
}elseif($money>0){
mysql_query("UPDATE `user` SET `money` = `money` + '$money' WHERE `id` = '$user[id]'");
}elseif($adv>0){
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$user[id]' AND `time_advokat` > '$time'"),0)==0){
mysql_query("UPDATE `user` SET `time_advokat` = '".($time+$adv)."' WHERE `id` = '$user[id]'");
}else{
mysql_query("UPDATE `user` SET `time_advokat` = `time_advokat` + '$adv' WHERE `id` = '$user[id]'");
}
}
mysql_query("UPDATE `user` SET `chat_ball` = `chat_ball` - '$price' WHERE `id` = '$user[id]'");
header("location:/?shop&chest");
}else{
err_game("У Вас не хватает ".img_ic(16,16,'chat')." <font color='yellow'> ".($price-$user['chat_ball'])."</font>");
}
}
echo'<div class="pan-2"> <center> У Вас: '.img_ic(16,16,'chat').' <font color="yellow"> '.razd($user['chat_ball']).' </font> </center> </div>';
echo'<div class="pan-4"> <img width="60" height="60" src="images/chest/1.png" class="portrait">
<div> <font color="yellow"> Маленький сундук </font> | Стоимость: '.img_ic(16,16,'chat').' <font color="yellow"> 50 </font></div>
<div> '.img_ic(16,16,'icons/str').' <a href=/?shop&chest&buy=1> Купить сундук </a> </div><div style="clear:both"></div></div>';
echo'<div class="pan-4"> <img width="60" height="60" src="images/chest/2.png" class="portrait">
<div> <font color="yellow"> Средний сундук </font> | Стоимость: '.img_ic(16,16,'chat').' <font color="yellow"> 250 </font></div>
<div> '.img_ic(16,16,'icons/str').' <a href=/?shop&chest&buy=2> Купить сундук </a> </div><div style="clear:both"></div></div>';
echo'<div class="pan-4"> <img width="60" height="60" src="images/chest/3.png" class="portrait">
<div> <font color="yellow"> Большой сундук </font> | Стоимость: '.img_ic(16,16,'chat').' <font color="yellow"> 500 </font></div>
<div> '.img_ic(16,16,'icons/str').' <a href=/?shop&chest&buy=3> Купить сундук </a> </div><div style="clear:both"></div></div>';
back("/?shop");
include_once'sys/foot.php';