From 77e8b7de2ae25604ba11202f61c5e30d813b8556 Mon Sep 17 00:00:00 2001 From: "Igor Barkov (iwork)" Date: Mon, 16 Sep 2019 17:01:59 +0300 Subject: [PATCH] code inspect --- akadem.php | 13 ++++++++++--- ashop.php | 2 +- bench.php | 8 +++++++- bench_m.php | 22 ---------------------- bench_s.php | 22 ---------------------- city.php | 10 +++++----- js/refreshonline.js | 3 --- main.php | 24 ++++++++---------------- 8 files changed, 31 insertions(+), 73 deletions(-) delete mode 100644 bench_m.php delete mode 100644 bench_s.php delete mode 100644 js/refreshonline.js diff --git a/akadem.php b/akadem.php index 92714c2..24ff5d1 100644 --- a/akadem.php +++ b/akadem.php @@ -28,7 +28,10 @@ function setProfession($name, $type, $needMoney, $needLevel) if ($name == 'наёмник') $profId = 21; if ($name == 'лекарь') $profId = 22; if (!empty($profId)) { - db::c()->query('UPDATE `users` SET ?f = ?i, `money` = `money` - ?i WHERE `id` = ?i', 'prof' . $type, $profId, $needMoney, $_SESSION['uid']); + try { + db::c()->query('UPDATE `users` SET ?f = ?i, `money` = `money` - ?i WHERE `id` = ?i', 'prof' . $type, $profId, $needMoney, $_SESSION['uid']); + } catch (\Krugozor\Database\Mysql\Exception $e) { + } $deloText = "{$user['login']} купил профессию «{$name}» в академии за {$needMoney} кр."; addToDelo($deloText); $user['prof'.$type] = true; @@ -42,16 +45,20 @@ if ($get == 'mercenary') $status = setProfession('наёмник', 2, 700, 5); if ($get == 'medic') $status = setProfession('лекарь', 2, 700, 5); if ($get == 'exit') { - db::c()->query('UPDATE `users`,`online` SET `users`.`room` = 2702, `online`.`room` = 2702 WHERE `users`.`id` = ?i AND `online`.`id` = ?i', $_SESSION['uid'], $_SESSION['uid']); + try { + db::c()->query('UPDATE `users`,`online` SET `users`.`room` = 2702, `online`.`room` = 2702 WHERE `users`.`id` = ?i AND `online`.`id` = ?i', $_SESSION['uid'], $_SESSION['uid']); + } catch (\Krugozor\Database\Mysql\Exception $e) { + } header('Location: city.php'); } ?> - + +
diff --git a/ashop.php b/ashop.php index 639b3eb..fbe3568 100644 --- a/ashop.php +++ b/ashop.php @@ -77,7 +77,7 @@ $shopCategory = ''; $shopCategoryTypeNumber = empty($_GET['otdel']) ?: $_GET['otdel']; switch ($shopCategoryTypeNumber) { default: - $shopCategory = "Кастеты и ножи"; + $shopCategory = "Прихожая"; break; case 1: $shopCategory = "Кастеты и ножи"; diff --git a/bench.php b/bench.php index f8c36fd..47dc7e7 100644 --- a/bench.php +++ b/bench.php @@ -19,4 +19,10 @@ } - \ No newline at end of file + + - - - - - Скамейка - - - ← на главную -

Скамейка

-

- Если вы устали от шума боев и суеты центральных улиц, вы можете отдохнуть на скамейке под тенью парковых деревьев...
- Здесь можно, уединившись, подумать о вечном, назначить романтическое свидание или просто спокойно поболтать.
- Если только местные хулиганы не помешают вам -

- - - \ No newline at end of file diff --git a/bench_s.php b/bench_s.php deleted file mode 100644 index f8c36fd..0000000 --- a/bench_s.php +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Скамейка - - - ← на главную -

Скамейка

-

- Если вы устали от шума боев и суеты центральных улиц, вы можете отдохнуть на скамейке под тенью парковых деревьев...
- Здесь можно, уединившись, подумать о вечном, назначить романтическое свидание или просто спокойно поболтать.
- Если только местные хулиганы не помешают вам -

- - - \ No newline at end of file diff --git a/city.php b/city.php index f9df11c..c9271b3 100644 --- a/city.php +++ b/city.php @@ -249,10 +249,10 @@ switch ($location[0]) { move(223, 'bench.php'); break; case 'level21': - move(222, 'bench_s.php'); + move(222, 'bench.php'); break; case 'level22': - move(224, 'bench_m.php'); + move(224, 'bench.php'); break; case 'level7': move(777, 'obshaga.php'); @@ -293,13 +293,13 @@ function bgset($img) $daytime = date('H'); if ($daytime >= 6 && $daytime <= 21) $background = getSeason() . $img . '_day'; else $background = getSeason() . $img . '_night'; - echo sprintf('
', $background); + echo sprintf('
background', $background); } $online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time() - 60)); ?> - + @@ -320,6 +320,7 @@ $online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time document.onmousedown = Down; + @@ -416,6 +417,5 @@ $online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time
- \ No newline at end of file diff --git a/js/refreshonline.js b/js/refreshonline.js deleted file mode 100644 index b48f9a7..0000000 --- a/js/refreshonline.js +++ /dev/null @@ -1,3 +0,0 @@ -//top.localroom=top.changeroom; -//top.frames['online'].location='ch.php?online='+Math.round(Math.random()*100000); -// \ No newline at end of file diff --git a/main.php b/main.php index 305cafd..e4ccc38 100644 --- a/main.php +++ b/main.php @@ -63,9 +63,9 @@ function stack($it_id) { global $user; $it_id = (int)$it_id; - $stack = mysql_query("SELECT * FROM `inventory` WHERE `id` = '" . $it_id . "' AND `owner` = " . $user['id'] . " LIMIT 1"); - if (mysql_num_rows($stack) == 1) { - $stack = mysql_fetch_array($stack); + $stack = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', $it_id, $user['id']); + if (db::c()->getAffectedRows() === 1) { + $stack = $stack->fetch_assoc(); $similar = mysql_fetch_array(mysql_query("SELECT SUM(`koll`) FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` != '" . $stack['id'] . "' AND `name` = '" . $stack['name'] . "' AND `present` = '" . $stack['present'] . "' AND `duration` = '" . $stack['duration'] . "' AND `maxdur` = '" . $stack['maxdur'] . "' AND `laba` = '" . $stack['laba'] . "' AND `gmeshok` = '" . $stack['gmeshok'] . "' AND `dressed` = 0 AND `goden` = 0 AND `setsale` = 0 AND `koll` >= 1 AND `isrep` = '" . $stack['isrep'] . "' AND FORMAT(`cost`/`koll`, 2) = FORMAT(" . ($stack['cost'] / $stack['koll']) . ", 2) AND FORMAT(`point`/`koll`, 2) = FORMAT(" . ($stack['point'] / $stack['koll']) . ", 2) AND FORMAT(`bcost`/`koll`, 2) = FORMAT(" . ($stack['bcost'] / $stack['koll']) . ", 2)")); if ($similar[0] >= 1) { mysql_query("UPDATE `inventory` SET `cost` = (`cost`+`cost`/`koll`*" . $similar[0] . "), `point` = (`point`+`point`/`koll`*" . $similar[0] . "), `bcost` = (`bcost`+`bcost`/`koll`*" . $similar[0] . "), `massa` = (`massa`+`massa`/`koll`*" . $similar[0] . "), `koll` = (`koll`+" . $similar[0] . "), `gmeshok` = (`gmeshok`+`gmeshok`*" . $similar[0] . ") WHERE `id` = '" . $stack['id'] . "' LIMIT 1"); @@ -822,7 +822,7 @@ if (input::get('setch')) { var perm = getCurrentPermission(); - if (perm == 'true') { + if (perm === 'true') { new Notification('Thenks'); } else { Notification.requestPermission('Сайт запрашивает доступ к уведомлениям.'); @@ -1586,11 +1586,11 @@ if (input::get('edit')) { function okno(title, script, name, coma, errk) { var errkom = ''; var com = ''; - if (errk == 1) { + if (errk === 1) { errkom = 'Нельзя использовать символы: /\:*?"<>|+%
'; com = coma } - if (errk == 2) { + if (errk === 2) { errkom = 'Такой комплект уже существует
'; com = coma } @@ -1625,7 +1625,7 @@ if (input::get('edit')) { $(document).ready(function () { $('a').live('click', function () { - if ($(this).attr('ajax') != undefined) { + if ($(this).attr('ajax') !== undefined) { var ajaxModule = $(this).attr('ajax'); switch (ajaxModule) { @@ -2402,18 +2402,10 @@ if ($user['room'] == 650) { header('Location: ul_clans.php'); die(); } -if ($user['room'] == 223) { +if ($user['room'] == 222 OR $user['room'] == 223 OR $user['room'] == 224) { header('Location: bench.php'); die(); } -if ($user['room'] == 222) { - header('Location: bench_s.php'); - die(); -} -if ($user['room'] == 224) { - header('Location: bench_m.php'); - die(); -} //БС if ($user['in_tower'] == 1) { header('Location: towerin.php');