From 70c8a6959eac9e06fe4b9cd32a32ef7968469b87 Mon Sep 17 00:00:00 2001 From: "Igor Barkov (iwork)" Date: Fri, 3 Jul 2020 18:39:46 +0300 Subject: [PATCH] Remove unused --- functions.php | 24 ++++++++++++------------ user_anketa.php | 8 +++++++- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/functions.php b/functions.php index ee24624..0ce816b 100644 --- a/functions.php +++ b/functions.php @@ -178,18 +178,18 @@ function level_up($uid) /* * Проверка делающая левелап и ограничитель максимального уровня. */ -if (isset($_SESSION['uid'])) { - try { - $userInfo = db::c()->query('SELECT `exp`, `nextup`, `level` FROM `users` WHERE `id` = ?i', $_SESSION['uid'])->fetch_assoc(); - if ($userInfo && ($userInfo['exp'] >= $userInfo['nextup']) && $userInfo['level'] < 50) { - level_up($_SESSION['uid']); - $levelUpArray = ['nextup' => $nextup, 'stats' =>]; - db::c()->query('UPDATE users SET ?Ai, stats = (stats +2), level = (level +1) WHERE id = ?i', $levelUpArray, $_SESSION['uid']); - } - } catch (\Krugozor\Database\Mysql\Exception $e) { - echo $e->getTraceAsString(); - } -} +//if (isset($_SESSION['uid'])) { +// try { +// $userInfo = db::c()->query('SELECT `exp`, `nextup`, `level` FROM `users` WHERE `id` = ?i', $_SESSION['uid'])->fetch_assoc(); +// if ($userInfo && ($userInfo['exp'] >= $userInfo['nextup']) && $userInfo['level'] < 50) { +// level_up($_SESSION['uid']); +// $levelUpArray = ['nextup' => $nextup, 'stats' =>]; +// db::c()->query('UPDATE users SET ?Ai, stats = (stats +2), level = (level +1) WHERE id = ?i', $levelUpArray, $_SESSION['uid']); +// } +// } catch (\Krugozor\Database\Mysql\Exception $e) { +// echo $e->getTraceAsString(); +// } +//} function savecavedata($cavedata, $caveleader, $floor) { diff --git a/user_anketa.php b/user_anketa.php index 321c521..8446519 100644 --- a/user_anketa.php +++ b/user_anketa.php @@ -10,6 +10,10 @@ if ($user['battle'] > 0) { header('Location: /fbattle.php'); die(); } +use Krugozor\Database\Mysql\Mysql as Mysql; +$db = Mysql::create("192.168.20.100", "battles", "bottle-neck-horse") + ->setDatabaseName("battles") + ->setCharset("utf8"); $name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING); $oldpsw = filter_input(INPUT_POST, 'oldpsw', FILTER_SANITIZE_SPECIAL_CHARS); @@ -33,7 +37,9 @@ if ($name || $color || $hobbie) { if ($simbolcount > 1500) { err('Максимальная длинна поля Хобби: 1500 символов!'); } else { - db::c()->query('UPDATE `users` SET `realname` = "?s", `color` = "?s", `info` = "?s" WHERE `id` = ?i', $name, $color, $hobbie, $user['id']); + //db::c()->query('UPDATE `users` SET `realname` = "?s", `color` = "?s", `info` = "?s" WHERE `id` = ?i', $name, $color, $hobbie, $user['id']); + $values = ['realname'=>$name, 'color'=>$color, 'info'=>$hobbie]; + $db->query('UPDATE users SET ?As WHERE id = ?i', $values, $user['id']); } }