Hi all,
I'm trying to achieve the following by a plugin (don't wanna mess around in the source), but I have no idea how. I hope someone can help me out.
I have one domain with a roundcube installation. Multiple domains can login here: mail.domain1.com, mail.domain2.com, mail.domain3.net. I want to use a different database for each domain. So when a user login, the correct database should be selected.
Any help would be appreciated.
Why? Could could do a if else in the db.inc.php if you really wanted to.
Because sometimes a domain should be removed and I don't want to safe the database data of that domain (users, contacts etc). So it is easier to remove a database then write scripts that cleans the database (if I use one database).
How can I write an if else in db.inc.php, based on the used domain for logging in?
if( ??? == 'mail.domain1.com')
{
$rcmail_config['db_dsnw'] = 'mysql://user:password@localhost/database1';
}
else if( ??? == 'mail.domain2.com')
{
$rcmail_config['db_dsnw'] = 'mysql://user:password@localhost/database2';
}
else
{
$rcmail_config['db_dsnw'] = 'mysql://user:password@localhost/database3';
}
Nevermind, came up with the solution of using wildcard subdomains so I can check the HTTP_HOST in the db.inc.php. 8)