Remove unused

This commit is contained in:
Igor Barkov (iwork) 2020-07-03 18:39:46 +03:00
parent 0bf3143ec1
commit 70c8a6959e
2 changed files with 19 additions and 13 deletions

View File

@ -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)
{

View File

@ -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']);
}
}