RE: [PHP-DB] Selecting PASSWORD() value in MySQL

2002-10-11 Thread Tim Haak

The query didn't return any rows when the only row in the table matched the criteria.  
Someone else suggested adjusting the field width in the table which worked.  I didn't 
think the PASSWORD() function added that many additional characters (5 character 
password resulted in a string longer than 15).  The stored string's end was 
concatenated.  I found that in my example it made the string 4 times as long.

Thanks!

Tim Haak

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 10, 2002 7:17 PM
To: Tim Haak; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Selecting PASSWORD() value in MySQL


> I'm trying to retrieve data from a MySQL table which contains data
> encrypted with the MySQL "PASSWORD()" function from a PHP script but I
> can't seem to get it to work.  Below is the query I'm trying:
> 
> SELECT * FROM user_data WHERE username = 'thaak' AND password =
> PASSWORD('thaak');
> 
> I then tried the following subquery/subselect:
> 
> SELECT * FROM user_data WHERE username = 'thaak' AND password IN
(SELECT
> PASSWORD('thaak') FROM user_data);
> 
> ...which also didn't work.

How do you know it "didn't work"? The first query is what you want to
use. If you are using PHP variables, make sure they actually have the
values you expect in them.

---John Holmes...



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Selecting PASSWORD() value in MySQL

2002-10-11 Thread John W. Holmes

PASSWORD() always returns a string that's 16 characters long.

---John Holmes...

> -Original Message-
> From: Tim Haak [mailto:[EMAIL PROTECTED]]
> Sent: Friday, October 11, 2002 8:05 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Selecting PASSWORD() value in MySQL
> 
> The query didn't return any rows when the only row in the table
matched
> the criteria.  Someone else suggested adjusting the field width in the
> table which worked.  I didn't think the PASSWORD() function added that
> many additional characters (5 character password resulted in a string
> longer than 15).  The stored string's end was concatenated.  I found
that
> in my example it made the string 4 times as long.
> 
> Thanks!
> 
> Tim Haak
> 
> -Original Message-
> From: John W. Holmes [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 10, 2002 7:17 PM
> To: Tim Haak; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Selecting PASSWORD() value in MySQL
> 
> 
> > I'm trying to retrieve data from a MySQL table which contains data
> > encrypted with the MySQL "PASSWORD()" function from a PHP script but
I
> > can't seem to get it to work.  Below is the query I'm trying:
> >
> > SELECT * FROM user_data WHERE username = 'thaak' AND password =
> > PASSWORD('thaak');
> >
> > I then tried the following subquery/subselect:
> >
> > SELECT * FROM user_data WHERE username = 'thaak' AND password IN
> (SELECT
> > PASSWORD('thaak') FROM user_data);
> >
> > ...which also didn't work.
> 
> How do you know it "didn't work"? The first query is what you want to
> use. If you are using PHP variables, make sure they actually have the
> values you expect in them.
> 
> ---John Holmes...
> 
> 
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Selecting PASSWORD() value in MySQL

2002-10-10 Thread John W. Holmes

> I'm trying to retrieve data from a MySQL table which contains data
> encrypted with the MySQL "PASSWORD()" function from a PHP script but I
> can't seem to get it to work.  Below is the query I'm trying:
> 
> SELECT * FROM user_data WHERE username = 'thaak' AND password =
> PASSWORD('thaak');
> 
> I then tried the following subquery/subselect:
> 
> SELECT * FROM user_data WHERE username = 'thaak' AND password IN
(SELECT
> PASSWORD('thaak') FROM user_data);
> 
> ...which also didn't work.

How do you know it "didn't work"? The first query is what you want to
use. If you are using PHP variables, make sure they actually have the
values you expect in them.

---John Holmes...



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Selecting PASSWORD() value in MySQL

2002-10-10 Thread Tim Haak

Hello,

I'm trying to retrieve data from a MySQL table which contains data encrypted with the 
MySQL "PASSWORD()" function from a PHP script but I can't seem to get it to work.  
Below is the query I'm trying:

SELECT * FROM user_data WHERE username = 'thaak' AND password = PASSWORD('thaak');

I then tried the following subquery/subselect:

SELECT * FROM user_data WHERE username = 'thaak' AND password IN (SELECT 
PASSWORD('thaak') FROM user_data);

...which also didn't work.

If I just execute "SELECT PASSWORD('thaak')" from the MySQL command line it returns 
the same value stored in the password column of my user_data table.  I verified these 
queries at the MySQL command line so I don't think it's a PHP problem.

I need to compare the password the user enters to log in against the password stored 
in the DB.  In addition to the "PASSWORD()" function, I also tried "MD5()" and 
"ENCRYPT()" but they also failed.  Can someone please help me accomplish this or point 
me to some resources that might help?

Thanks!

Tim Haak

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php