0
YOU ARE MAKING THAT MISTAKE WHEN YOU GO IN :
Warning: mysqli_query() expects at least 2 Parameters, 1 Given in C: xampp htdocs hosste Login_v1 userauthentication.php on line 28
Warning: mysqli_error() expects Exactly 1 Parameter, 0 Given in C: xampp htdocs hosste Login_v1 userauthentication.php on line 28
<?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "tomorrow";
$conexao =mysqli_connect($host, $user, $pass) or die (mysql_error());
mysqli_select_db($conexao, $db) or die(mysql_error());
?>
<html>
<head>
<title>Autenticando usuário</title>
<script type="text/javascript">
function loginsuccessfully() {
setTimeout("window.location='painel.php'", 5000);
}
function loginfailed(){
setTimeout("window.location='login.php'", 5000);
}
</script>
</head>
<body>
<?php
$email=$_POST['email'];
$senha=$_POST['senha'];
$sql = mysqli_query("SELECT * FROM usuarios WHERE email = '$email' and senha = '$senha'") or die(mysqli_error());
$row = mysqli_num_rows($sql);
if($row > 0){
session_start();
$_SESSION['email']=$_POST['email'];
$_SESSION['senha']=$_POST['senha'];
echo "<center>Você foi autenticado com sucesso!</center>";
echo "<script>loginsuccessfully()</script";
} else {
echo "<center>Nome de usuario ou senha invalido!</center>";
echo "<script>loginfailed()</script>";
}
?>
</body>
</html>
What
var_dump($_POST)
prints, so you send the form?– Erlon Charles
men did not understand, I saw in a tutorial that there
– Felipe Lima