Possible Duplicate:
How to best store user information and user login and password
In our application, we have users from different companies. However, all users log in from the same page. Each company has its own database name and password.
When a user tries to log in, I check for his/her user name and password (salted, and sha-2 hashed). If the they are authorized, i need to connect them to their firm's database.
The firms database name and passwords is encoded and stored in table, should i check and decode database name and password every time when the user needs to access the firm's database. Are there any way to DEFINE firms database name and password (encoded) in config file or something ? What is the secure, modern and professional way for this?
Users table
Users pass firm_id
user1 123 3
user2 344 2
user4 435 3
user5 535 2
firm table
firm_id firm db_name pass
2 ACG co. klf 123
3 XYZ co. tef 434