Дополнительные проверки переменных. Замена mysql_connect в функциях.

This commit is contained in:
Igor Barkov [iwork] 2018-12-11 15:00:16 +02:00
parent e4c551b9a2
commit e95cc345a4
3 changed files with 119 additions and 125 deletions

View File

@ -305,7 +305,7 @@ $fbattle = new fbattle($user['battle']);
if (($user['hp'] > 0) && $fbattle->battle) {
echo '<center><FONT COLOR=red><b>Ожидаем хода противника...</b></FONT><BR><INPUT TYPE=submit value="Обновить" name=' . (($user['battle'] > 0) ? "battle" : "end") . '><BR></CENTER>';
} elseif ($user['hp'] <= 0 && $fbattle->battle) {
ref_drop($user['id']);
ref_drop();
echo '<center><FONT COLOR=red><b>Ожидаем, пока бой закончат другие игроки...</b></FONT><BR><INPUT TYPE=submit value="Обновить" name=' . (($user['battle'] > 0) ? "battle" : "end") . '><BR></CENTER>';
}
break;

View File

@ -2223,7 +2223,7 @@ function make_seed()
function ref_drop()
{
global $user;
# global $user;
//сможет держать
function derj($id)
@ -2266,8 +2266,8 @@ function ref_drop()
return false;
}
}
$slot = array('sergi', 'kulon', 'weap', 'bron', 'r1', 'r2', 'r3', 'helm', 'perchi', 'shit', 'boots', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9', 'm10');
$slot = ['sergi', 'kulon', 'weap', 'bron', 'r1', 'r2', 'r3', 'helm', 'perchi', 'shit', 'boots', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9', 'm10'];
$user = db::c()->query('SELECT ?a FROM `users` WHERE id = ?i',$slot,$_SESSION['uid'])->fetch_assoc();
for ($i = 0; $i <= 20; $i++) {
if ($user[$slot[$i]] && !derj($user[$slot[$i]])) {
dropitem($i + 1);

224
main.php
View File

@ -132,7 +132,7 @@ function countmf()
if ($idwep == 0 || $idwep == null || $idwep == '') {
return "kulak";
}
$wep = db::c()->query('SELECT `otdel`, `minu` FROM `inventory` WHERE `id` = ?i',$idwep)->fetch_row();
$wep = db::c()->query('SELECT `otdel`, `minu` FROM `inventory` WHERE `id` = ?i', $idwep)->fetch_row();
if ($wep[0] == '1') {
return "noj";
} elseif ($wep[0] == '12') {
@ -148,8 +148,8 @@ function countmf()
}
}
$zo = db::c()->query('SELECT `id` FROM `effects` WHERE `type` = 201 AND `owner` = ?i',$user['id'])->fetch_row();
$sokr = db::c()->query('SELECT `id` FROM `effects` WHERE `type` = 202 AND `owner` = ?i',$user['id'])->fetch_row();
$zo = db::c()->query('SELECT `id` FROM `effects` WHERE `type` = 201 AND `owner` = ?i', $user['id'])->fetch_row();
$sokr = db::c()->query('SELECT `id` FROM `effects` WHERE `type` = 202 AND `owner` = ?i', $user['id'])->fetch_row();
if (isset($sokr[0])) {
$bmfud += 5;
@ -164,7 +164,7 @@ function countmf()
$mf = array();
$user_dress = db::c()->query('SELECT SUM(`minu`), SUM(`maxu`), SUM(`mfkrit`), SUM(`mfakrit`), SUM(`mfuvorot`), SUM(`mfauvorot`), SUM(`bron1`), SUM(`bron2`), SUM(`bron3`), SUM(`bron4`) FROM `inventory` WHERE `dressed` = 1 AND `owner` = ?i',$user['id'])->fetch_row();
$user_dress = db::c()->query('SELECT SUM(`minu`), SUM(`maxu`), SUM(`mfkrit`), SUM(`mfakrit`), SUM(`mfuvorot`), SUM(`mfauvorot`), SUM(`bron1`), SUM(`bron2`), SUM(`bron3`), SUM(`bron4`) FROM `inventory` WHERE `dressed` = 1 AND `owner` = ?i', $user['id'])->fetch_row();
$user_dress[6] = $bmfbron;
$user_dress[7] = $bmfbron;
$user_dress[8] = $bmfbron;
@ -210,7 +210,7 @@ function countmf()
function dressitem($id)
{
global $user;
$item = db::c()->query('SELECT * FROM `inventory` WHERE `duration` < `maxdur` AND `id` = ?i AND `owner` = ?i AND `dressed` = 0',$id,$user['id'])->fetch_assoc();
$item = db::c()->query('SELECT * FROM `inventory` WHERE `duration` < `maxdur` AND `id` = ?i AND `owner` = ?i AND `dressed` = 0', $id, $user['id'])->fetch_assoc();
switch ($item['type']) {
case 1:
$slot1 = 'sergi';
@ -327,7 +327,7 @@ function dressitem($id)
}
if (!($item['type'] == 12 && $user['level'] < 4)) {
if (db::c()->query('UPDATE `users` AS `u`, `inventory` AS `i` SET `u`.?f = ?i, `i`.`dressed` = 1, `u`.`sila` = `u`.`sila` + `i`.`gsila`, `u`.`lovk` = `u`.`lovk` + `i`.`glovk`, `u`.`inta` = `u`.`inta` + `i`.`ginta`, `u`.`intel` = `u`.`intel` + `i`.`gintel`, `u`.`maxhp` = `u`.`maxhp` + `i`.`ghp`, `u`.`noj` = `u`.`noj` + `i`.`gnoj`, `u`.`topor` = `u`.`topor` + `i`.`gtopor`, `u`.`dubina` = `u`.`dubina` + `i`.`gdubina`, `u`.`mec` = `u`.`mec` + `i`.`gmech`, `u`.`mfire` = `u`.`mfire` + `i`.`gfire`, `u`.`mwater` = `u`.`mwater` + `i`.`gwater`, `u`.`mair` = `u`.`mair` + `i`.`gair`, `u`.`mearth` = `u`.`mearth` + `i`.`gearth`, `u`.`mlight` = `u`.`mlight` + `i`.`glight`, `u`.`mgray` = `u`.`mgray` + `i`.`ggray`, `u`.`mdark` = `u`.`mdark` + `i`.`gdark`, `u`.`ubron1` = `u`.`ubron1` + `i`.`bron1`, `u`.`ubron2` = `u`.`ubron2` + `i`.`bron2`, `u`.`ubron3` = `u`.`ubron3` + `i`.`bron3`, `u`.`ubron4` = `u`.`ubron4` + `i`.`bron4`, `u`.`fkrit` = `u`.`fkrit` + `i`.`mfkrit`, `u`.`fakrit` = `u`.`fakrit` + `i`.`mfakrit`, `u`.`fuvorot` = `u`.`fuvorot` + `i`.`mfuvorot`, `u`.`fauvorot` = `u`.`fauvorot` + `i`.`mfauvorot`, `u`.`uminu` = `u`.`uminu` + `i`.`minu`, `u`.`umaxu` = `u`.`umaxu` + `i`.`maxu` WHERE `i`.`needident` = 0 AND `i`.`id` = ?i AND `i`.`dressed` = 0 AND `i`.owner = ?i AND (20 + `u`.`sila`) >= `i`.`nsila` AND (20 + `u`.`lovk`) >= `i`.`nlovk` AND (20 + `u`.`inta`) >= `i`.`ninta` AND `u`.`vinos` >= `i`.`nvinos` AND (20 + `u`.`intel`) >= `i`.`nintel` AND `u`.`mudra` >= `i`.`nmudra` AND `u`.`level` >= `i`.`nlevel` AND (("?s" OR (?i = `i`.`nalign`)) OR (`i`.`nalign` = 0)) AND `u`.`noj` >= `i`.`nnoj` AND `u`.`topor` >= `i`.`ntopor` AND `u`.`dubina` >= `i`.`ndubina` AND `u`.`mec` >= `i`.`nmech` AND `u`.`mfire` >= `i`.`nfire` AND `u`.`mwater` >= `i`.`nwater` AND `u`.`mair` >= `i`.`nair` AND `u`.`mearth` >= `i`.`nearth` AND `u`.`mlight` >= `i`.`nlight` AND `u`.`mgray` >= `i`.`ngray` AND `u`.`mdark` >= `i`.`ndark` AND `i`.`setsale` = 0 AND `u`.`id` = ?i',$slot1,$id,$id,$user['id'],$al,$user['align'],$user['id']))
if (db::c()->query('UPDATE `users` AS `u`, `inventory` AS `i` SET `u`.?f = ?i, `i`.`dressed` = 1, `u`.`sila` = `u`.`sila` + `i`.`gsila`, `u`.`lovk` = `u`.`lovk` + `i`.`glovk`, `u`.`inta` = `u`.`inta` + `i`.`ginta`, `u`.`intel` = `u`.`intel` + `i`.`gintel`, `u`.`maxhp` = `u`.`maxhp` + `i`.`ghp`, `u`.`noj` = `u`.`noj` + `i`.`gnoj`, `u`.`topor` = `u`.`topor` + `i`.`gtopor`, `u`.`dubina` = `u`.`dubina` + `i`.`gdubina`, `u`.`mec` = `u`.`mec` + `i`.`gmech`, `u`.`mfire` = `u`.`mfire` + `i`.`gfire`, `u`.`mwater` = `u`.`mwater` + `i`.`gwater`, `u`.`mair` = `u`.`mair` + `i`.`gair`, `u`.`mearth` = `u`.`mearth` + `i`.`gearth`, `u`.`mlight` = `u`.`mlight` + `i`.`glight`, `u`.`mgray` = `u`.`mgray` + `i`.`ggray`, `u`.`mdark` = `u`.`mdark` + `i`.`gdark`, `u`.`ubron1` = `u`.`ubron1` + `i`.`bron1`, `u`.`ubron2` = `u`.`ubron2` + `i`.`bron2`, `u`.`ubron3` = `u`.`ubron3` + `i`.`bron3`, `u`.`ubron4` = `u`.`ubron4` + `i`.`bron4`, `u`.`fkrit` = `u`.`fkrit` + `i`.`mfkrit`, `u`.`fakrit` = `u`.`fakrit` + `i`.`mfakrit`, `u`.`fuvorot` = `u`.`fuvorot` + `i`.`mfuvorot`, `u`.`fauvorot` = `u`.`fauvorot` + `i`.`mfauvorot`, `u`.`uminu` = `u`.`uminu` + `i`.`minu`, `u`.`umaxu` = `u`.`umaxu` + `i`.`maxu` WHERE `i`.`needident` = 0 AND `i`.`id` = ?i AND `i`.`dressed` = 0 AND `i`.owner = ?i AND (20 + `u`.`sila`) >= `i`.`nsila` AND (20 + `u`.`lovk`) >= `i`.`nlovk` AND (20 + `u`.`inta`) >= `i`.`ninta` AND `u`.`vinos` >= `i`.`nvinos` AND (20 + `u`.`intel`) >= `i`.`nintel` AND `u`.`mudra` >= `i`.`nmudra` AND `u`.`level` >= `i`.`nlevel` AND (("?s" OR (?i = `i`.`nalign`)) OR (`i`.`nalign` = 0)) AND `u`.`noj` >= `i`.`nnoj` AND `u`.`topor` >= `i`.`ntopor` AND `u`.`dubina` >= `i`.`ndubina` AND `u`.`mec` >= `i`.`nmech` AND `u`.`mfire` >= `i`.`nfire` AND `u`.`mwater` >= `i`.`nwater` AND `u`.`mair` >= `i`.`nair` AND `u`.`mearth` >= `i`.`nearth` AND `u`.`mlight` >= `i`.`nlight` AND `u`.`mgray` >= `i`.`ngray` AND `u`.`mdark` >= `i`.`ndark` AND `i`.`setsale` = 0 AND `u`.`id` = ?i', $slot1, $id, $id, $user['id'], $al, $user['align'], $user['id']))
$user[$slot1] = $item['id'];
return true;
}
@ -346,10 +346,10 @@ function showpersinv($id)
`id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR
`id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR
`id` = ?i',
$user['helm'],$user['weap'],$user['plaw'],$user['bron'],$user['rybax'],$user['belt'],
$user['sergi'],$user['kulon'],$user['r1'],$user['r2'],$user['r3'],$user['perchi'],
$user['shit'],$user['leg'],$user['boots'],$user['m1'],$user['m2'],$user['m3'],$user['m4'],
$user['m5'],$user['m6'],$user['m7'],$user['m8'],$user['m9'],$user['m10']);
$user['helm'], $user['weap'], $user['plaw'], $user['bron'], $user['rybax'], $user['belt'],
$user['sergi'], $user['kulon'], $user['r1'], $user['r2'], $user['r3'], $user['perchi'],
$user['shit'], $user['leg'], $user['boots'], $user['m1'], $user['m2'], $user['m3'], $user['m4'],
$user['m5'], $user['m6'], $user['m7'], $user['m8'], $user['m9'], $user['m10']);
while ($rec = $r->fetch_assoc()) {
$dressed[$rec['id']] = $rec;
}
@ -373,7 +373,7 @@ function showpersinv($id)
<TD colspan=3>
<? // TODO Сделать один запрос из десяти!
if ($user['m1'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['m1'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m1'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=12"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
@ -381,7 +381,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m2'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['m2'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m2'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=13"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
@ -389,7 +389,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m3'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['m3'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m3'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=14"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
@ -397,7 +397,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m4'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['m4'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m4'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=15"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
@ -405,7 +405,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m5'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['m5'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m5'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=16"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
@ -419,7 +419,7 @@ function showpersinv($id)
<TD colspan=3>
<?
if ($user['m6'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['m6'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m6'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=17"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
@ -427,7 +427,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m7'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['m7'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m7'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=18"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
@ -435,7 +435,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m8'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['m8'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m8'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=19"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
@ -443,7 +443,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m9'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['m9'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m9'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=20"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
@ -451,7 +451,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m10'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['m10'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m10'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=21"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
@ -469,7 +469,7 @@ function showpersinv($id)
<TR>
<TD><?php
if ($user['sergi'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['sergi'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['sergi'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=1"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=20></a>';
} else {
@ -480,7 +480,7 @@ function showpersinv($id)
<TR>
<TD><?php
if ($user['kulon'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['kulon'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['kulon'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=2"><img src="i/sh/' . $dress['img'] . '" width=60 height=20 class=\'tooltip\' title=\'' . $mess . '\'></a>';
} else {
@ -491,7 +491,7 @@ function showpersinv($id)
<TR>
<TD><?php
if ($user['weap'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['weap'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['weap'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=3"><img src="i/sh/' . $dress['img'] . '" width=60 height=60 class=\'tooltip\' title=\'' . $mess . '\'></a>';
} else {
@ -526,7 +526,7 @@ function showpersinv($id)
<tr>
<td><?php
if ($user['r1'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['r1'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['r1'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=5"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=20 height=20></a>';
} else {
@ -535,7 +535,7 @@ function showpersinv($id)
?></td>
<td><?php
if ($user['r2'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['r2'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['r2'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a class=\'tooltip\' title=\'' . $mess . '\' href="?edit=1&drop=6"><img src="i/sh/' . $dress['img'] . '" width=20 height=20></a>';
} else {
@ -544,7 +544,7 @@ function showpersinv($id)
?></td>
<td><?php
if ($user['r3'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['r3'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['r3'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=7"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=20 height=20></a>';
} else {
@ -565,7 +565,7 @@ function showpersinv($id)
<TR>
<TD><?php
if ($user['helm'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['helm'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['helm'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=8"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=60></a>';
} else {
@ -576,7 +576,7 @@ function showpersinv($id)
<TR>
<TD><?php
if ($user['perchi'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['perchi'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['perchi'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=9"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=40></a>';
} else {
@ -587,7 +587,7 @@ function showpersinv($id)
<TR>
<TD><?php
if ($user['shit'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['shit'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['shit'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=10"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=60></a>';
} else {
@ -599,7 +599,7 @@ function showpersinv($id)
<TD><?php
if
($user['boots'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i',$user['boots'])->fetch_assoc();
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['boots'])->fetch_assoc();
$mess = '<span style="min-width: 350px;">Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '</span>';
echo '<a href="?edit=1&drop=11"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=40></a>';
} else {
@ -626,14 +626,13 @@ function showpersinv($id)
}
function updstats()
{
global $user;
$u1 = db::c()->query('SELECT
`sila`, `lovk`, `inta`, `intel`, `noj`, `mec`, `topor`, `dubina`,
`mfire`, `mwater`, `mair`, `mearth`, `mlight`, `mgray`, `mdark`, `hp`, `maxhp`
FROM `users` WHERE `id` = ?i',$user['id'])->fetch_assoc();
FROM `users` WHERE `id` = ?i', $user['id'])->fetch_assoc();
foreach ($u1 as $k => $v) {
$user[$k] = $v;
}
@ -659,7 +658,7 @@ if (isset($_GET['stackall'])) {
if (isset($_GET["stack"])) {
$_GET["stack"] = (int)$_GET["stack"];
$rec = db::c()->query('SELECT `id` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i AND `setsale` = 0',$_GET['stack'],$user['id'])->fetch_assoc();
$rec = db::c()->query('SELECT `id` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i AND `setsale` = 0', $_GET['stack'], $user['id'])->fetch_assoc();
if (isset($rec['id'])) {
stack($rec['id']);
unset($rec);
@ -881,8 +880,8 @@ if (input::post('setshadowclan')) {
<TABLE style="padding:5px; margin: auto;">
<caption><b>Клановые образы</b></caption>
<tr>
<td><a href="?edit=1&obraz=40"><img src="i/shadow/<?=$shadow['mshadow']?>"></a></td>
<td><a href="?edit=1&obraz=41"><img src="i/shadow/<?=$shadow['wshadow']?>"></a></td>
<td><a href="?edit=1&obraz=40"><img src="i/shadow/<?= $shadow['mshadow'] ?>"></a></td>
<td><a href="?edit=1&obraz=41"><img src="i/shadow/<?= $shadow['wshadow'] ?>"></a></td>
</tr>
</TABLE>
</body>
@ -1553,7 +1552,7 @@ if (input::get('setch')) {
}
header("Cache-Control: no-cache");
if (isset($_GET['edit'])) {
if (input::get('edit')) {
function ups($type, $stat, $statName)
{
@ -1568,8 +1567,8 @@ if (isset($_GET['edit'])) {
}
}
if ($_GET['ups']) {
switch ($_GET['ups']) {
if (input::get('ups')) {
switch (input::get('ups')) {
case 11 :
ups('stats', 'sila', 'Сила');
// if ($user['stats'] > 0 && $user['sid'] == $_GET['s4i']) {
@ -1827,101 +1826,96 @@ if (isset($_GET['edit'])) {
}
}
if (@$_GET['drop']) {
dropitem($_GET['drop']);
if (input::get('drop')) {
dropitem(input::get('drop'));
updstats();
}
if ($_GET['dress']) {
$rec = mysql_fetch_array(mysql_query('SELECT `id`, `koll` FROM `inventory` WHERE `id` = "' . (int)$_GET['dress'] . '" AND `owner` = "' . $user['id'] . '" LIMIT 1'));
if (isset($rec['id'])) {
if ($rec['koll'] > 1) {
$id = unstack($rec['id'], 1);
if (input::get('dress')) {
$q = db::c()->query('SELECT `id`, `koll` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', input::get('dress'), $_SESSION['uid']);
if ($q->getNumRows()) {
$q = $q->fetch_assoc();
if ($q['koll'] > 1) {
$id = unstack($q['id'], 1);
dressitem($id);
} else {
dressitem($_GET['dress']);
dressitem(input::get('dress'));
}
updstats();
} else {
echo 'Предмет не найден ...';
}
} else err('Ошибка: предмет не найден!');
}
if ($_GET['destruct']) {
$dress = mysql_fetch_array(mysql_query("SELECT `id`, `dressed`, `name`, `duration`, `maxdur` FROM `inventory` WHERE `owner` = '{$user['id']}' AND `id` = '{$_GET['destruct']}' LIMIT 1"));
if (isset($dress['id'])) {
if ($dress['dressed'] == 0) {
destructitem($dress['id']);
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$_SESSION['uid']}','\"" . $user['login'] . "\" выбросил предмет \"" . $dress['name'] . "\" id:(cap" . $dress['id'] . ") [" . $dress['duration'] . "/" . $dress['maxdur'] . "] ',1,'" . time() . "');");
echo "<div align=right><font color=red><b>Предмет \"" . $dress['name'] . "\" выброшен.</b></font></div>";
} else {
echo "<div align=right><font color=red><b>Сначала снимите предмет...</b></font></div>";
}
} else {
echo "<div align=right><font color=red><b>Предмет не найден...</b></font></div>";
}
if (input::get('destruct')) {
$q = db::c()->query('SELECT `id`, `dressed`, `name`, `duration`, `maxdur` FROM `inventory` WHERE `owner` = ?i AND `id` = ?i', $_SESSION['uid'], input::get('destruct'));
if ($q->getNumRows()) {
$q = $q->fetch_assoc();
if (empty($q['dressed'])) {
destructitem($q['id']);
addToDelo($user['login'] . " выбросил предмет " . $q['name'] . " id:(cap" . $q['id'] . ")");
err('Предмет ' . $q['name'] . ' выброшен.');
} else err('Ошибка: нельзя выбросить одетый предмет!');
} else err('Ошибка: предмет не найден!');
}
if ($_GET['use']) {
$rec = mysql_fetch_array(mysql_query('SELECT `id`, `koll` FROM `inventory` WHERE `id` = "' . (int)$_GET['use'] . '" AND `owner` = "' . $user['id'] . '" LIMIT 1'));
if (isset($rec['id'])) {
if ($rec['koll'] > 1) {
$id = unstack($rec['id'], 1);
if (input::get('use')) {
$q = db::c()->query('SELECT `id`, `koll` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', input::get('use'), $_SESSION['uid']);
if ($q->getNumRows()) {
$q = $q->fetch_assoc();
if ($q['koll'] > 1) {
$id = unstack($q['id'], 1);
usemagic($id, $_POST['target']);
} else {
usemagic($_GET['use'], $_POST['target']);
}
} else {
echo 'Предмет не найден ...';
}
} else err('Ошибка: предмет не найден!');
}
if ($_GET['undress']) {
undressall($user['id']);
if (input::get('undress')) {
undressall($_SESSION['uid']);
updstats();
}
if ($_GET['delcomplect']) {
mysql_query("DELETE FROM `komplekt` WHERE `name` = '" . $_GET['delcomplect'] . "' AND `owner` = '" . $user['id'] . "';");
if (input::get('delcomplect')) {
db::c()->query('DELETE FROM `komplekt` WHERE `name` = "?s" AND `owner` = ?i', input::get('delcomplect'), $_SESSION['uid']);
}
if ($_GET['complect']) {
if (input::get('complect')) {
$hp = $user['hp'];
undressall($user['id']);
$_GET['complect'] = mysql_real_escape_string($_GET['complect']);
$u_kompl = mysql_fetch_array(mysql_query("SELECT * FROM komplekt where `name` = '{$_GET['complect']}' AND `owner` = {$user['id']} LIMIT 1"));
$k_items = array();
$k_items = explode(';', $u_kompl['items']);
foreach ($k_items as $k_i)
dressitem($k_i);
mysql_query("UPDATE `users` SET `hp` = '" . $hp . "' WHERE `id` = '" . $user['id'] . "' LIMIT 1");
mysql_query("UPDATE `users` SET `hp` = `maxhp` WHERE `hp` > `maxhp` AND `id` = '" . $user['id'] . "' LIMIT 1");
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$user['id']}' LIMIT 1"));
undressall($_SESSION['uid']);
$q = db::c()->query('SELECT `items` FROM `komplekt` WHERE `name` = "?s" AND `owner` = ?i', input::get('complect'), $_SESSION['uid'])->fetch_assoc();
$items_in_set = [];
$items_in_set = explode(';', $q['items']);
foreach ($items_in_set as $iis)
dressitem($iis);
db::c()->query('UPDATE `users` SET `hp` = ?i WHERE `id` = ?i', $hp, $_SESSION['uid']);
// Если здоровье становится выше максимума - выравниваем:
db::c()->query('UPDATE `users` SET `hp` = `maxhp` WHERE `hp` > `maxhp` AND `id` = ?i', $_SESSION['uid']);
$user = (new users_row($_SESSION['uid']))->result(); # Нахера перевыгружать О_о)?!
}
ref_drop($user['id']);
if ($_GET['savecomplect']) {
$_GET['savecomplect'] = trim($_GET['savecomplect']);
if (preg_match('/[\/\:*?"<>|+%]/', $_GET['savecomplect'])) {
echo "<b style=\"color: Red;\">Вы используете запрещенные символы ...</b>";
} else {
$name = mysql_real_escape_string($_GET['savecomplect']);
$u_all_kompl = mysql_fetch_array(mysql_query("SELECT `id` FROM `komplekt` WHERE `name` = '{$name}' AND `owner` = '{$user['id']}' LIMIT 1"));
if (isset($u_all_kompl['id'])) {
echo "<b style=\"color: Red;\">Такое название комплекта уже используется ..</b>";
} else {
$items = array();
$odetShmot = mysql_query("SELECT `id` FROM `inventory` WHERE `id` = '" . $user['sergi'] . "' OR `id` = '" . $user['kulon'] . "' OR `id` = '" . $user['perchi'] . "' OR `id` = '" . $user['weap'] . "' OR `id` = '" . $user['bron'] . "' OR `id` = '" . $user['rybax'] . "' OR `id` = '" . $user['r1'] . "' OR `id` = '" . $user['r2'] . "' OR `id` = '" . $user['r3'] . "' OR `id` = '" . $user['helm'] . "' OR `id` = '" . $user['shit'] . "' OR `id` = '" . $user['m1'] . "' OR `id` = '" . $user['m2'] . "' OR `id` = '" . $user['m3'] . "' OR `id` = '" . $user['m4'] . "' OR `id` = '" . $user['m5'] . "' OR `id` = '" . $user['m6'] . "' OR `id` = '" . $user['m7'] . "' OR `id` = '" . $user['m8'] . "' OR `id` = '" . $user['m9'] . "' OR `id` = '" . $user['m10'] . "' OR `id` = '" . $user['boots'] . "' OR `id` = '" . $user['plaw'] . "' OR `id` = '" . $user['rune_1'] . "' OR `id` = '" . $user['rune_2'] . "' OR `id` = '" . $user['rune_3'] . "'");
while ($res = mysql_fetch_array($odetShmot)) {
$items[] = $res['id'];
}
ref_drop();
if (input::get('savecomplect')) {
if (preg_match('/^[- \p{L}\d]+$/u', input::get('savecomplect'))) {
$q = db::c()->query('SELECT `id` FROM `komplekt` WHERE `name` = "?s" AND `owner` = ?i', input::get('savecomplect'), $_SESSION['uid'])->getNumRows();
if (empty($q)) {
$items = [];
$sql = 'SELECT `id` FROM `inventory` WHERE `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i';
$q2 = db::c()->query($sql,
$user['sergi'], $user['kulon'], $user['perchi'], $user['weap'],
$user['bron'], $user['rybax'], $user['r1'], $user['r2'], $user['r3'],
$user['helm'], $user['shit'], $user['m1'], $user['m2'], $user['m3'],
$user['m4'], $user['m5'], $user['m6'], $user['m7'], $user['m8'], $user['m9'], $user['m10'],
$user['boots'], $user['plaw'], $user['rune_1'], $user['rune_2'], $user['rune_3']);
while ($res = $q2->fetch_assoc()) $items[] = $res['id'];
$t_items = implode(";", $items);
mysql_query("INSERT INTO `komplekt` (`name`, `owner`, `items`) VALUES ('{$name}', '{$user['id']}', '{$t_items}')");
echo "<b style=\"color: Red;\">Комплект {$name} сохранён ...</b>";
}
}
db::c()->query('INSERT INTO `komplekt` (`name`, `owner`, `items`) VALUES ("?s",?i,"?s")',input::get('savecomplect'),$_SESSION['uid'],$t_items);
err('Комплект ' . $name . ' сохранён.');
} else err('Ошибка: такое название комплекта уже используется!');
} else err('Ошибка: запрещённые символы!');
}
if (!in_array($_GET['mZeAjax'], array('mZeInventory', 'mZeFilter'))):
if (!in_array(input::get('mZeAjax'), array('mZeInventory', 'mZeFilter'))):
?>
<HTML>
<HEAD>
@ -2638,7 +2632,7 @@ if (isset($_GET['edit'])) {
</tr>
<tr>
<td align=center><B>Рюкзак (масса : <?php
$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();
$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>
@ -2648,22 +2642,22 @@ if (isset($_GET['edit'])) {
<table BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
<?php
if ($_SESSION['razdel'] == null) {
$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']);
$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 = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 12 AND `setsale` = 0 ORDER BY `update` DESC',$user['id']);
$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 = 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']);
$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 = 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']);
$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 = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 200 AND `setsale` = 0 ORDER BY `update` ASC',$user['id']);
$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 = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 199 AND `setsale` = 0 ORDER BY `update` ASC',$user['id']);
$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 = [];
$viewInventory = [];
@ -2672,7 +2666,7 @@ if (isset($_GET['edit'])) {
while ($row = $data->fetch_assoc()) {
if ($_SESSION['stackall']) {
$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);
$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;">';