Select with MD5 password returning empty

Asked

Viewed 244 times

0

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

include("conn_user.php");


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

$usuarios = "SELECT * FROM usuarios WHERE usu_login = '". $login." ' and usu_password = '". 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 bank is the password registered so:

2171d30f75d516c10c2f

Already in consultation what is going through this bigger:

2171d30f75d516c10c2f4c79dd270542

1 answer

2


your query is wrong, do so

$usuarios = "SELECT * FROM usuarios WHERE usu_login = '".$login."' and usu_senha = '".MD5($senha)."'";
  • Still giving error, stranger was that, as I edited it in the question,no select the password ta bigger than in the bank. in the bank this way: 2171d30f75d516c10c2f more in the query ta so: 2171d30f75d516c10c2f4c79dd270542 what could be.

  • what is the configuration of your field that stores the password? is varchar how much ? Put the error that you are giving in my query,

  • was that,vlw,the password field is with varchar(20) so not making all md5.

  • rssss q good q helped

  • Thanks again.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.