Добавлена возможность перехешировать пароль по запросу.

This commit is contained in:
Igor Barkov [iwork] 2018-03-06 15:00:07 +02:00
parent c1bafc1f77
commit e5cfec57b4

View File

@ -65,10 +65,12 @@ $password_upd = filter_input(INPUT_POST, 'password_upd');
if ($username_upd && $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_upd, md5($password_upd))->fetch_assoc(); $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']) { if ($data['id']) {
db::c()->query('UPDATE `users` SET `pass` = "?s" WHERE `login` = "?s"', $username_upd, password_hash($password_upd, PASSWORD_DEFAULT)); db::c()->query('UPDATE `users` SET `pass` = "?s" WHERE `login` = "?s"', password_hash($password_upd, PASSWORD_DEFAULT), $username_upd);
echo '<span class="greenalert">Пароль обновлён!</span>'; echo "Успешно!";
header("Location: index.php");
} else { } else {
echo '<span class="redalert">Ошибка!</span>'; echo '<span class="redalert">Ошибка!</span>';
header("Location: index.php");
} }
} }