Logging in with Sha5
<p>I'm writing a sign up script, the users password is encrypted like so</p>

<pre><code>$pword = hash('sha512', $_POST['password']);
</code></pre>

<p>when the log in I use the same post script about to encrypt the password then look for a match in the database</p>

<pre><code>$result = mysql_query("SELECT * FROM $table WHERE email = '$email' AND password = '$pword'
  ");
if(mysql_num_rows($result))
 {
//do something
$return['error'] = false;
$return['msg'] = 'Logging In.';
}

else
{
 // Invalid username/password
 $return['error'] = true;
  $return['msg'] = 'Wrong Email Or Password Try Again';
 }
</code></pre>

<p>The problem is I keep getting an error message, it's like the password's don't match.</p>

<p>I changed it to this script </p>

<pre><code>$query_wins ="SELECT * FROM `users` WHERE `email` = \"$email\" AND `password`=\"$pword\" AND `active`='Y'";
$result=mysql_query($query_wins) or die(mysql_error());
$result= mysql_query($query_wins);
$row = mysql_fetch_array($result);
$memid= $row['id'];

 if($memid==""){
$return['error'] = true;
$return['msg'] = 'Wrong Email Or Password Try Again';
}
</code></pre>

<p>And now it just giving me the "Wrong Email Or Password Error"</p>
