From 6d7afa131ce57bfa1950526894c4341d4b7496b6 Mon Sep 17 00:00:00 2001 From: "Igor Barkov [iwork]" Date: Fri, 18 Jan 2019 13:12:06 +0200 Subject: [PATCH] todo fixed --- functions.php | 3 --- main.php | 22 +++++++++------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/functions.php b/functions.php index 44fc139..5b535f6 100644 --- a/functions.php +++ b/functions.php @@ -1695,9 +1695,6 @@ function showitem($row, $type = null, $returned = false, $infOnly = false) $returnHTML .= " Этот предмет вам подарил {$row["; // Конец первой строчки - if ($row['type'] == 24 && $type != 11) - $returnHTML .= "
Уровень руны: " . $row['rune_level'] . " (" . $row['rune_exp'] . "/" . $runes_exp[$row['rune_level'] + 1] . ")"; - if (!empty($row['ecost'])) { $returnHTML .= "
Предмет куплен за еврокредиты."; } elseif (!empty($row['point'])) { diff --git a/main.php b/main.php index 4b9f058..93a9ced 100644 --- a/main.php +++ b/main.php @@ -14,29 +14,25 @@ if ($user['battle'] != 0) { die(); } -/// fixme заводить переменную равную нулю и целую функцию, чтобы прибавить к нулю значение? исправить! function sum_mf($u) { - $t = 0; - $r = mysql_fetch_array(mysql_query('SELECT SUM(`add_proc_mf`) AS `mf` FROM `inventory` WHERE `owner` = "' . $u . '" AND `dressed` = "1" AND `add_proc_mf` > 0')); - $r = $t + $r['mf']; - return $r; + $sum = db::c()->query('SELECT SUM(`add_proc_mf`) AS `mf` FROM `inventory` WHERE `dressed` = 1 AND `add_proc_mf` > 0 AND `owner` = ?i', $u); + if ($sum->fetch_assoc() > 0) return $sum; + else return 0; } function sum_dmg($u) { - $t = 0; - $r = mysql_fetch_array(mysql_query('SELECT SUM(`add_proc_uron`) AS `mf` FROM `inventory` WHERE `owner` = "' . $u . '" AND `dressed` = "1" AND `add_proc_uron` > 0')); - $r = $t + $r['mf']; - return $r; + $sum = db::c()->query('SELECT SUM(`add_proc_uron`) AS `mf` FROM `inventory` WHERE `dressed` = 1 AND `add_proc_uron` > 0 AND `owner` = ?i', $u); + if ($sum->fetch_assoc() > 0) return $sum; + else return 0; } function sum_bron($u) { - $t = 0; - $r = mysql_fetch_array(mysql_query('SELECT SUM(`add_proc_bron`) AS `mf` FROM `inventory` WHERE `owner` = "' . $u . '" AND `dressed` = "1" AND `add_proc_bron` > 0')); - $r = $t + $r['mf']; - return $r; + $sum = db::c()->query('SELECT SUM(`add_proc_bron`) AS `mf` FROM `inventory` WHERE `dressed` = 1 AND `add_proc_bron` > 0 AND `owner` = ?i', $u); + if ($sum->fetch_assoc() > 0) return $sum; + else return 0; } function bron_ads($a1, $a2, $a3, $a4, $col)