From c1bafc1f7714738286b8e3715792a298b56f8244 Mon Sep 17 00:00:00 2001 From: "Igor Barkov [iwork]" Date: Tue, 6 Mar 2018 14:34:57 +0200 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=20=D0=BF=D0=B5=D1=80=D0=B5=D1=85=D0=B5=D1=88?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=BF=D0=B0=D1=80?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=20=D0=BF=D0=BE=20=D0=B7=D0=B0=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D1=81=D1=83.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- enter.php | 10 +++++----- index.php | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/enter.php b/enter.php index 4d743e3..777bd24 100644 --- a/enter.php +++ b/enter.php @@ -63,13 +63,13 @@ $username_upd = filter_input(INPUT_POST, 'username_upd', FILTER_SANITIZE_SPECIAL $password_upd = filter_input(INPUT_POST, 'password_upd'); if ($username_upd && $password_upd) { - $data = db::c()->query('SELECT `id`, `login` ,`pass`, `room`, `block` FROM `users` WHERE `login` = "?s" AND `pass` = "?s"', $username, md5($password))->fetch_assoc(); - if ($data) { - $hashed_password = password_hash($password_upd, PASSWORD_DEFAULT); - db::c()->query('UPDATE `users` SET `pass` = "?s" WHERE `login` = "?s"', $username_upd, $hashed_password); + $data = db::c()->query('SELECT `id`, `login` ,`pass`, `room`, `block` FROM `users` WHERE `login` = "?s" AND `pass` = "?s"', $username_upd, md5($password_upd))->fetch_assoc(); + if ($data['id']) { + db::c()->query('UPDATE `users` SET `pass` = "?s" WHERE `login` = "?s"', $username_upd, password_hash($password_upd, PASSWORD_DEFAULT)); echo 'Пароль обновлён!'; + } else { + echo 'Ошибка!'; } - echo 'Ошибка!'; } ?> diff --git a/index.php b/index.php index da5a8d9..d41693e 100644 --- a/index.php +++ b/index.php @@ -17,13 +17,14 @@ -
+
Обновление пароля
+

Если не пускает внутрь, обнови пароль!