Файл: mod/instalscript/metro/rukzak-metro.php
Строк: 110
<?php
require_once '../../../core/system.php';
$header = 'Рюкзак.Вещи с подземелья';
require_once '../../../core/head.php';
echo"<div class='player menuList'><li><a href='/rukzak.php?'>Рюкзак</a></li></div><div class='line'></div>";
$ksm = mysql_fetch_array(mysql_query("SELECT * FROM `metro_kompl_us` WHERE `id_user` = '".$user['id']."' "));
if($ksm==0){echo"Вещей нет!";}else{
###############ПРОДАЖА ШМОТКИ
if(isset($_GET['sale'])){
$si = mysql_fetch_array(mysql_query("SELECT * FROM `metro_kompl_us` WHERE `id` = '".abs(intval($_GET['sale']))."' AND `id_user`='".$user['id']."' "));
if($si==0){echo"Не выбрана вещь";}
elseif($si['act']==1){echo"Эта вещь одета на вас, нужно снять ее чтоб продать";}
elseif($si!=0 && $si['id_user']==$user['id'] && $si['act']==0){
$k1 = mysql_fetch_array(mysql_query("SELECT * FROM `metro_award` WHERE `id` = '".$si['id_shmotki']."' "));
mysql_query("UPDATE `user` SET `gold` = `gold` + '".round($k1['cena']/2)."' WHERE `id` = '".$user['id']."' limit 1");
mysql_query("DELETE FROM `metro_kompl_us` WHERE `id` = '".abs(intval($_GET['sale']))."' ");
header('Location:/mod/instalscript/metro/instalscript-bymas-rack?instalscript=1');exit;
}else{echo"Ошибка";}
}
#############ОДЕВАЕМ ШМОТКУ
if(isset($_GET['dress'])){
$ds = mysql_fetch_array(mysql_query("SELECT * FROM `metro_kompl_us` WHERE `id` = '".abs(intval($_GET['dress']))."' AND `id_user`='".$user['id']."' "));
$as = mysql_fetch_array(mysql_query("SELECT * FROM `metro_award` WHERE `id` = '".abs(intval($ds['id_shmotki']))."' "));
$type = mysql_fetch_array(mysql_query("SELECT * FROM `kompl_us` WHERE `type` = '".$as['type']."' AND `act`='1' AND `id_us`='".$user['id']."' "));
if($ds==0){echo"Не выбрана вещь";}
elseif($ds['act']==1){echo"Эта вещь уже одета на вас";}
elseif($type!=0){echo"Вещь данного типа уже одета на вас снимите, ее чтоб одеть эту";}
elseif($ds!=0 && $ds['id_user']==$user['id'] && $type==0){
$stat2 = explode(';',$as['stats']);
mysql_query("UPDATE `user` SET
`sila` = '".($user['sila']+$stat2['0'])."',
`max_health` = '".($user['max_health']+$stat2['1'])."',
`lovk` = '".($user['lovk']+$stat2['2'])."',
`zashit` = '".($user['zashit']+$stat2['3'])."',
`max_mana` ='".($user['max_mana']+$stat2['4'])."'
WHERE `id` = '".$user['id']."'")or die(mysql_error());
mysql_query("UPDATE `metro_kompl_us` SET `act` = '1' WHERE `id_user` = '".$user['id']."' AND `id`= '".abs(intval($_GET['dress']))."' ");
header('Location:/mod/instalscript/metro/instalscript-bymas-rack?instalscript=2');exit;
}else{echo"Ошибка";}
}
############СНИМАЕМ ШМОТКУ
if(isset($_GET['undress'])){
$ds = mysql_fetch_array(mysql_query("SELECT * FROM `metro_kompl_us` WHERE `id` = '".abs(intval($_GET['undress']))."' "));
$as = mysql_fetch_array(mysql_query("SELECT * FROM `metro_award` WHERE `id` = '".abs(intval($ds['id_shmotki']))."' "));
$type = mysql_fetch_array(mysql_query("SELECT * FROM `kompl_us` WHERE `type` = '".$as['type']."' AND `act`='1' "));
if($ds==0){echo"Не выбрана вещь";}
elseif($ds['id_user']!=$user['id']){echo"Эта вещь не ваша";}
elseif($ds['act']==0){echo"Эта вещь уже снята с вас";}
elseif($type!=0){echo"Вещь данного типа уже одета на вас снимите, ее чтоб одеть эту";}
elseif($ds!=0 && $ds['id_user']==$user['id'] && $type==0){
$stat2 = explode(';',$as['stats']);
mysql_query("UPDATE `user` SET
`sila` = '".($user['sila']-$stat2['0'])."',
`max_health` = '".($user['max_health']-$stat2['1'])."',
`lovk` = '".($user['lovk']-$stat2['2'])."',
`zashit` = '".($user['zashit']+$stat2['3'])."',
`max_mana` ='".($user['max_mana']-$stat2['4'])."'
WHERE `id` = '".$user['id']."'");
mysql_query("UPDATE `metro_kompl_us` SET `act` = '0' WHERE `id_user` = '".$user['id']."'");
header('Location:/mod/instalscript/metro/instalscript-bymas-rack?instalscript=3');exit;
}else{echo"Ошибка";}
}
if($_GET['instalscript']==1){echo"Вы продали вещь";}
if($_GET['instalscript']==2){echo"Вы одели вещь";}
if($_GET['instalscript']==3){echo"Вы сняли вещь";}
$kot = mysql_fetch_array(mysql_query("SELECT * FROM `metro_award` WHERE `id` = '".$ksm['id_shmotki']."' "));
$ksmm = mysql_query("SELECT * FROM `metro_kompl_us` WHERE `id_user` = '".$user['id']."' ");
while($kott = mysql_fetch_array($ksmm)){
$kot = mysql_fetch_array(mysql_query("SELECT * FROM `metro_award` WHERE `id` = '".$kott['id_shmotki']."' "));
$stat = explode(';',$kot['stats']);
echo'<div class="player">
<div class="float-left">
<img style="margin-right:10px;margin-top:3px;" width="50" height="50" src="'.$kot['url'].'"></div>
<img src="/images/icon/equip.png"><span class="yellow">'.$kot['name'].'</span><br>
'.($stat['0']>0?'<span class="dgreen"><img src="/images/icon/str.png" alt="*"/>+'.$stat['0'].'</span>':null).'
'.($stat['1']>0?'<span class="dgreen"><img src="/images/icon/vit.png" alt="*"/>+'.$stat['1'].'</span>':null).'</span>
'.($stat['2']>0?'<span class="dgreen"><img src="/images/icon/agi.png" alt="*"/>+'.$stat['2'].'</span>':null).'</span>
'.($stat['3']>0?'<span class="dgreen"><img src="/images/icon/def.png" alt="*"/>+'.$stat['3'].'</span>':null).'</span>
'.($stat['4']>0?'<span class="dgreen"><img src="/images/icon/mana.png" alt="*"/>+'.$stat['4'].'</span>':null).'</span>
<br>Тип: '.$kot['type'].'<div style="clear:both;"></div>
</div>';
if($kott['act']==0){echo'<div class="player center"><a class="btn" href="/mod/instalscript/metro/instalscript-bymas-rack?dress='.$kott['id'].'"><span class="end"><span class="label">Одеть</span></span></a></div>';}
else{echo'<div class="player center"><a class="btn" href="/mod/instalscript/metro/instalscript-bymas-rack?undress='.$kott['id'].'"><span class="end"><span class="label">Снять</span></span></a></div>';}
echo'<div class="player center"><a class="btn" href="/mod/instalscript/metro/instalscript-bymas-rack?sale='.$kott['id'].'"><span class="end"><span class="label">Продать за<img src="/images/icon/gold.png" alt="gold">'.round($kot['cena']/2).' золота</span></span></a></div>';
}
}
require_once '../../../core/foot.php';
?>