Дополнительные проверки переменных. Замена 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) { 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>'; 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) { } 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>'; echo '<center><FONT COLOR=red><b>Ожидаем, пока бой закончат другие игроки...</b></FONT><BR><INPUT TYPE=submit value="Обновить" name=' . (($user['battle'] > 0) ? "battle" : "end") . '><BR></CENTER>';
} }
break; break;

View File

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

236
main.php
View File

@ -132,7 +132,7 @@ function countmf()
if ($idwep == 0 || $idwep == null || $idwep == '') { if ($idwep == 0 || $idwep == null || $idwep == '') {
return "kulak"; 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') { if ($wep[0] == '1') {
return "noj"; return "noj";
} elseif ($wep[0] == '12') { } 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(); $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(); $sokr = db::c()->query('SELECT `id` FROM `effects` WHERE `type` = 202 AND `owner` = ?i', $user['id'])->fetch_row();
if (isset($sokr[0])) { if (isset($sokr[0])) {
$bmfud += 5; $bmfud += 5;
@ -164,7 +164,7 @@ function countmf()
$mf = array(); $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[6] = $bmfbron;
$user_dress[7] = $bmfbron; $user_dress[7] = $bmfbron;
$user_dress[8] = $bmfbron; $user_dress[8] = $bmfbron;
@ -210,7 +210,7 @@ function countmf()
function dressitem($id) function dressitem($id)
{ {
global $user; 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']) { switch ($item['type']) {
case 1: case 1:
$slot1 = 'sergi'; $slot1 = 'sergi';
@ -327,7 +327,7 @@ function dressitem($id)
} }
if (!($item['type'] == 12 && $user['level'] < 4)) { 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']; $user[$slot1] = $item['id'];
return true; 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 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', `id` = ?i',
$user['helm'],$user['weap'],$user['plaw'],$user['bron'],$user['rybax'],$user['belt'], $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['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['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['m5'], $user['m6'], $user['m7'], $user['m8'], $user['m9'], $user['m10']);
while ($rec = $r->fetch_assoc()) { while ($rec = $r->fetch_assoc()) {
$dressed[$rec['id']] = $rec; $dressed[$rec['id']] = $rec;
} }
@ -373,7 +373,7 @@ function showpersinv($id)
<TD colspan=3> <TD colspan=3>
<? // TODO Сделать один запрос из десяти! <? // TODO Сделать один запрос из десяти!
if ($user['m1'] > 0) { 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']; $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>'; echo '<a href="?edit=1&drop=12"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else { } else {
@ -381,7 +381,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>'; echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
} }
if ($user['m2'] > 0) { 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']; $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>'; echo '<a href="?edit=1&drop=13"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else { } else {
@ -389,7 +389,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>'; echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
} }
if ($user['m3'] > 0) { 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']; $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>'; echo '<a href="?edit=1&drop=14"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else { } else {
@ -397,7 +397,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>'; echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
} }
if ($user['m4'] > 0) { 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']; $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>'; echo '<a href="?edit=1&drop=15"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else { } else {
@ -405,7 +405,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>'; echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
} }
if ($user['m5'] > 0) { 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']; $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>'; echo '<a href="?edit=1&drop=16"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else { } else {
@ -419,7 +419,7 @@ function showpersinv($id)
<TD colspan=3> <TD colspan=3>
<? <?
if ($user['m6'] > 0) { 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']; $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>'; echo '<a href="?edit=1&drop=17"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else { } else {
@ -427,7 +427,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>'; echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
} }
if ($user['m7'] > 0) { 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']; $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>'; echo '<a href="?edit=1&drop=18"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else { } else {
@ -435,7 +435,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>'; echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
} }
if ($user['m8'] > 0) { 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']; $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>'; echo '<a href="?edit=1&drop=19"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else { } else {
@ -443,7 +443,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>'; echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
} }
if ($user['m9'] > 0) { 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']; $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>'; echo '<a href="?edit=1&drop=20"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else { } else {
@ -451,7 +451,7 @@ function showpersinv($id)
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>'; echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
} }
if ($user['m10'] > 0) { 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']; $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>'; echo '<a href="?edit=1&drop=21"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else { } else {
@ -469,7 +469,7 @@ function showpersinv($id)
<TR> <TR>
<TD><?php <TD><?php
if ($user['sergi'] > 0) { 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'] . ''; $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>'; echo '<a href="?edit=1&drop=1"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=20></a>';
} else { } else {
@ -480,7 +480,7 @@ function showpersinv($id)
<TR> <TR>
<TD><?php <TD><?php
if ($user['kulon'] > 0) { 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'] . ''; $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>'; echo '<a href="?edit=1&drop=2"><img src="i/sh/' . $dress['img'] . '" width=60 height=20 class=\'tooltip\' title=\'' . $mess . '\'></a>';
} else { } else {
@ -491,7 +491,7 @@ function showpersinv($id)
<TR> <TR>
<TD><?php <TD><?php
if ($user['weap'] > 0) { 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'] . ''; $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>'; echo '<a href="?edit=1&drop=3"><img src="i/sh/' . $dress['img'] . '" width=60 height=60 class=\'tooltip\' title=\'' . $mess . '\'></a>';
} else { } else {
@ -526,7 +526,7 @@ function showpersinv($id)
<tr> <tr>
<td><?php <td><?php
if ($user['r1'] > 0) { 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'] . ''; $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>'; echo '<a href="?edit=1&drop=5"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=20 height=20></a>';
} else { } else {
@ -535,7 +535,7 @@ function showpersinv($id)
?></td> ?></td>
<td><?php <td><?php
if ($user['r2'] > 0) { 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'] . ''; $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>'; echo '<a class=\'tooltip\' title=\'' . $mess . '\' href="?edit=1&drop=6"><img src="i/sh/' . $dress['img'] . '" width=20 height=20></a>';
} else { } else {
@ -544,7 +544,7 @@ function showpersinv($id)
?></td> ?></td>
<td><?php <td><?php
if ($user['r3'] > 0) { 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'] . ''; $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>'; echo '<a href="?edit=1&drop=7"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=20 height=20></a>';
} else { } else {
@ -565,7 +565,7 @@ function showpersinv($id)
<TR> <TR>
<TD><?php <TD><?php
if ($user['helm'] > 0) { 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'] . ''; $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>'; echo '<a href="?edit=1&drop=8"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=60></a>';
} else { } else {
@ -576,7 +576,7 @@ function showpersinv($id)
<TR> <TR>
<TD><?php <TD><?php
if ($user['perchi'] > 0) { 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'] . ''; $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>'; echo '<a href="?edit=1&drop=9"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=40></a>';
} else { } else {
@ -587,7 +587,7 @@ function showpersinv($id)
<TR> <TR>
<TD><?php <TD><?php
if ($user['shit'] > 0) { 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'] . ''; $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>'; echo '<a href="?edit=1&drop=10"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=60></a>';
} else { } else {
@ -599,7 +599,7 @@ function showpersinv($id)
<TD><?php <TD><?php
if if
($user['boots'] > 0) { ($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>'; $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>'; echo '<a href="?edit=1&drop=11"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=40></a>';
} else { } else {
@ -626,14 +626,13 @@ function showpersinv($id)
} }
function updstats() function updstats()
{ {
global $user; global $user;
$u1 = db::c()->query('SELECT $u1 = db::c()->query('SELECT
`sila`, `lovk`, `inta`, `intel`, `noj`, `mec`, `topor`, `dubina`, `sila`, `lovk`, `inta`, `intel`, `noj`, `mec`, `topor`, `dubina`,
`mfire`, `mwater`, `mair`, `mearth`, `mlight`, `mgray`, `mdark`, `hp`, `maxhp` `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) { foreach ($u1 as $k => $v) {
$user[$k] = $v; $user[$k] = $v;
} }
@ -659,7 +658,7 @@ if (isset($_GET['stackall'])) {
if (isset($_GET["stack"])) { if (isset($_GET["stack"])) {
$_GET["stack"] = (int)$_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'])) { if (isset($rec['id'])) {
stack($rec['id']); stack($rec['id']);
unset($rec); unset($rec);
@ -878,13 +877,13 @@ if (input::post('setshadowclan')) {
onClick="location.href='main.php?edit=0.467837356797105';"></td> onClick="location.href='main.php?edit=0.467837356797105';"></td>
</tr> </tr>
</table> </table>
<TABLE style="padding:5px; margin: auto;"> <TABLE style="padding:5px; margin: auto;">
<caption><b>Клановые образы</b></caption> <caption><b>Клановые образы</b></caption>
<tr> <tr>
<td><a href="?edit=1&obraz=40"><img src="i/shadow/<?=$shadow['mshadow']?>"></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> <td><a href="?edit=1&obraz=41"><img src="i/shadow/<?= $shadow['wshadow'] ?>"></a></td>
</tr> </tr>
</TABLE> </TABLE>
</body> </body>
</html> </html>
<?php <?php
@ -1553,7 +1552,7 @@ if (input::get('setch')) {
} }
header("Cache-Control: no-cache"); header("Cache-Control: no-cache");
if (isset($_GET['edit'])) { if (input::get('edit')) {
function ups($type, $stat, $statName) function ups($type, $stat, $statName)
{ {
@ -1568,8 +1567,8 @@ if (isset($_GET['edit'])) {
} }
} }
if ($_GET['ups']) { if (input::get('ups')) {
switch ($_GET['ups']) { switch (input::get('ups')) {
case 11 : case 11 :
ups('stats', 'sila', 'Сила'); ups('stats', 'sila', 'Сила');
// if ($user['stats'] > 0 && $user['sid'] == $_GET['s4i']) { // if ($user['stats'] > 0 && $user['sid'] == $_GET['s4i']) {
@ -1827,101 +1826,96 @@ if (isset($_GET['edit'])) {
} }
} }
if (@$_GET['drop']) { if (input::get('drop')) {
dropitem($_GET['drop']); dropitem(input::get('drop'));
updstats(); updstats();
} }
if ($_GET['dress']) { if (input::get('dress')) {
$rec = mysql_fetch_array(mysql_query('SELECT `id`, `koll` FROM `inventory` WHERE `id` = "' . (int)$_GET['dress'] . '" AND `owner` = "' . $user['id'] . '" LIMIT 1')); $q = db::c()->query('SELECT `id`, `koll` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', input::get('dress'), $_SESSION['uid']);
if (isset($rec['id'])) { if ($q->getNumRows()) {
if ($rec['koll'] > 1) { $q = $q->fetch_assoc();
$id = unstack($rec['id'], 1); if ($q['koll'] > 1) {
$id = unstack($q['id'], 1);
dressitem($id); dressitem($id);
} else { } else {
dressitem($_GET['dress']); dressitem(input::get('dress'));
} }
updstats(); updstats();
} else { } else err('Ошибка: предмет не найден!');
echo 'Предмет не найден ...';
}
} }
if ($_GET['destruct']) { if (input::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")); $q = db::c()->query('SELECT `id`, `dressed`, `name`, `duration`, `maxdur` FROM `inventory` WHERE `owner` = ?i AND `id` = ?i', $_SESSION['uid'], input::get('destruct'));
if (isset($dress['id'])) { if ($q->getNumRows()) {
if ($dress['dressed'] == 0) { $q = $q->fetch_assoc();
destructitem($dress['id']); if (empty($q['dressed'])) {
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() . "');"); destructitem($q['id']);
echo "<div align=right><font color=red><b>Предмет \"" . $dress['name'] . "\" выброшен.</b></font></div>"; addToDelo($user['login'] . " выбросил предмет " . $q['name'] . " id:(cap" . $q['id'] . ")");
} else { err('Предмет ' . $q['name'] . ' выброшен.');
echo "<div align=right><font color=red><b>Сначала снимите предмет...</b></font></div>"; } else err('Ошибка: нельзя выбросить одетый предмет!');
} } else err('Ошибка: предмет не найден!');
} else {
echo "<div align=right><font color=red><b>Предмет не найден...</b></font></div>";
}
} }
if ($_GET['use']) { if (input::get('use')) {
$rec = mysql_fetch_array(mysql_query('SELECT `id`, `koll` FROM `inventory` WHERE `id` = "' . (int)$_GET['use'] . '" AND `owner` = "' . $user['id'] . '" LIMIT 1')); $q = db::c()->query('SELECT `id`, `koll` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', input::get('use'), $_SESSION['uid']);
if (isset($rec['id'])) { if ($q->getNumRows()) {
if ($rec['koll'] > 1) { $q = $q->fetch_assoc();
$id = unstack($rec['id'], 1); if ($q['koll'] > 1) {
$id = unstack($q['id'], 1);
usemagic($id, $_POST['target']); usemagic($id, $_POST['target']);
} else { } else {
usemagic($_GET['use'], $_POST['target']); usemagic($_GET['use'], $_POST['target']);
} }
} else { } else err('Ошибка: предмет не найден!');
echo 'Предмет не найден ...';
}
} }
if ($_GET['undress']) { if (input::get('undress')) {
undressall($user['id']); undressall($_SESSION['uid']);
updstats(); 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']; $hp = $user['hp'];
undressall($user['id']); undressall($_SESSION['uid']);
$_GET['complect'] = mysql_real_escape_string($_GET['complect']); $q = db::c()->query('SELECT `items` FROM `komplekt` WHERE `name` = "?s" AND `owner` = ?i', input::get('complect'), $_SESSION['uid'])->fetch_assoc();
$u_kompl = mysql_fetch_array(mysql_query("SELECT * FROM komplekt where `name` = '{$_GET['complect']}' AND `owner` = {$user['id']} LIMIT 1")); $items_in_set = [];
$k_items = array(); $items_in_set = explode(';', $q['items']);
$k_items = explode(';', $u_kompl['items']); foreach ($items_in_set as $iis)
foreach ($k_items as $k_i) dressitem($iis);
dressitem($k_i); db::c()->query('UPDATE `users` SET `hp` = ?i WHERE `id` = ?i', $hp, $_SESSION['uid']);
// Если здоровье становится выше максимума - выравниваем:
mysql_query("UPDATE `users` SET `hp` = '" . $hp . "' WHERE `id` = '" . $user['id'] . "' LIMIT 1"); db::c()->query('UPDATE `users` SET `hp` = `maxhp` WHERE `hp` > `maxhp` AND `id` = ?i', $_SESSION['uid']);
mysql_query("UPDATE `users` SET `hp` = `maxhp` WHERE `hp` > `maxhp` AND `id` = '" . $user['id'] . "' LIMIT 1"); $user = (new users_row($_SESSION['uid']))->result(); # Нахера перевыгружать О_о)?!
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$user['id']}' LIMIT 1"));
} }
ref_drop($user['id']);
if ($_GET['savecomplect']) { ref_drop();
$_GET['savecomplect'] = trim($_GET['savecomplect']);
if (preg_match('/[\/\:*?"<>|+%]/', $_GET['savecomplect'])) { if (input::get('savecomplect')) {
echo "<b style=\"color: Red;\">Вы используете запрещенные символы ...</b>"; if (preg_match('/^[- \p{L}\d]+$/u', input::get('savecomplect'))) {
} else { $q = db::c()->query('SELECT `id` FROM `komplekt` WHERE `name` = "?s" AND `owner` = ?i', input::get('savecomplect'), $_SESSION['uid'])->getNumRows();
$name = mysql_real_escape_string($_GET['savecomplect']); if (empty($q)) {
$u_all_kompl = mysql_fetch_array(mysql_query("SELECT `id` FROM `komplekt` WHERE `name` = '{$name}' AND `owner` = '{$user['id']}' LIMIT 1")); $items = [];
if (isset($u_all_kompl['id'])) { $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';
echo "<b style=\"color: Red;\">Такое название комплекта уже используется ..</b>"; $q2 = db::c()->query($sql,
} else { $user['sergi'], $user['kulon'], $user['perchi'], $user['weap'],
$items = array(); $user['bron'], $user['rybax'], $user['r1'], $user['r2'], $user['r3'],
$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'] . "'"); $user['helm'], $user['shit'], $user['m1'], $user['m2'], $user['m3'],
while ($res = mysql_fetch_array($odetShmot)) { $user['m4'], $user['m5'], $user['m6'], $user['m7'], $user['m8'], $user['m9'], $user['m10'],
$items[] = $res['id']; $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); $t_items = implode(";", $items);
mysql_query("INSERT INTO `komplekt` (`name`, `owner`, `items`) VALUES ('{$name}', '{$user['id']}', '{$t_items}')"); db::c()->query('INSERT INTO `komplekt` (`name`, `owner`, `items`) VALUES ("?s",?i,"?s")',input::get('savecomplect'),$_SESSION['uid'],$t_items);
echo "<b style=\"color: Red;\">Комплект {$name} сохранён ...</b>"; err('Комплект ' . $name . ' сохранён.');
} } else err('Ошибка: такое название комплекта уже используется!');
} } else err('Ошибка: запрещённые символы!');
} }
if (!in_array($_GET['mZeAjax'], array('mZeInventory', 'mZeFilter'))): if (!in_array(input::get('mZeAjax'), array('mZeInventory', 'mZeFilter'))):
?> ?>
<HTML> <HTML>
<HEAD> <HEAD>
@ -2638,7 +2632,7 @@ if (isset($_GET['edit'])) {
</tr> </tr>
<tr> <tr>
<td align=center><B>Рюкзак (масса : <?php <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']; echo $d['weight'];
?>/<?= get_meshok() ?>)</B> ?>/<?= get_meshok() ?>)</B>
</td> </td>
@ -2648,22 +2642,22 @@ if (isset($_GET['edit'])) {
<table BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5"> <table BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
<?php <?php
if ($_SESSION['razdel'] == null) { 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) { 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) { 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) { 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) { 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) { 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 = []; $groupNum = [];
$viewInventory = []; $viewInventory = [];
@ -2672,7 +2666,7 @@ if (isset($_GET['edit'])) {
while ($row = $data->fetch_assoc()) { while ($row = $data->fetch_assoc()) {
if ($_SESSION['stackall']) { 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']])) { 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;">'; $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;">';
@ -2720,7 +2714,7 @@ if (isset($_GET['edit'])) {
</body> </body>
</html> </html>
<?php <?php
endif; endif;
die(); die();
} }