Authorization Immediately Upon Registration in PHP
Currently, our registration is set up in such a way that the user enters their login and password for the first time during registration, and then immediately enters them a second time to log in to the site.
This is actually not very convenient and will irritate users. It's better to make it so that upon successful registration, an automatic authorization occurs immediately. To do this, immediately after successful registration, we will write a mark of successful authorization into the session:
<?php
if (!empty($_POST['login']) and !empty($_POST['password'])) {
$login = $_POST['login'];
$password = $_POST['password'];
$query = "INSERT INTO users SET login='$login', password='$password'";
mysqli_query($link, $query);
$_SESSION['auth'] = true; // authorization mark
}
?>
Modify your code so that after registration the user automatically becomes authorized.