0
follows below the code of the register that I made. In thesis it is working perfectly, but at the end of the moment it is to give the INSERT, it ends up falling in LSE (ie, the registration was wrong)
<?php
require 'conexao.php'; //$con
$nome = $_POST['nome'];
$senha = md5($_POST['senha']);
$senha2 = md5($_POST['senha2']);
$email = $_POST['email'];
$link = mysqli_query($con, "SELECT email FROM usuarios WHERE email = $email");
$array = mysqli_fetch_array($link);
$emailarray = $array['email'];
if($senha2 != $senha){
echo"
<script type='text/javascript'>
alert('os campos senha e repetir senha devem ser iguais');
window.location.href='../cadastro.php';
</script>
";
}elseif($emailarray == $email){
echo
"
<script type='text/javascript'>
alert('o email . $email . já está cadastrado, tente outro!');
window.location.href = '../cadastro.php';
</script>
";
}else{
$cadastro = mysqli_query($con, "INSERT INTO usuarios (nome, senha, email) VALUES ($nome, $senha, $email)");
//Possivel localização do erro
if($cadastro){
echo
"
<script type='text/javascript'>
alert('parabens . $nome . , voce foi cadastrado com sucesso');
window.location.href = '../index.php';
</script>
";
} else{
echo
"
<script type='text/javascript'>
alert('erro ao se cadastrar, tente novamente mais tarde');
window.location.href = '../cadastro.php';
</script>
";
}
}
?>
I’d like to know the reason why I fell into Isis, thank you :)