Добавлена возможность перехешировать пароль по запросу.
This commit is contained in:
parent
9196512713
commit
c1bafc1f77
10
enter.php
10
enter.php
@ -63,14 +63,14 @@ $username_upd = filter_input(INPUT_POST, 'username_upd', FILTER_SANITIZE_SPECIAL
|
|||||||
$password_upd = filter_input(INPUT_POST, 'password_upd');
|
$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, md5($password))->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) {
|
if ($data['id']) {
|
||||||
$hashed_password = password_hash($password_upd, PASSWORD_DEFAULT);
|
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"', $username_upd, $hashed_password);
|
|
||||||
echo '<span class="greenalert">Пароль обновлён!</span>';
|
echo '<span class="greenalert">Пароль обновлён!</span>';
|
||||||
}
|
} else {
|
||||||
echo '<span class="redalert">Ошибка!</span>';
|
echo '<span class="redalert">Ошибка!</span>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -17,13 +17,14 @@
|
|||||||
<input type=submit value='Отправить'>
|
<input type=submit value='Отправить'>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div style="background: seashell; border-radius: 5px; margin: 10px; padding: 10px;">
|
<div style="background: seashell; border-radius: 5px; margin-top: 10px; padding: 10px; display: inline-block;">
|
||||||
<form method="post" action="enter.php">
|
<form method="post" action="enter.php">
|
||||||
Обновление пароля<br>
|
Обновление пароля<br>
|
||||||
<input name='username_upd' placeholder='Логин'>
|
<input name='username_upd' placeholder='Логин'>
|
||||||
<input name='password_upd' placeholder='Пароль' type="password">
|
<input name='password_upd' placeholder='Пароль' type="password">
|
||||||
<input type=submit value='Отправить'>
|
<input type=submit value='Отправить'>
|
||||||
</form>
|
</form>
|
||||||
|
<p>Если не пускает внутрь, обнови пароль!</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="menu">
|
<ul class="menu">
|
||||||
|
Loading…
Reference in New Issue
Block a user