errors fix

This commit is contained in:
lopar 2019-03-28 17:02:04 +02:00
parent 05b99dfae4
commit adf8db8f02

View File

@ -2,7 +2,7 @@
session_start(); session_start();
include("config.php"); include("config.php");
foreach ($_POST as $key => $val) { //??????????????? foreach ($_POST as $key => $val) { //Проверка всех значений массива POST одним махом.
$_POST[$key] = iconv(mb_detect_encoding($_POST[$key], 'auto'), 'utf-8', $val); $_POST[$key] = iconv(mb_detect_encoding($_POST[$key], 'auto'), 'utf-8', $val);
} }
@ -55,24 +55,6 @@ if ($username && $password) {
} }
} }
} }
/**
* Обновляем пароли пользователей...
*/
$username_upd = filter_input(INPUT_POST, 'username_upd', FILTER_SANITIZE_SPECIAL_CHARS);
$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"', password_hash($password_upd, PASSWORD_DEFAULT), $username_upd);
header("Location: index.php");
} else {
$error = 'Ошибка!';
}
}
?> ?>
<!doctype html> <!doctype html>