login varification from 2 tables in one form

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
hello Friends,
I wanted to know is it posible to have one log in window and then
varify the username password from 2 different table in same DB.
that means I have one log in form and then I take info from 2
different tables to varify if the user-pass combination in any of the
table maches to the input values.
My bosss wants me to make soemthign like this, as far as I know its
not posible in PHP but still comfirming

PLease help

Re: login varification from 2 tables in one form

I noticed that Message-ID:
contained the following:

Quoted text here. Click to load it

Don't see why it's not possible.  I'm not sure /why/ you'd want to do it
that way but there is no problem running multiple queries

Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker /

Re: login varification from 2 tables in one form

Geoff Berrow wrote:
Quoted text here. Click to load it



select a.username,b.password from table1 a, table2 b
where a.id = b.id and
       a.username = '$username' and
       b.password = password('$password');

If the record set is empty, there is no match and you should re-direct to the
login page.

or even a single query using a simple join.  If your boss is thinking about
security, well, anyone that gets access to db would eventually figure out the
entity relationships and still get what they want.

For passwords in MySQL, you can PASSWORD() to encode them.  This is a one-way
encryption.  In other words you would verify that the encrypted version of the
password passed in on the form is the same as the stored password in the
database and there are no tools/methods to unscramble the password to find out
what the real password is.

Michael Austin.
Consultant - Available.
Donations welcomed. http://www.firstdbasource.com/donations.html

Re: login varification from 2 tables in one form

On 28 Aug 2004 04:18:45 -0700, smilesinblues@hotpop.com (Jaunty
Edward) wrote:

Quoted text here. Click to load it

I don't know if you mean you have the usernames in one table and the
passwords in another table, (in which case you have another answer
here already), or if you want to check against two different tables
with username/password combinations.
In the latter case, it should't be any problem do check against one
table first, and if that fails, check the other.
First match logs you in.

Site Timeline