this is the code that processes the registration
<?php
include_once("conexao.php");
$nome = $_POST['nome'];
$celular = $_POST['celular'];
$email = $_POST['email'];
$senha = $_POST['senha'];
$sql = "INSERT INTO usuarios (nome,celular,email,senha) VALUES ('$nome','$celular','$email','$senha')";
$salvar = mysqli_query($conexao,$sql);
$linhas = mysqli_affected_rows($conexao);
mysqli_close($conexao); ?>
<!DOCTYPE HTML>
<html lang="pt-br">
<head>
<title>Loja - Cadastro</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0" />
<meta name="theme-color" content="#FF0000">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-store" />
<link rel="icon" href="../imagens/favicon.png" type="image/png" />
<link href="../css/style.css" type="text/css" rel="stylesheet" media="screen,projection" />
<link href="../css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection" />
<link href="../css/animate.min.css" type="text/css" rel="stylesheet" media="all">
</head>
<body>
<?php
include("navbarforms.php");
?>
<div class="container-fluid">
<?php
if($linhas == 1){
echo "<h4>Cadastro efetuado com sucesso!</h4>";
header("Location: ../entrar.php");
} else {
echo "<h5 class='red-text'>Usuário <strong>$email</strong> já existente no sistema</h5><br><p class='text-blue mdfont'>Redirecionando para a pagina de cadastro...</p>";
header("refresh: 5; url=../cadastrar.php");
}
?>
</div>
</body>
</html>
and this is the code that processes the login
<?php
session_start();
include("conexao.php");
if (empty($_POST['email']) || empty($_POST['senha'])) {
header("Location: ../entrar.php;");
exit();
}
$email = mysqli_real_escape_string($conexao, $_POST['email']);
$senha = mysqli_real_escape_string($conexao, $_POST['senha']);
$query = "SELECT email, senha FROM usuarios WHERE email = '$email' AND senha = '$senha'";
$result = mysqli_query($conexao, $query);
$row = mysqli_num_rows($result);
if ($row == 1) {
$_SESSION['email'] = $email;
header("location: ../index.php");
exit();
} else {
$_SESSION['nao_autenticado'] = true;
header("location: ../entrar.php");
exit();
}
?>
I would like to know how to send the encrypted password and then log in with the password entered in the registry.