code inspect

This commit is contained in:
Igor Barkov (iwork)
2019-09-16 17:01:59 +03:00
parent e93f8ebca1
commit 77e8b7de2a
8 changed files with 31 additions and 73 deletions

View File

@@ -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 = 'Нельзя использовать символы: /\:*?"<>|+%<br>';
com = coma
}
if (errk == 2) {
if (errk === 2) {
errkom = 'Такой комплект уже существует<br>';
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');