Answer the question
In order to leave comments, you need to log in
Why redirect?
Hello. I have a login page, but if you enter the wrong login or password, or even if the data does not pass regular expressions, then it redirects to blog.glezer.ru/login? . Well, respectively, writes that the page is not found. Here is the link blog.glezer.ru/login. Here is the login handling code:
}else if($_POST['login_f']){
login_valid();
password_valid();
if ( !mysqli_num_rows(mysqli_query($CONNECT, "SELECT `id` FROM `users` WHERE `login` = '$_POST[username]' AND `password` = '$_POST[password]'")) ){
message('Аккаунт не найден');
}
$row = mysqli_fetch_assoc( mysqli_query($CONNECT, "SELECT * FROM `users` WHERE `login` = '$_POST[username]'") );
foreach ($row as $key => $value)
$_SESSION[$key] = $value;
go('profile');
}
function password_valid() {
if ( !preg_match('/^[A-z0-9]{7,30}$/', $_POST['password']) )
message('Пароль указан неверно и может содержать 7 - 30 символов');
$_POST['password'] = md5($_POST['password']);
}
function login_valid() {
if ( !preg_match("/^[A-z0-9]{7,30}$/", $_POST['username']) ){
message('Логин указан неверно и может содержать 7 - 30 символов');
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question