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

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