Registered user say with such data login = test, password = 12345 and I try to make an input manually. I am writing a link example.com/login.php?username=test&password=12345 and by code it prints Invalid. Although checked in the database user this is there, all the data is correctly entered, but does not see it. I tried to create another, but the result is the same. Here is my code, then what is commented on, tried the first time to get the answer, the result is the same. Errors do not display.
<?php
error_reporting(E_ALL);
require_once ("connect.php");
$login = mysqli_real_escape_string($conn,$_GET['username']);
$password = mysqli_real_escape_string($conn,$_GET['password']);
$password = md5($password);
$sql = mysqli_query($conn, "SELECT * FROM login WHERE username = '$login' AND password = '$password'");
//if($sql){
// $dados = mysqli_num_rows($sql);
// echo "$dados";
// if($dados > 0){
// echo 'Success';
// }else{
// echo 'Invalid';
// }
//}
$id_user = mysqli_fetch_array($sql);
if (empty($id_user['id'])){
echo 'Invalid';
}
else {
echo 'Success';
}
mysqli_close($conn);
?>