Answer the question
In order to leave comments, you need to log in
Why doesn't PHP + MySql authorization work?
<?php
include 'config/bd.php';
if (isset($_POST['submit']))
{
if (empty($_POST['login']))
{
$info_input = 'Вы не ввели логин';
}
elseif (empty($_POST['password']))
{
$info_input = 'Вы не ввели пароль';
}
else
{
$login = $login;
$password = $password;
$user = mysqli_query($connection, "SELECT `id` FROM `user` WHERE `login` = '$login' AND `password` = '$password'");
$id_user = mysqli_fetch_array($user);
if (empty($id_user['id']))
{
$info_input = 'Введенные данные не верны';
}
else
{
$_SESSION['password'] = $password;
$_SESSION['login'] = $login;
$_SESSION['id'] = $id_user['id'];
$info_input = 'Вы успешно вощли в систему';
}
}
}
$info_input = isset($info_input) ? $info_input : NULL;
echo $info_input;
?>
Answer the question
In order to leave comments, you need to log in
$login = $login;
$password = $password;
$login = $_POST["login"];
$password = $_POST["password"];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question