Select with MD5 password returning empty

0

I'm using the query below to login, it was working normal with normal passwords, but now I'm migrating to the Md5 password, but this only giving invalid password, I believe it's my select that is with error "SELECT * FROM usuarios WHERE usu_login = '".$login."' and usu_senha = 'MD5(".$senha.")'"; more I can not see, what could it be?

include("conn_user.php");


$login= $_POST["login"];
$senha =$_POST["senha"];

$ users="SELECT * FROM users WHERE usu_login = '. $ login."' and username = '".MD5 ($ password).        $ result_users = mysql_query ($ users, $ conn_user);          $ u = mysql_fetch_object ($ result_users);           if (mysql_num_rows ($ result_users) == 1) {

$v_nome          = $u->usu_nome;
$v_senha         = $u->usu_senha;

echo"$v_nome";
echo"$v_senha";


}

In the database, the password is registered like this:

  

2171d30f75d516c10c2f

Already in the query what is happening is greater:

  

2171d30f75d516c10c2f4c79dd270542

    
asked by anonymous 22.09.2016 / 15:56

1 answer

2

Your query is wrong, so do

$usuarios = "SELECT * FROM usuarios WHERE usu_login = '".$login."' and usu_senha = '".MD5($senha)."'";
    
22.09.2016 / 16:09