Fix mysql
This commit is contained in:
parent
058a0556d7
commit
5b34e1e706
@ -8,10 +8,12 @@
|
||||
class input
|
||||
{
|
||||
public static function get($name) {
|
||||
return isset($_GET[$name]) ? $_GET[$name] : null;
|
||||
rtrim($_GET[$name]);
|
||||
return (isset($_GET[$name]) AND !empty($_GET[$name])) ? $_GET[$name] : null;
|
||||
}
|
||||
|
||||
public static function post($name) {
|
||||
return isset($_POST[$name]) ? $_POST[$name] : null;
|
||||
rtrim($_POST[$name]);
|
||||
return (isset($_POST[$name]) AND !empty($_POST[$name])) ? $_POST[$name] : null;
|
||||
}
|
||||
}
|
31
main.php
31
main.php
@ -356,7 +356,7 @@ function showpersinv($id)
|
||||
?>
|
||||
<CENTER>
|
||||
<img src="i/align_<?= ($user['align'] > 0 ? $user['align'] : "0") ?>.gif">
|
||||
<img src="i/klan/<?= ClanImage($user['klan']) ?>.gif">;
|
||||
<img src="i/klan/<?= ClanImage($user['klan']) ?>.gif">
|
||||
<B><?= $user['login'] ?></B> [<?= $user['level'] ?>]
|
||||
<a href=inf.php?<?= $user['login'] ?> target=_blank><IMG SRC=i/inf.gif ALT="Инф. о <?= $user['login'] ?>"></a>
|
||||
|
||||
@ -2638,12 +2638,8 @@ if (isset($_GET['edit'])) {
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center><B>Рюкзак (масса : <?php
|
||||
$d = mysql_fetch_array(mysql_query("SELECT sum(`massa`) FROM `inventory` WHERE `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `setsale` = 0 ; "));
|
||||
if ($d[0] < 0) {
|
||||
$d[0] = 0;
|
||||
}
|
||||
$d = mysql_fetch_array(mysql_query("SELECT SUM(`massa`) AS `weight`, COUNT(`id`) AS `cnt` FROM `inventory` WHERE `owner` = {$user['id']} AND `dressed` = 0 AND `setsale` = 0"));
|
||||
echo $d['weight'] + 0;
|
||||
$d = db::c()->query('SELECT SUM(`massa`) AS `weight`, COUNT(`id`) AS `cnt` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `setsale` = 0',$user['id'])->fetch_assoc();
|
||||
echo $d['weight'];
|
||||
?>/<?= get_meshok() ?>)</B>
|
||||
</td>
|
||||
</tr>
|
||||
@ -2652,29 +2648,30 @@ if (isset($_GET['edit'])) {
|
||||
<table BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
|
||||
<?php
|
||||
if ($_SESSION['razdel'] == null) {
|
||||
$data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND (`type` < 12 OR `type` = 22 OR `type` = 23 OR `type` = 24) AND `setsale` = '0' ORDER by `update` DESC");
|
||||
$data = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND (`type` < 12 OR `type` = 22 OR `type` = 23 OR `type` = 24) AND `setsale` = 0 ORDER BY `update` DESC',$user['id']);
|
||||
}
|
||||
if ($_SESSION['razdel'] == 1) {
|
||||
$data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `type` = 12 AND `setsale`=0 ORDER by `update` DESC");
|
||||
$data = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 12 AND `setsale` = 0 ORDER BY `update` DESC',$user['id']);
|
||||
}
|
||||
if ($_SESSION['razdel'] == 2) {
|
||||
$data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND (`type` > 12 AND `type` != 22 AND `type` != 23 AND `type` != 24) AND `setsale`=0 ORDER by `update` DESC");
|
||||
$data = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND (`type` > 12 OR `type` != 22 OR `type` != 23 OR `type` != 24) AND `setsale` = 0 ORDER BY `update` DESC',$user['id']);
|
||||
}
|
||||
if ($_SESSION['razdel'] == 3) {
|
||||
$data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND (`type` >= 80 AND `type` <= 89) AND `setsale`=0 ORDER by `update` ASC; ");
|
||||
$data = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` >= 80 AND `type` <= 89 AND `setsale` = 0 ORDER BY `update` ASC',$user['id']);
|
||||
}
|
||||
if ($_SESSION['razdel'] == 4) {
|
||||
$data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `type` = 200 and `setsale`=0 ORDER by `update` ASC; ");
|
||||
$data = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 200 AND `setsale` = 0 ORDER BY `update` ASC',$user['id']);
|
||||
}
|
||||
if ($_SESSION['razdel'] == 5) {
|
||||
$data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `type` = 199 and `setsale`=0 ORDER by `update` ASC; ");
|
||||
$data = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 199 AND `setsale` = 0 ORDER BY `update` ASC',$user['id']);
|
||||
}
|
||||
$groupNum = array();
|
||||
$viewInventory = array();
|
||||
$getItems = array();
|
||||
while ($row = mysql_fetch_assoc($data)) {
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
if ($_SESSION['stackall']) {
|
||||
$itemsCount = ($row['prototype'] ? mysql_num_rows(mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `prototype` = '{$row['prototype']}' AND `dressed` = '0' AND `setsale`='0'")) : 1);
|
||||
|
||||
$itemsCount = ($row['prototype'] ? db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `prototype` = ?i AND `dressed` = 0 AND `setsale` = 0',$user['id'],$row['prototype'])->getNumRows() : 1);
|
||||
|
||||
if (!isset($groupNum[$row['prototype']])) {
|
||||
$viewInventory[($row['prototype'] ? $row['prototype'] : $row['id'])]['header'] = '<tr bgcolor="#C7C7C7"><td onclick="$(\'#items_' . ($row['prototype'] ? $row['prototype'] : $row['id']) . '\').slideToggle(\'fast\'); collapse(' . ($row['prototype'] ? $row['prototype'] : $row['id']) . ');" style="cursor: pointer; overflow: hidden; z-index: 0;">';
|
||||
@ -2707,9 +2704,7 @@ if (isset($_GET['edit'])) {
|
||||
}
|
||||
}
|
||||
|
||||
if (mysql_num_rows($data) == 0) {
|
||||
echo "<tr><td align=center bgcolor=#C7C7C7>Пусто</td></tr>";
|
||||
}
|
||||
if ($data->getNumRows() == 0) echo "<tr><td align=center bgcolor=#C7C7C7>Пусто</td></tr>";
|
||||
?>
|
||||
</table>
|
||||
</td>
|
||||
|
Loading…
Reference in New Issue
Block a user