Multiple Database Selection Based On Url


I am developing an application that is used by many users.Each user of the application has separate database. Currently I am using to achieve this. Now, each user of the application has its own sub users.How can I make the application to use a single login screen for the users.Is it possible to change the database connection based on the url? Please help.

So the users are going to authenticate against one of the databases, so you need something in the URL to tell you which database to authenticate against?

I have some applications where different users have their own subdomain, and i detect subdomain in index.php and use it to select the right config file. In your case you could detect subdomain and do some kind of selection of database.