password('$password') returning 0 results
Posted: Wed Jun 30, 2010 6:38 pm
I have a login page (user name, password) which the password part is not finding any records in the DB. I run my register page and enter a new user name and say pw of 1234567, then go out and try to login and the query finds the user name but fails on the password. I have queried the Db and the record is there but of course the ps is encrypted. The registration code is:
$result = mysql_query("insert into user_profile values (NULL,'$username', '$fname', '$lname', '$email', password('$password'), password('$password2'),'0','0')");
it appears to work fine
The login code is:
function login($username, $password)
// check username and password with db
// if yes, return true
// else return false
{
// connect to db
$conn = db_connect();
if (!$conn)
return false;
// check if username is unique
$result = mysql_query("select * from USER_PROFILE where username='$username' and pswd = password('$password')");
if (!$result)
return false;
if (mysql_num_rows($result)>0)
return true;
else
return false;
}
again doesn't get the password.
Any help would be greatly appreciated.
Thanks,
Dean
$result = mysql_query("insert into user_profile values (NULL,'$username', '$fname', '$lname', '$email', password('$password'), password('$password2'),'0','0')");
it appears to work fine
The login code is:
function login($username, $password)
// check username and password with db
// if yes, return true
// else return false
{
// connect to db
$conn = db_connect();
if (!$conn)
return false;
// check if username is unique
$result = mysql_query("select * from USER_PROFILE where username='$username' and pswd = password('$password')");
if (!$result)
return false;
if (mysql_num_rows($result)>0)
return true;
else
return false;
}
again doesn't get the password.
Any help would be greatly appreciated.
Thanks,
Dean