Файл: slando.icu/modules/profile/sunduk.php
Строк: 573
<?php
$mem_start = memory_get_usage();
require '../../system/func_for_game2.inc.php';
if (isset($_GET['m'])) {$mod=vvod($_GET['m']);} else {$mod="";}
switch($mod)
{
default:
$kol_na_str=5;
$total = mysqli_num_rows(mysqli_query($link,"select id from `inventar` WHERE `id_user`= '".$user['id']."' and `act`='0' and `rinok`='0' "));
$count_pages = ceil($total/$kol_na_str);
$page = (isset($_GET['page']) and is_numeric($_GET['page']) and $_GET['page']>1 and $_GET['page']<=$count_pages) ? $_GET['page'] : 1;
$start = $page*$kol_na_str-$kol_na_str;
$q=mysqli_query($link,"SELECT * FROM `inventar` WHERE `id_user`= '".$user['id']."' and `act`='0' and `rinok`='0' order by `id` desc limit ".$start.",".$kol_na_str);
head2('Сундук');
if(isset($_SESSION['pokaz'])){echo''.$_SESSION['pokaz'].'';unset($_SESSION['pokaz']);}
echo'<div class="block1 center"><table style=" vertical-align:top;">';
while($r = mysqli_fetch_array($q))
{
if($r['tip']==0){
$sr=mysqli_fetch_array(mysqli_query($link,"SELECT * FROM `inventar` WHERE `id_user`='".num($user['id'])."' and `chast`='".num($r['chast'])."' and `tip`='0' and `act`='1' "));
$sr=$r['att']-$sr['att']+$r['hp']-$sr['hp'];
if($sr==0){$sr='';}elseif($sr>0){$sr='<span class="clrt9">(+'.$sr.')</span>';}else{$sr='<span class="clrt10">('.$sr.')</span>';}
echo'
<tr>
<td style="width:65px;vertical-align:top;padding:5px 0px 0px 0px;"><div><img width="60px" src="/images/icon/shop/'.$r['id_shop'].'.png" alt=" " /></div></td>
<td style="vertical-align:top;text-align:left;"><a class="chatsend" href="/profile/sunduk?m=del&id='.$r['id'].'">'.img(100,'png').' </a><span class="clrt2">'.$r['name'].'</span> '.$sr.'<br/>';
if($r['att']>0){echo'<span class="clrt7">Атака: '.$r['att'].'</span>';if($r['ul']>0){echo' <span class="clrt9 medium">+'.num(pow($r['ul'],1.2)*1.5).'</span>';}if($r['skor']>0){echo', <span class="clrt7">Скорость: '.$r['skor'].'</span>';}}
if($r['hp']>0){echo'<span class="clrt7">Здоровье</span>: <span class="clrt7">'.$r['hp'].'</span>';if($r['ul']>0){echo' <span class="clrt9 medium">+'.num(pow($r['ul'],1.3)*2).'</span>';}}
echo'<div style="margin:5px 0px 0px 0px;">';
if($user['lvl']>=$r['lvlmin']){echo'<div style="padding:0px 0px 10px 0px;display:inline-block;"><a class="ssilki5" href="/profile/sunduk?m=act&id='.$r['id'].'">Одеть</a></div> <a class="ssilki5" href="/profile/sunduk?m=up&id='.$r['id'].'">Улучшить</a> </div>';}else{echo'<br/>с '.$r['lvlmin'].' ур.';}
echo'</td>
</tr>
<tr><th colspan="2" style="font-weight:normal;"><div style="margin:10px 0px 0px 0px;" class="razriv7"></div></th></tr>
';
}
else{
$sr=mysqli_fetch_array(mysqli_query($link,"SELECT * FROM `inventar` WHERE `id_user`='".num($user['id'])."' and `chast`='".num($r['chast'])."' and `tip`='1' and `act`='1' "));
$sr=$r['att']-$sr['att']+$r['hp']-$sr['hp'];
if($r['chast']==1 or $r['chast']==2 or $r['chast']==3 or $r['chast']==4 or $r['chast']==5){$text_art='Атака';}elseif($r['chast']==6){$text_art='Корпус';}
elseif($r['chast']==7){$text_art='Трюм';}elseif($r['chast']==8){$text_art='Маневренность';}elseif($r['chast']==9){$text_art='Точность';}
elseif($r['chast']==10){$text_art='Атака';}elseif($r['chast']==11){$text_art='Здоровье';}
if($sr==0){$sr='';}elseif($sr>0){$sr='<span class="clrt9">(+'.$sr.')</span>';}else{$sr='<span class="clrt10">('.$sr.')</span>';}
echo'
<tr>
<td style="width:65px;vertical-align:top;padding:5px 0px 0px 0px;"><div><img width="60px" src="/images/icon/arts/'.$r['id_shop'].'.png" alt=" " /></div></td>
<td style="vertical-align:top;text-align:left;"><a class="chatsend" href="/profile/sunduk?m=del_arts&id='.$r['id'].'">'.img(100,'png').' </a><span class="clrt2">'.$r['name'].'</span> '.$sr.'<br/>
<span class="clrt7">'.$text_art.': '.$r['att'].'</span>';
if($r['time']>0){echo'<div class="clrt1 medium">'.difference($r['time']-$time).'</div>';}
echo'<div style="margin:5px 0px 0px 0px;">';
if($user['lvl']>=$r['lvlmin']){echo'<div style="padding:0px 0px 10px 0px;display:inline-block;"><a class="ssilki5" href="/profile/sunduk?m=act_art&id='.$r['id'].'">Активировать</a></div> </div>';}else{echo'<br/>с '.$r['lvlmin'].' ур.';}
echo'</td>
</tr>
<tr><th colspan="2" style="font-weight:normal;"><div style="margin:10px 0px 0px 0px;" class="razriv7"></div></th></tr>
';
}
}
echo'</table>';
navi($page, $count_pages, '/profile/sunduk?page=');
echo'
<a class="ssilki3" href="/profile">Назад</a>
<a class="ssilki3" href="/profile/rig?m=create">Создать</a>
<a class="ssilki3" href="/profile/sunduk?m=sunduki">Сундуки</a>';
break;
/////////////
case 'act':
if(isset($_GET['id'])){$id=num($_GET['id']);}else{$id=0;}
$shop=mysqli_fetch_array(mysqli_query($link,"SELECT * FROM `inventar` WHERE `id`='$id' and `id_user`='".num($user['id'])."' and `act`='0' and `tip`='0' and `rinok`='0' "));
if($shop['id']>0){
if($user['lvl']>=$shop['lvlmin']){
$sr=mysqli_fetch_array(mysqli_query($link,"SELECT id FROM `inventar` WHERE `id_user`='".num($user['id'])."' and `chast`='".num($shop['chast'])."' and `act`='1' and `tip`='0' "));
if($sr['id']>0){
/*mysqli_query($link,"UPDATE `inventar` SET `act`='0' WHERE `id`='".num($sr['id'])."'");*/
mysqli_query($link,"UPDATE `inventar` SET `act`='0' WHERE `id_user`='".num($user['id'])."' and `chast`='".num($shop['chast'])."' and `act`='1' and `tip`='0' ");}
mysqli_query($link,"UPDATE `inventar` SET `act`='1' WHERE `id`='".num($shop['id'])."'");
}
}
go("/profile/sunduk");
break;
/////////////
case 's':
if(isset($_GET['id'])){$id=num($_GET['id']);}else{$id=0;}
$shop=mysqli_fetch_array(mysqli_query($link,"SELECT * FROM `inventar` WHERE `id`='$id' and `id_user`='".num($user['id'])."' and `act`='1' "));
if($shop['id']>0){
mysqli_query($link,"UPDATE `inventar` SET `act`='0' WHERE `id`='".num($shop['id'])."'");
}
go("/profile/rig");
break;
/////////////
case 'up':
if(isset($_GET['id'])){$id=num($_GET['id']);}else{$id=0;}
$shop=mysqli_fetch_array(mysqli_query($link,"SELECT * FROM `inventar` WHERE `id`='$id' and `id_user`='".num($user['id'])."' and `tip`='0' "));
if($shop['id']>0){
$sr=mysqli_fetch_array(mysqli_query($link,"SELECT * FROM `inventar` WHERE `id_user`='".num($user['id'])."' and `chast`='".num($shop['chast'])."' and `act`='1' "));
$sr=$shop['att']-$sr['att']+$shop['hp']-$sr['hp'];
if($sr==0){$sr='';}elseif($sr>0){$sr='<span class="clrt9">(+'.$sr.')</span>';}else{$sr='<span class="clrt10">('.$sr.')</span>';}
if($shop['ul']==4 or $shop['ul']==9 or $shop['ul']==14 or $shop['ul']==17 or $shop['ul']==19 or $shop['ul']==22 or $shop['ul']==24 or $shop['ul']==27 or $shop['ul']==29 or $shop['ul']==32 or $shop['ul']==34 or $shop['ul']==37 or $shop['ul']==39 or $shop['ul']==42or $shop['ul']==44 or $shop['ul']==47 or $shop['ul']==49 or $shop['ul']==52 or $shop['ul']==54){
$navup='gold';$imgup='<img src="/images/24.png" alt="Пиастры" />';$costup=num(pow($shop['ul']+1,1.5)*2);}
else{$navup='money';$imgup='<img src="/images/3.png" alt="Серебро" />';$costup=num(pow($shop['ul']+1,1.5)*100)+200;}
if($shop['ul']<5){$ribanav='kost_akul_molot';$ribaimg=''.img(31,'png').'';$ribacost=num($shop['ul']*4+5);}
elseif($shop['ul']<10 and $shop['ul']>4){$ribanav='kost_bel_akula';$ribaimg=''.img(30,'png').'';$ribacost=num($shop['ul']*3+5);}
elseif($shop['ul']<15 and $shop['ul']>9){$ribanav='kozha_akula_bik';$ribaimg=''.img(33,'png').'';$ribacost=num($shop['ul']*2+5);}
elseif($shop['ul']<20 and $shop['ul']>14){$ribanav='kozha_kosatka';$ribaimg=''.img(32,'png').'';$ribacost=num($shop['ul']+5);}
elseif($shop['ul']<25 and $shop['ul']>19){$ribanav='kost_rif_akula';$ribaimg=''.img(39,'png').'';$ribacost=num($shop['ul']+5);}
elseif($shop['ul']<30 and $shop['ul']>24){$ribanav='kost_tigr_akula';$ribaimg=''.img(37,'png').'';$ribacost=num($shop['ul']+5);}
elseif($shop['ul']<35 and $shop['ul']>29){$ribanav='kost_kit_akula';$ribaimg=''.img(38,'png').'';$ribacost=num($shop['ul']+5);}
elseif($shop['ul']<40 and $shop['ul']>34){$ribanav='kozha_g_kit';$ribaimg=''.img(29,'png').'';$ribacost=num($shop['ul']+5);}
elseif($shop['ul']>39){$ribanav='kozha_b_kit';$ribaimg=''.img(34,'png').'';$ribacost=num($shop['ul']+5);}
if(!isset($_GET['ok'])){
head2('Улучшение');
echo'<div class="block1 center">';
if(isset($_SESSION['pokaz'])){echo''.$_SESSION['pokaz'].'';unset($_SESSION['pokaz']);}
echo'<table style=" vertical-align:top;">
<tr>
<td style="width:80px;"><div><img src="/images/icon/shop/'.$shop['id_shop'].'.png" alt=" " /></div></td>
<td style="vertical-align:top;text-align:left;"><span class="clrt2">'.$shop['name'].'</span> '.$sr.'<br/>';
if($shop['att']>0){echo'<span class="clrt7">Атака: '.$shop['att'].'</span>';if($shop['ul']>0){echo'<span class="clrt9 medium">+'.num(pow($shop['ul'],1.2)*1.5).'</span>';}
if($shop['skor']>0){echo', <span class="clrt7">Скорость: '.$shop['skor'].'</span>';}}
if($shop['hp']>0){echo'<span class="clrt7">Здоровье</span>: <span class="clrt7">'.$shop['hp'].'</span>'; if($shop['ul']>0){echo' <span class="clrt9 medium">+'.num(pow($shop['ul'],1.3)*2).'</span>';}}
echo'<div>';
if($shop['ul']<$shop['komplekt']*5){echo''.$imgup.''.$costup.', '.$ribaimg.''.$ribacost.'<br/><a class="ssilki5" href="/profile/sunduk?m=up&id='.$shop['id'].'&ok">Улучшить</a></div>';}
echo'</td>
</tr>
<tr><th colspan="2" style="font-weight:normal;"><div style="margin:10px 0px 0px 0px;" class="razriv7"></div></th></tr></table>
';
echo'<a class="ssilki3" href="/profile/sunduk">Назад</a>';
}else{
if($user[''.$navup.'']>=$costup and $user[''.$ribanav.'']>=$ribacost){
mysqli_query($link,"UPDATE `users` SET `$navup`=`$navup`-'$costup',`$ribanav`=`$ribanav`-'$ribacost' WHERE `id`='".num($user['id'])."' ");
mysqli_query($link,"UPDATE `inventar` SET `ul`=`ul`+'1' WHERE `id`='".num($shop['id'])."'");
}else{
$_SESSION['pokaz']='<div class="error">У вас недостаточно средств для улучшения</div>';
}
go("/profile/sunduk?m=up&id=$id");
}
}else{go("/profile/sunduk");}
break;
/////////////
case 'del':
if(isset($_GET['id'])){$id=num($_GET['id']);}else{$id=0;}
$shop=mysqli_fetch_array(mysqli_query($link,"SELECT * FROM `inventar` WHERE `id`='$id' and `id_user`='".num($user['id'])."' and `tip`='0' and `rinok`='0' "));
if($shop['id']>0){
$shop2=mysqli_fetch_array(mysqli_query($link,"SELECT * FROM `shop` WHERE `id`='".$shop['id_shop']."' "));
$cost=num($shop2['cost']*0.3+$shop2['gold']*40+$shop['ul']*100);
if(!isset($_GET['ok'])){
$sr=mysqli_fetch_array(mysqli_query($link,"SELECT * FROM `inventar` WHERE `id_user`='".num($user['id'])."' and `chast`='".num($shop['chast'])."' and `act`='1' "));
$sr=$shop['att']-$sr['att']+$shop['hp']-$sr['hp'];
if($sr==0){$sr='';}elseif($sr>0){$sr='<span class="clrt9">(+'.$sr.')</span>';}else{$sr='<span class="clrt10">('.$sr.')</span>';}
head2('Сундук');
echo'<div class="block1 center">
<table style=" vertical-align:top;">
<tr>
<td style="width:80px;"><div><img src="/images/icon/shop/'.$shop['id_shop'].'.png" alt=" " /></div></td>
<td style="vertical-align:top;text-align:left;"><span class="clrt2">'.$shop['name'].'</span> '.$sr.'<br/>';
if($shop['att']>0){echo'<span class="clrt7">Атака: '.$shop['att'].'</span>';if($shop['ul']>0){echo'<span class="clrt9 medium">+'.num(pow($shop['ul'],1.2)*1.5).'</span>';}
if($shop['skor']>0){echo', <span class="clrt7">Скорость: '.$shop['skor'].'</span>';}}
if($shop['hp']>0){echo'<span class="clrt7">Здоровье</span>: <span class="clrt7">'.$shop['hp'].'</span>'; if($shop['ul']>0){echo' <span class="clrt9 medium">+'.num(pow($shop['ul'],1.3)*2).'</span>';}}
echo'<div></td>
</tr>
<tr><th colspan="2" style="font-weight:normal;"><div style="margin:10px 0px 0px 0px;" class="razriv7"></div></th></tr></table>
<div class="clrt7">Вы уверены, что желаете выкинуть эту вещь?<br/>Вы получите: <img src="/images/3.png" alt="Серебро" />'.$cost.'</div>
<a class="ssilki5" href="/profile/sunduk?m=del&id='.$shop['id'].'&ok">Да</a>
<a class="ssilki5" href="/profile/sunduk">Нет</a>
<div style="margin:10px 0px 0px 0px;" class="razriv7"></div>
<a class="ssilki3" href="/profile/sunduk">Назад</a>';
}else{
mysqli_query($link,"DELETE FROM `inventar` WHERE `id` = '$id'");
mysqli_query($link,"UPDATE `users` SET `money`=`money`+'$cost' WHERE `id`='".num($user['id'])."'");
go("/profile/sunduk");
}
}else{go("/profile/sunduk");}
break;
/////////////
case 'act_art':
if(isset($_GET['id'])){$id=num($_GET['id']);}else{$id=0;}
$shop=mysqli_fetch_array(mysqli_query($link,"SELECT * FROM `inventar` WHERE `id`='$id' and `id_user`='".num($user['id'])."' and `act`='0' and `tip`='1' and `rinok`='0' "));
if($shop['id']>0){
if($user['lvl']>=$shop['lvlmin']){
$sr=mysqli_num_rows(mysqli_query($link,"SELECT * FROM `inventar` WHERE `id_user`='".num($user['id'])."' and `act`='1' and `tip`='1' "));
if($sr>=$arts_max){
$_SESSION['pokaz']='<div class="error">Одновременно может быть активировано не более '.$arts_max.' артефактов</div>';}else{
$sr=mysqli_fetch_array(mysqli_query($link,"SELECT id FROM `inventar` WHERE `id_user`='".num($user['id'])."' and `chast`='".num($shop['chast'])."' and `act`='1' and `tip`='1' "));
if($sr['id']>0){
mysqli_query($link,"UPDATE `inventar` SET `act`='0' WHERE `id_user`='".num($user['id'])."' and `chast`='".num($shop['chast'])."' and `act`='1' and `tip`='1' ");}
mysqli_query($link,"UPDATE `inventar` SET `act`='1' WHERE `id`='".num($shop['id'])."'");
}
}
}
go("/profile/sunduk");
break;
/////////////
case 'del_arts':
if(isset($_GET['id'])){$id=num($_GET['id']);}else{$id=0;}
$shop=mysqli_fetch_array(mysqli_query($link,"SELECT * FROM `inventar` WHERE `id`='$id' and `id_user`='".num($user['id'])."' and `tip`='1' and `rinok`='0'"));
if($shop['id']>0){
$shop2=mysqli_fetch_array(mysqli_query($link,"SELECT max,money FROM `arts` WHERE `id`='".$shop['id_shop']."' "));
if($shop['att']==$shop2['max']){$cost=num($shop2['money']/10);}else{$cost=num($shop2['money']/20);}
if(!isset($_GET['ok'])){
$sr=mysqli_fetch_array(mysqli_query($link,"SELECT * FROM `inventar` WHERE `id_user`='".num($user['id'])."' and `chast`='".num($shop['chast'])."' and `tip`='1' and `act`='1' "));
$sr=$shop['att']-$sr['att']+$shop['hp']-$sr['hp'];
if($sr==0){$sr='';}elseif($sr>0){$sr='<span class="clrt9">(+'.$sr.')</span>';}else{$sr='<span class="clrt10">('.$sr.')</span>';}
head2('Сундук');
echo'<div class="block1 center">
<table style=" vertical-align:top;">
<tr>
<td style="width:80px;"><div><img width="60px" src="/images/icon/arts/'.$shop['id_shop'].'.png" alt=" " /></div></td>
<td style="vertical-align:top;text-align:left;"><span class="clrt2">'.$shop['name'].'</span> '.$sr.'<br/>';
if($shop['att']>0){echo'<span class="clrt7">Атака: '.$shop['att'].'</span>';if($shop['ul']>0){echo'<span class="clrt9 medium">+'.num(pow($shop['ul'],1.2)*1.5).'</span>';}
if($shop['skor']>0){echo', <span class="clrt7">Скорость: '.$shop['skor'].'</span>';}}
if($shop['hp']>0){echo'<span class="clrt7">Здоровье</span>: <span class="clrt7">'.$shop['hp'].'</span>'; if($shop['ul']>0){echo' <span class="clrt9 medium">+'.num(pow($shop['ul'],1.3)*2).'</span>';}}
echo'<div></td>
</tr>
<tr><th colspan="2" style="font-weight:normal;"><div style="margin:10px 0px 0px 0px;" class="razriv7"></div></th></tr></table>
<div class="clrt7">Вы уверены, что желаете выкинуть эту вещь?<br/>Вы получите: <img src="/images/3.png" alt="Серебро" />'.$cost.'</div>
<a class="ssilki5" href="/profile/sunduk?m=del_arts&id='.$shop['id'].'&ok">Да</a>
<a class="ssilki5" href="/profile/sunduk">Нет</a>
<div style="margin:10px 0px 0px 0px;" class="razriv7"></div>
<a class="ssilki3" href="/profile/sunduk">Назад</a>';
}else{
mysqli_query($link,"DELETE FROM `inventar` WHERE `id` = '$id'");
mysqli_query($link,"UPDATE `users` SET `money`=`money`+'$cost' WHERE `id`='".num($user['id'])."'");
go("/profile/sunduk");
}
}else{go("/profile/sunduk");}
break;
/////////////
case 'sunduki':
if(!isset($_GET['t'])){
head2('Сундуки');
echo'<div class="block1 center">';
if($user['sunduk_epik']==0 and $user['sunduk_zakold']==0){
echo'<div class="clrt7">У вас нет сундуков.</div>';
}else{
if($user['sunduk_epik']>0){
echo'
<div>
<div class="clrt2">Эпический сундук</div>
<div><img width="40%" src="/images/147.png" alt=" " /></div>
<div class="clrt7">'.$user['sunduk_epik'].' шт</div>
<a class="ssilki2" href="/profile/sunduk?m=sunduki&t=1">Открыть</a>
</div>
<div class="razriv7"></div>';
}
if($user['sunduk_zakold']>0){
echo'
<div>
<div class="clrt2">Заколдованный сундук</div>
<div><img width="40%" src="/images/146.png" alt=" " /></div>
<div class="clrt7">'.$user['sunduk_zakold'].' шт</div>
<a class="ssilki2" href="/profile/sunduk?m=sunduki&t=2">Открыть</a>
</div>';
}
}
echo'<a class="ssilki3" href="/profile/sunduk">Назад</a>';
}else{
$tip=num($_GET['t']);
if($tip==1){
if($user['sunduk_epik']==0){
go("/profile/sunduk?m=sunduki");
}else{
$tip_n=rand(1,3);$arts='';$money=0;$gold=0;
if($tip_n==1){$money=rand(10000,25000);
mysqli_query($link,"UPDATE `users` SET `money`=`money`+'$money',`sunduk_epik`=`sunduk_epik`-1 WHERE `id`='".num($user['id'])."' ");
}
elseif($tip_n==2){$gold=rand(10,20);
mysqli_query($link,"UPDATE `users` SET `gold`=`gold`+'$gold',`sunduk_epik`=`sunduk_epik`-1 WHERE `id`='".num($user['id'])."' ");}
elseif($tip_n==3){
$shop=mysqli_fetch_array(mysqli_query($link,"SELECT * FROM `arts` WHERE `lvl_min`<'".num($user['lvl']+1)."' and `caribi_money`=0 ORDER BY RAND() LIMIT 1 "));
$arts='<br/><img style="margin:2px 0 5px 0;" width="70px" src="/images/icon/arts/'.$shop['id'].'.png" alt="" />';
$shop['bon']=rand($shop['min'],$shop['max']);
mysqli_query($link,"UPDATE `users` SET `sunduk_epik`=`sunduk_epik`-1 WHERE `id`='".num($user['id'])."' ");
mysqli_query($link,"INSERT INTO `inventar`(`id`,`id_user`,`tip`,`id_shop`,`name`,`chast`,`komplekt`,`lvlmin`,`att`,`skor`,`hp`)VALUES('','".num($user['id'])."','1','".$shop['id']."','".$shop['name']."','".$shop['chast']."','1','".$shop['lvl_min']."','".$shop['bon']."','0','0')");
}
head2('Сундуки');
echo'<div class="block1 center">
<div class="clrt2">Эпический сундук</div>
<div><img width="40%" src="/images/147.png" alt=" " /></div>
<div class="clrt0">В сундуке было:</div>';
if($money>0){echo'<img src="/images/3.png" alt="Серебро" />'.$money.'';}
if($gold>0){echo' <img src="/images/24.png" alt="Пиастры" />'.$gold.'';}
echo''.$arts.'';
echo'<a class="ssilki2" href="/profile/sunduk?m=sunduki">Далее</a>';
}
}
elseif($tip==2){
if($user['sunduk_zakold']==0){
go("/profile/sunduk?m=sunduki");
}else{
$tip_n=rand(1,3);$arts='';$money=0;$gold=0;
if($tip_n==1){$money=rand(5000,15000);
mysqli_query($link,"UPDATE `users` SET `money`=`money`+'$money',`sunduk_zakold`=`sunduk_zakold`-1 WHERE `id`='".num($user['id'])."' ");
}
elseif($tip_n==2){$gold=rand(5,15);
mysqli_query($link,"UPDATE `users` SET `gold`=`gold`+'$gold',`sunduk_zakold`=`sunduk_zakold`-1 WHERE `id`='".num($user['id'])."' ");}
elseif($tip_n==3){
$shop=mysqli_fetch_array(mysqli_query($link,"SELECT * FROM `arts` WHERE `lvl_min`<'".num($user['lvl']+1)."' and `caribi_money`=0 ORDER BY RAND() LIMIT 1 "));
$arts='<br/><img style="margin:2px 0 5px 0;" width="70px" src="/images/icon/arts/'.$shop['id'].'.png" alt="" />';
$shop['bon']=rand($shop['min'],$shop['max']);
mysqli_query($link,"UPDATE `users` SET `sunduk_zakold`=`sunduk_zakold`-1 WHERE `id`='".num($user['id'])."' ");
mysqli_query($link,"INSERT INTO `inventar`(`id`,`id_user`,`tip`,`id_shop`,`name`,`chast`,`komplekt`,`lvlmin`,`att`,`skor`,`hp`)VALUES('','".num($user['id'])."','1','".$shop['id']."','".$shop['name']."','".$shop['chast']."','1','".$shop['lvl_min']."','".$shop['bon']."','0','0')");
}
head2('Сундуки');
echo'<div class="block1 center">
<div class="clrt2">Заколдованный сундук</div>
<div><img width="40%" src="/images/146.png" alt=" " /></div>
<div class="clrt0">В сундуке было:</div>';
if($money>0){echo'<img src="/images/3.png" alt="Серебро" />'.$money.'';}
if($gold>0){echo' <img src="/images/24.png" alt="Пиастры" />'.$gold.'';}
echo''.$arts.'';
echo'<a class="ssilki2" href="/profile/sunduk?m=sunduki">Далее</a>';
}
}else{go("/profile/sunduk?m=sunduki");}
}
break;
}
foot();
?>