Добавлена возможность перехешировать пароль по запросу.
This commit is contained in:
parent
e5cfec57b4
commit
ddb90fcdaa
12
enter.php
12
enter.php
@ -7,17 +7,17 @@ foreach ($_POST as $key => $val) { //???????????????
|
||||
}
|
||||
|
||||
$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_SPECIAL_CHARS);
|
||||
$password = password_hash(filter_input(INPUT_POST, 'password'), PASSWORD_DEFAULT);
|
||||
$password = filter_input(INPUT_POST, 'password');
|
||||
$battle = filter_input(INPUT_COOKIE, 'battle');
|
||||
$error = "";
|
||||
|
||||
if ($username && $password) {
|
||||
$data = db::c()->query('SELECT `id`, `login` ,`pass`, `room`, `block` FROM `users` WHERE `login` = "?s" AND `pass` = "?s"', $username, $password)->fetch_assoc();
|
||||
$data = db::c()->query('SELECT `id`, `login` ,`pass`, `room`, `block` FROM `users` WHERE `login` = "?s"', $username,)->fetch_assoc();
|
||||
|
||||
if (!$data['id']) {
|
||||
$error = 'Неверные учётные данные!';
|
||||
$error = 'Ой! Такого пользователя нет!';
|
||||
} elseif ($data['block'] == 1) {
|
||||
$error = 'Ваш персонаж был заблокирован!';
|
||||
$error = 'Ой! Вы заблокированы!';
|
||||
} elseif (password_verify($password, $data['pass'])) {
|
||||
|
||||
if (!$error) {
|
||||
@ -66,11 +66,9 @@ 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"', password_hash($password_upd, PASSWORD_DEFAULT), $username_upd);
|
||||
echo "Успешно!";
|
||||
header("Location: index.php");
|
||||
} else {
|
||||
echo '<span class="redalert">Ошибка!</span>';
|
||||
header("Location: index.php");
|
||||
$error = 'Ошибка!'
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user