Hello All,
I am developing an intranet site, and storing usernames and passwords in a database. I am using the password function to encrypt the passords in the table.
When I try to verify the username and password using a select statement:
select username, password from tablename where username = 'theirname' and password = password('what they typed');
I get an empty set, so I tried this:
select username, password('what they typed') as p1, password from tablename where username = 'theirname';
This worked, or so I thought:
username p1 password
theirname 19a455g8ac56c6af 19a455g8ac56
notice the difference between the p1 and password fields. No matter what I do, the submitted word is always longer. I have run this code through stripslashes() and it is still the same thing.
Based on the above, the following will never test true:
if ($row["p1"] == $row["password"]
{
echo "passwords match!";
}
Any insight into this problem would be greatly appreciated!
TIA
John Pierce
I am developing an intranet site, and storing usernames and passwords in a database. I am using the password function to encrypt the passords in the table.
When I try to verify the username and password using a select statement:
select username, password from tablename where username = 'theirname' and password = password('what they typed');
I get an empty set, so I tried this:
select username, password('what they typed') as p1, password from tablename where username = 'theirname';
This worked, or so I thought:
username p1 password
theirname 19a455g8ac56c6af 19a455g8ac56
notice the difference between the p1 and password fields. No matter what I do, the submitted word is always longer. I have run this code through stripslashes() and it is still the same thing.
Based on the above, the following will never test true:
if ($row["p1"] == $row["password"]
{
echo "passwords match!";
}
Any insight into this problem would be greatly appreciated!
TIA
John Pierce