I installed a login and registration system in a hosting, I adjusted the database and connected with the system, I even created a user to test the login. However when I log in he has these errors:
Warning: mysqli_query() expects at least 2 parameters, 1 given in /srv/disk5/2615118/www/ge2018.atspace.eu/classes/Login.class.php on line 4
Warning: mysql_num_rows() expects parameter 1 to be resource, null given in /srv/disk5/2615118/www/ge2018.atspace.eu/classes/Login.class.php on line 5
The error code below follows:
<?php
class Login{
public function logar($email, $senha){
$buscar=mysqli_query("SELECT * FROM usuarios WHERE email='$email' AND senha='$senha' LIMIT 1");
if(mysql_num_rows($buscar) == 1){
$dados=mysql_fetch_array($buscar);
if($dados["status"] == 1){
$_SESSION["email"]=$dados["email"];
$_SESSION["senha"]=$dados["senha"];
$_SESSION["nivel"]=$dados["nivel"];
setcookie("logado",1);
$log=1;
}else{
$flash="Aguarde a nossa aprovação!";
}
}
if(isset($log)){
$flash="Você foi logado com sucesso";
}else{
if(empty($flash)){
$flash="Ops! Digite seu e-mail e sua senha corretamente!";
}
}
echo $flash;
}
}
?>