Файл: impwar.tk/bag.php
Строк: 354
<?php
require_once('conf/dbc.php');
require_once('conf/session_start.php');
require_once('conf/ban.php');
if ((!isset($_SESSION['id'])) or (!isset($_SESSION['nick']))) {
?>
<script type="text/javascript">
document.location.href = "reg.php?err_login=1";
</script>
<?php
exit();
}
$page_title = 'Рюкзак';
require_once('conf/head.php');
require_once('conf/top.php');
?><br/>
<div id="main">
<div class="stats">
<p class="profile">Ваш рюкзак</p>
</div>
<?php
$user_id = abs(intval($_SESSION['id']));
$query = "Select thing_id, user_id, type, inf_id, stat1, stat2, speed, sost, privat, need_lvl from things where user_id='$user_id' and place=0 limit 20";
$result = mysqli_query($dbc, $query) or die ('Ошибка передачи запроса к БД');
$total = mysqli_num_rows($result);
?>
<div class="stats"><center>
<p class="net"> Вещей в рюкзаке <span class="bonus">[<?php echo "$total"; ?>/20]
<p><img src="img/ico/shield.png" width="12" height="12"/> <a href="clothes.php?id=<?php echo "$user_id";?>">Снаряжение</a></p>
<p><img src="img/ico/point.png" width="12" height="12"/> <a href="stash.php">Открыть тайник</a></p>
</center></div>
<?php
$err = abs(intval($_GET['err']));
if (!empty($err)) {
if ($err == 1) {
?>
<div id="error">
Тайник переполнен.
</div>
<?php
}
if ($err == 2) {
?>
<div id="error">
Одежда не для вашего уровня.
</div>
<?php
}
if ($err == 3) {
?>
<div id="error">
Рюкзак переполнен.
</div>
<?php
}
}
if ($total == 0) {
?>
<div class="stats">
<p><p class="net">У вас ничего нет в рюкзаке</p>
</div>
<?php
}
else {
$query_st = "Select max_hp, bronya, yron_p, lvl, tochn_p, yron_w, tochn_w from users where id = '$user_id'";
$result_st = mysqli_query($dbc, $query_st) or die ('Ошибка передачи запроса к БД');
$row_st = mysqli_fetch_array($result_st);
$stat1_cl = $row_st['max_hp'];
$stat2_cl = $row_st['bronya'];
$stat1_p = $row_st['yron_p'];
$stat2_p = $row_st['tochn_p'];
$stat1_w = $row_st['yron_w'];
$stat2_w = $row_st['tochn_w'];
while ($row = mysqli_fetch_array($result)) {
$thing_id = $row['thing_id'];
$type = $row['type'];
$inf_id = $row['inf_id'];
$stat1 = $row['stat1'];
$stat2 = $row['stat2'];
$speed = $row['speed'];
$sost = $row['sost'];
$privat = $row['privat'];
$bonus = $row['bonus'];
$need_lvl = $row['need_lvl'];
if ($type == 1) {////////Одежда
$query_inf = "Select name, screen,klass from clothes where clothes_id='$inf_id' limit 1";
$result_inf = mysqli_query($dbc, $query_inf) or die ('Ошибка передачи запроса к БД');
$row_inf = mysqli_fetch_array($result_inf);
$screen = $row_inf['screen'];
$name = $row_inf['name'];
$klass = $row_inf['klass'];
?>
<div class="slot">
<table width="160" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="54" valign="top"><img src="img/clothes/<?php echo "$screen";?>" alt="<?php echo "$name";?>" width="70" height="70"/></td>
<td width="106" valign="top">
<div class="clothes">
<?php
if ($klass == 1) {?><img src="img/ico/class1.png" width="12" height="12"/><?php }
if ($klass == 2) {?><img src="img/ico/class2.png" width="12" height="12"/><?php }
if ($klass == 3) {?><img src="img/ico/class3.png" width="12" height="12"/><?php }
if ($klass >= 4) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 6) {?><img src="img/ico/odinochki.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 7) {?><img src="img/ico/dolg.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 8) {?><img src="img/ico/svoboda.png" width="12" height="12"/><?php }
?>
<a href="thing.php?thing=<?php echo "$thing_id";?>" class="white"><?php echo "$name";?></a>
<p><span class="white"><?php echo "$need_lvl";?> ур,</span
><?php
if ($privat == 0) { echo "новый";}
if ($privat == 1) { echo "личный";}
$better = (($stat1 - $stat1_cl) + ($stat2 - $stat2_cl));
if ($better > 0) {?> <span class="bonus">(Лучше на <?php echo "+$better";?>)</span><?php }?>
</p>
</div>
</td>
</tr>
</tbody>
</table>
<p>[<a href="instash.php?thing=<?php echo "$thing_id"?>">В тайник</a>] [<a href="wear.php?thing=<?php echo "$thing_id"?>">Надеть</a>] [<a href="out_thing.php?thing=<?php echo "$thing_id"?>" onclick="return confirm
('Уверены?')">
<?
?><?php
if ($sost == 0) {?>Выкинуть<?php }
if ($sost == 1) {?>На <img src="img/ico/materials.png" width="12" height="12"/>30<?php }
if ($sost == 2) {?>На <img src="img/ico/materials.png" width="12" height="12"/>60<?php }
if ($sost == 3) {?>На <img src="img/ico/materials.png" width="12" height="12"/>90<?php }
if ($sost == 4) {?>На <img src="img/ico/materials.png" width="12" height="12"/>120<?php }
if ($sost == 5) {?>На <img src="img/ico/materials.png" width="12" height="12"/>150<?php }
if ($sost == 6) {?>На <img src="img/ico/materials.png" width="12" height="12"/>180<?php }
if ($sost == 7) {?>На <img src="img/ico/materials.png" width="12" height="12"/>210<?php }
if ($sost == 8) {?>На <img src="img/ico/materials.png" width="12" height="12"/>240<?php }
?>
</a>]</p>
</div>
<?php
}
if ($type == 2) {////////Пистолеты
$query_inf = "Select name, screen,klass from pistols where pistols_id='$inf_id' limit 1";
$result_inf = mysqli_query($dbc, $query_inf) or die ('Ошибка передачи запроса к БД');
$row_inf = mysqli_fetch_array($result_inf);
$screen = $row_inf['screen'];
$name = $row_inf['name'];
$klass = $row_inf['klass'];
?>
<div class="slot">
<table width="160" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="54" valign="top"><img src="img/weapons/<?php echo "$screen";?>" alt="<?php echo "$name";?>" /></td>
<td width="106" valign="top">
<div class="clothes">
<?php
if ($klass == 1) {?><img src="img/ico/class1.png" width="12" height="12"/><?php }
if ($klass == 2) {?><img src="img/ico/class2.png" width="12" height="12"/><?php }
if ($klass == 3) {?><img src="img/ico/class3.png" width="12" height="12"/><?php }
if ($klass >= 4) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 6) {?><img src="img/ico/odinochki.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 7) {?><img src="img/ico/dolg.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 8) {?><img src="img/ico/svoboda.png" width="12" height="12"/><?php }
?>
<a href="thing.php?thing=<?php echo "$thing_id";?>" class="white"><?php echo "$name";?></a>
<p><span class="white"><?php echo "$need_lvl";?> ур,</span
><?php
if ($privat == 0) { echo "новый";}
if ($privat == 1) { echo "личный";}
$better = (($stat1 - $stat1_p) + ($stat2 - $stat2_p));
if ($better > 0) {?> <span class="bonus">(Лучше на <?php echo "+$better";?>)</span><?php }?>
</p>
</div>
</td>
</tr>
</tbody>
</table>
<p>[<a href="instash.php?thing=<?php echo "$thing_id"?>">В тайник</a>] [<a href="wear.php?thing=<?php echo "$thing_id"?>">Надеть</a>] [<a href="upgrade.php?thing=<?php echo "$thing_id"?>">Улучшить</a>] [<a href="out_thing.php?thing=<?php echo "$thing_id"?>" onclick="return confirm
('Уверены?')">
<?
?><?php
if ($sost == 0) {?>Выкинуть<?php }
if ($sost == 1) {?>На <img src="img/ico/materials.png" width="12" height="12"/>30<?php }
if ($sost == 2) {?>На <img src="img/ico/materials.png" width="12" height="12"/>60<?php }
if ($sost == 3) {?>На <img src="img/ico/materials.png" width="12" height="12"/>90<?php }
if ($sost == 4) {?>На <img src="img/ico/materials.png" width="12" height="12"/>120<?php }
if ($sost == 5) {?>На <img src="img/ico/materials.png" width="12" height="12"/>150<?php }
if ($sost == 6) {?>На <img src="img/ico/materials.png" width="12" height="12"/>180<?php }
if ($sost == 7) {?>На <img src="img/ico/materials.png" width="12" height="12"/>210<?php }
if ($sost == 8) {?>На <img src="img/ico/materials.png" width="12" height="12"/>240<?php }
?></a>]</p>
</div>
<?php
}
if ($type == 6) {
$query_inf = "Select name,
screen,klass from artefact where
artefact_id='$inf_id' limit 1";
$result_inf = mysqli_query($dbc, $query_inf) or die ('Ошибка передачи запроса к БД');
$row_inf = mysqli_fetch_array($result_inf);
$screen = $row_inf['screen'];
$name = $row_inf['name'];
$klass = $row_inf['klass'];
?>
<div class="slot">
<div class="clothes">
<img src="img/artefact/<?php echo "$screen";?>" alt="<?php echo"$name";?>" width="50" height="50"/><p><?php
if ($klass == 1) {?><img src="img/ico/class1.png" width="12" height="12"/><?php }
if ($klass == 2) {?><img src="img/ico/class2.png" width="12" height="12"/><?php }
if ($klass == 3) {?><img src="img/ico/class3.png" width="12" height="12"/><?php }
if ($klass >= 4) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 6) {?><img src="img/ico/odinochki.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 7) {?><img src="img/ico/dolg.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 8) {?><img src="img/ico/svoboda.png" width="12" height="12"/><?php }
?><a href="thing.php?thing=<?php echo "$thing_id";?>" class="white"><?php echo "$name";?></a></p><p><span class="white"><?php
echo "$need_lvl";?> ур,</span><?php
if ($privat == 0) { echo"новый";}
if ($privat == 1) { echo"личный";}
$better = (($stat1 - $stat1_w) + ($stat2 - $stat2_w));
if ($better > 0) {?> <span class="bonus">(Лучше на <?php echo"+$better";?>)</span><?php }?>
</p></div>
<p>[<a href="instash.php?
thing=<?php echo "$thing_id"?>">В
тайник</a>] [<a href="wear.php?
thing=<?php echo "$thing_id"?>
">Надеть</a>] [<a href="upgrade.php?thing=<?php
echo "$thing_id"?>">Улучшить</a>]
[<a href="out_thing.php?thing=<?php echo "$thing_id"?>" onclick="return confirm('Уверены?')">
<?
?><?php
if ($sost == 0) {?>Выкинуть<?php }
if ($sost == 1) {?>На <img src="img/ico/materials.png" width="12" height="12"/>30<?php }
if ($sost == 2) {?>На <img src="img/ico/materials.png" width="12" height="12"/>60<?php }
if ($sost == 3) {?>На <img src="img/ico/materials.png" width="12" height="12"/>90<?php }
if ($sost == 4) {?>На <img src="img/ico/materials.png" width="12" height="12"/>120<?php }
if ($sost == 5) {?>На <img src="img/ico/materials.png" width="12" height="12"/>150<?php }
if ($sost == 6) {?>На <img src="img/ico/materials.png" width="12" height="12"/>180<?php }
if ($sost == 7) {?>На <img src="img/ico/materials.png" width="12" height="12"/>210<?php }
if ($sost == 8) {?>На <img src="img/ico/materials.png" width="12" height="12"/>240<?php }
?></a>]</p></div>
<?php
}
if ($type == 3) {////////Автоматы
$query_inf = "Select name, screen,klass from weapons where weapons_id='$inf_id' limit 1";
$result_inf = mysqli_query($dbc, $query_inf) or die ('Ошибка передачи запроса к БД');
$row_inf = mysqli_fetch_array($result_inf);
$screen = $row_inf['screen'];
$name = $row_inf['name'];
$klass = $row_inf['klass'];
?>
<div class="slot">
<div class="clothes">
<img src="img/weapons/<?php echo "$screen";?>" alt="<?php echo "$name";?>" width="145" height="50"/>
<p>
<?php
if ($klass == 1) {?><img src="img/ico/class1.png" width="12" height="12"/><?php }
if ($klass == 2) {?><img src="img/ico/class2.png" width="12" height="12"/><?php }
if ($klass == 3) {?><img src="img/ico/class3.png" width="12" height="12"/><?php }
if ($klass >= 4) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 6) {?><img src="img/ico/odinochki.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 7) {?><img src="img/ico/dolg.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 8) {?><img src="img/ico/svoboda.png" width="12" height="12"/><?php }
?><a href="thing.php?thing=<?php echo "$thing_id";?>" class="white"><?php echo "$name";?></a></p>
<p><span class="white"><?php echo "$need_lvl";?> ур,</span
><?php
if ($privat == 0) { echo "новый";}
if ($privat == 1) { echo "личный";}
$better = (($stat1 - $stat1_w) + ($stat2 - $stat2_w));
if ($better > 0) {?> <span class="bonus">(Лучше на <?php echo "+$better";?>)</span><?php }?>
</p>
</div>
<p>[<a href="instash.php?thing=<?php echo "$thing_id"?>">В тайник</a>] [<a href="wear.php?thing=<?php echo "$thing_id"?>">Надеть</a>] [<a href="upgrade.php?thing=<?php echo "$thing_id"?>">Улучшить</a>] [<a href="out_thing.php?thing=<?php echo "$thing_id"?>" onclick="return confirm
('Уверены?')">
<?
?><?php
if ($sost == 0) {?>Выкинуть<?php }
if ($sost == 1) {?>На <img src="img/ico/materials.png" width="12" height="12"/>30<?php }
if ($sost == 2) {?>На <img src="img/ico/materials.png" width="12" height="12"/>60<?php }
if ($sost == 3) {?>На <img src="img/ico/materials.png" width="12" height="12"/>90<?php }
if ($sost == 4) {?>На <img src="img/ico/materials.png" width="12" height="12"/>120<?php }
if ($sost == 5) {?>На <img src="img/ico/materials.png" width="12" height="12"/>150<?php }
if ($sost == 6) {?>На <img src="img/ico/materials.png" width="12" height="12"/>180<?php }
if ($sost == 7) {?>На <img src="img/ico/materials.png" width="12" height="12"/>210<?php }
if ($sost == 8) {?>На <img src="img/ico/materials.png" width="12" height="12"/>240<?php }
?></a>]</p>
</div>
<?php
}
if ($type == 4) {////////Шлемы
$query_inf = "Select name, screen,klass from shlem where shlem_id='$inf_id' limit 1";
$result_inf = mysqli_query($dbc, $query_inf) or die ('Ошибка передачи запроса к БД');
$row_inf = mysqli_fetch_array($result_inf);
$screen = $row_inf['screen'];
$name = $row_inf['name'];
$klass = $row_inf['klass'];
?>
<div class="slot">
<table width="160" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="54" valign="top"><img src="img/shlem/<?php echo "$screen";?>" alt="<?php echo "$name";?>" width="55" height="55"/></td>
<td width="106" valign="top">
<div class="clothes">
<?php
if ($klass == 1) {?><img src="img/ico/class1.png" width="12" height="12"/><?php }
if ($klass == 2) {?><img src="img/ico/class2.png" width="12" height="12"/><?php }
if ($klass == 3) {?><img src="img/ico/class3.png" width="12" height="12"/><?php }
if ($klass >= 4) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 6) {?><img src="img/ico/odinochki.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 7) {?><img src="img/ico/dolg.png" width="12" height="12"/><?php }
if ($row_cl['klass'] == 8) {?><img src="img/ico/svoboda.png" width="12" height="12"/><?php }
?>
<a href="thing.php?thing=<?php echo "$thing_id";?>" class="white"><?php echo "$name";?></a>
<p><span class="white"><?php echo "$need_lvl";?> ур,</span
><?php
if ($privat == 0) { echo "новый";}
if ($privat == 1) { echo "личный";}
$better = (($stat1 - $stat1_cl) + ($stat2 - $stat2_cl));
if ($better > 0) {?> <span class="bonus">(Лучше на <?php echo "+$better";?>)</span><?php }?>
</p>
</div>
</td>
</tr>
</tbody>
</table>
<p>[<a href="instash.php?thing=<?php echo "$thing_id"?>">В тайник</a>] [<a href="wear.php?thing=<?php echo "$thing_id"?>">Надеть</a>] [<a href="out_thing.php?thing=<?php echo "$thing_id"?>" onclick="return confirm
('Уверены?')">
<?
?><?php
if ($sost == 0) {?>Выкинуть<?php }
if ($sost == 1) {?>На <img src="img/ico/materials.png" width="12" height="12"/>30<?php }
if ($sost == 2) {?>На <img src="img/ico/materials.png" width="12" height="12"/>60<?php }
if ($sost == 3) {?>На <img src="img/ico/materials.png" width="12" height="12"/>90<?php }
if ($sost == 4) {?>На <img src="img/ico/materials.png" width="12" height="12"/>120<?php }
if ($sost == 5) {?>На <img src="img/ico/materials.png" width="12" height="12"/>150<?php }
if ($sost == 6) {?>На <img src="img/ico/materials.png" width="12" height="12"/>180<?php }
if ($sost == 7) {?>На <img src="img/ico/materials.png" width="12" height="12"/>210<?php }
if ($sost == 8) {?>На <img src="img/ico/materials.png" width="12" height="12"/>240<?php }
?>
</a>]</p>
</div>
<?php
}
}
}
?>
</div>
<?php
if ($total > 0) {
?>
<p class="foot"><a class="foot" href="all_out_thing.php"><span class="bonus">Выкинуть все с рюкзака</a></span></p>
<?php
}
require_once('conf/navig.php');
require_once('conf/foot.php');
mysqli_close($dbc);
?>
</body>
</html>