Drupal Login Cookie

I noticed a weird issue when hosting multiple Drupal installations on the same domain, like a software company hosting all client demos on a single domain. The scenario is: you will get kicked out from any installation as soon as you login to another. I totally understand it's not a very common situation since the common is hosting all your sites from one code with multiple databases but I have mentioned the case this patch is targeting. To cut it short, I managed to write these few lines that allow multiple logins to multiple Drupal installations on a single domain: Simply add these lines near the end of your settings.php if (isset($base_url)) { $clean_base_url = str_replace('http://', '', $base_url); $base_array = explode('/', $clean_base_url); $cookie_domain = array_shift($base_array); $cookie_path = implode('/', $base_array); ini_set('session.cookie_domain', $cookie_domain); ini_set('session.cookie_path', '/'.$cookie_path); } Note: Needless to say that you *should* have set $base_url above this block of code. Hope This Helps.
Thanks much for the information!
Sounds like it would be much easier with mutliple domains. Thanks for the info. ~Diego www.ictsviluppo.it
Until that time I have not read about it
Thanks for the info! ~Madison

About Me

I am Omar. An OpenSource enthusiast, I do Drupal contributing and service providing. Get some more boring details here. You may contact me for any ideas, questions or help.

Tags

Online

There are currently 0 users and 2 guests online.
Powered by Drupal, an open source content management system