Dual login doesn't work (cookiedomain)

drupaldevloper - March 26, 2007 - 07:55
Project:Drupal vB
Version:5.x-2.0-rc3
Component:Code
Category:bug report
Priority:normal
Assigned:sun
Status:fixed
Description

i have use the drupalvb module, it is configured as mention.

there are no errors, but the issue is:

while login in to the drupal, there is message that you can also logiv/view o forum, than if i will click to the view forum link it will redirect to the forum but it is not logged in to the forum, all settings in the admin/settings/drupalvb are set.

so is there any muisconfig. or bug so that one login is not working for drupal and vbulletin

#1

Keyz - March 26, 2007 - 22:16

I don't have a solution, but just letting you know that I have the exact same experience. To the best of my knowledge, everything is configured exactly perfect, yet logging in to Drupal does not log me into vBulletin. I thought I remembered this working while testing older versions (I know it doesn't work both directions - e.g. logging into vBulletin - but I thought that logging into Drupal did in fact work for both).

Anyhow, just mentioning it so you know it's not only you.

#2

JStarcher - March 30, 2007 - 02:25

Clear your browsers cookies.

Login to Drupal.

Check your browsers cookies and there should be some new ones set. Unless you changed your vBulletin cookie prefix, the cookies will begin with 'bb'. If the cookies are there, post them for me and I will see if I can help. Don't worry, all sensitive data in the cookies are encrypted so it wouldn't be a security issue if you posted them here.

If the cookies aren't set, post back and I will see what I can do from there.

#3

ochiburi - June 26, 2007 - 09:14

I also have the exact same problem, but I have found out why, though still not sure how to fix it yet...

Basically the vBulletin cookie has the www. url prefix, but the drupal cookie has no www. prefix.

I will try a few things out and post back if i find out the way to fix this

Laurence.

#4

ochiburi - June 26, 2007 - 12:26

OK, I had to do 2 things to fix this.

1) set the $base_url variable in site/default/Settings.php to "http://www.mysite.co.uk", not just "http://mysite.co.uk"
2) In vBulletin Admin, set the vBulletin Options, Cookies and HTTP Headers, Cookie Domain value to ".mysite.co.uk" - note the leading "." (for me this was one of the suggested values in the pick list anyway)

This got it working OK for me, but much depends on your domain configuration, and whether or not you are using multiple drupal domains on the same server or are hosting multiple vbulletin domains.

My own setup is very simple - one drupal domain, one vbulletin domain. For clarity these are setup as follows:

Drupal domain = http://mysite.co.uk/drupalfolder
vbulletin domain = http://mysite.co.uk/forums

Hope this helps,
Laurence.

#5

at3r - October 16, 2007 - 12:30

does this solution work for anyone else? I did what was suggested and I doesn't work

I can login to my vbulletin with the default account and I can see all the drupal users there but no one can login

Anyone found the solution to this?

#6

sun - April 19, 2008 - 02:25
Category:task» support request
Status:active» fixed

Documentation has been updated. Feel free to re-open this issue if dual login is still not working for you.

#7

anstosser - May 2, 2008 - 16:00
Status:fixed» active

Hey folks,

first of all many thanks to sun for distributing this module!

I re-open this issue because it still does not work for me. I installes & cnfigured everything as expected.
drupal & vb use same cookie-domain. users are successfully imorted to vbulletin, but if I login into drupal i´m not automatically logged to vb & vice versa.

I use drupal 5.7 & vb3.6.10 located in:
drupal= htdocs/drupal
vb= htdocs/drupal/forums
db connection is ok, drupal uses no prefix and vb uses "vb_"

I donnot know what to do else....
If you need further info please let me know. I can give you fully access to the page...
pls help :-)

#8

sun - May 2, 2008 - 17:01
Priority:critical» normal
Status:active» active (needs more info)

1) Are you running Drupal in a sub-directory?
2) Did you apply any changes regarding cookie domain to your settings.php? If so, which? And what happens if you remove/disable them?
3) Did you alter the cookie domain in vB's settings?

#9

anstosser - May 3, 2008 - 12:59

Hey sun! thanks for the fast answer...

1) yes, drupal is located in htdocs/1
vb is located in htdocs/1/forums

2) yes, I set session.cookiedomain... to domain.de & I removed the rest of default cookie-settings. the behavoir does not change anyway.

3)yes, form empty to .domain.de

#10

sun - May 3, 2008 - 15:54
Title:drupalvb and vbulletin(login issue)» Dual login doesn't work (cookiedomain)
Version:5.x-1.0» 5.x-2.0-rc3

1) So htdocs/1 is your DocumentRoot for domain.de?
2) If Drupal is accessible at domain.de and vB at domain.de/forum, then you should not have to alter any cookiedomain and cookiepath settings at all, because this is the default setup.

Also, Drupal's cookiedomain settings in settings.php have been changed recently. I've updated the docs accordingly now.

#11

anstosser - May 4, 2008 - 00:07

Hi sun,

1) I´ve just made htdocs/1 to document root by alter server settings. Now navigating to domain.de leads to drupal. imho this should be the cookie domain also...

2) I´ve reset all changes due to cookiedomain settings in admincp & settings.php. Now everything should be default...

of course I delete cookies everytime I change anything...

still no single login

//Nachtrag: lol...Hätts ja ruhig mal sagen können, dass du Deutscher bist...Das würd die Kommunikation doch sehr vereinfachen :-)

#12

anstosser - May 3, 2008 - 23:47

ok, I´ve copied my settings from settings & config.php. perhaps this helps...

This is settings.php with default values...

ini_set('arg_separator.output',     '&');
ini_set('magic_quotes_runtime',     0);
ini_set('magic_quotes_sybase',      0);
ini_set('session.cache_expire',     200000);
ini_set('session.cache_limiter',    'none');
ini_set('session.cookie_lifetime',  2000000);
ini_set('session.gc_maxlifetime',   200000);
ini_set('session.save_handler',     'user');
ini_set('session.use_only_cookies', 1);
ini_set('session.use_trans_sid',    0);
ini_set('url_rewriter.tags',        '');
//$cookie_domain = 'domain.de';

And this is config.php in forums/include & modules/drupalvb

// ****** DATENBANK: TYP ******
// Tragen Sie hier den Typ Ihres Datenbankservers ein, auf dem sich die vBulletin-Datenbank
// befinden wird bzw. befindet. Gueltige Optionen sind mysql und mysqli.
// Versuchen Sie es mit mysqli, wenn Sie PHP 5 und MySQL 4.1+ verwenden.
// Wenn Sie eine Master-Slave Datenbankkonfiguration betreiben moechten, tragen Sie 'mysql_slave' bzw. 'mysqli_slave' ein.
$config['Database']['dbtype'] = 'mysql';

// ****** DATENBANK: NAME DER DATENBANK ******
// Tragen Sie hier den Namen der Datenbank ein, mit der vBulletin arbeiten soll.
// Diesen Datenbanknamen erhalten Sie normalerweise von Ihrem Provider.
$config['Database']['dbname'] = 'dbname';

// ****** TABELLEN-PRAEFIX ******
// Praefix, das den Tabellennamen in der Datenbank vorangestellt wird.
// Zum Beispiel: $config['Database']['tableprefix'] = 'vb3_';
// Hinweis: Praefixe fuer die Tabellennamen koennen Sie mit der Datei
// install/tableprefix.php hinzufuegen, aendern oder entfernen.
$config['Database']['tableprefix'] = 'vb_';

// ****** TECHNISCHE E-MAIL-ADRESSE ******
// Treten Fehler bei der Datenbank auf, wird eine E-Mail mit einer Fehlerbeschreibung
// an diese Adresse geschickt.
// Falls Sie hier keine E-Mail-Adresse eintragen, werden bei Datenbankfehlern keine
// E-Mails verschickt.
$config['Database']['technicalemail'] = 'info@domain.de';

// ****** LEEREN SQL-MODUS ERZWINGEN ******
// In neueren Versionen von MySQL (4.1+) gibt es einige Neuerungen, die nicht mit vBulletin
// kompatibel sind. Wenn Sie diese Einstellung auf "true" setzen, werden diese Neuerungen
// deaktiviert. Sie muessen diese Einstellung nur aendern, wenn vBulletin Sie dazu auffordert.
$config['Database']['force_sql_mode'] = false;



// ****** MASTER-DATENBANK: SERVERNAME UND PORT ******
// Tragen Sie hier den Hostnamen oder die IP-Adresse und den Port Ihres Datenbankservers ein.
// Wenn Sie sich nicht sicher sind, was Sie hier eintragen muessen, versuchen Sie es zunaechst
// mit dem Standardwerten.
$config['MasterServer']['servername'] = 'localhost';
$config['MasterServer']['port'] = 3306;

// ****** MASTER-DATENBANK: BENUTZERNAME & KENNWORT ******
// Tragen Sie hier den Benutzernamen und das Kennwort ein, die Sie fuer den Zugriff
// auf den MySQL-Server benoetigen.
// Den Benutzernamen und das Kennwort erhalten Sie von Ihrem Provider.
$config['MasterServer']['username'] = 'username';
$config['MasterServer']['password'] = 'pwd';

// ****** MASTER-DATENBANK: PERSISTENTE VERBINDUNGEN ******
// Hier koennen Sie festlegen, ob persistente Verbindungen zu MySQL genutzt werden sollen.
// Der Performance-Unterschied ist im Normalfall vernachlaessigbar, ausser vielleicht
// bei extrem grossen Foren.
// Wenn Sie nicht sicher sind, was Sie hier angeben sollen, lassen Sie die Einstellung
// auf aus.
// 0 = aus; 1 = an
$config['MasterServer']['usepconnect'] = 0;



// ****** SLAVE-DATENBANK: KONFIGURATION ******
// Wenn Sie zwei Datenbankserver verwenden, koennen Sie hier die Daten fuer den Slave-Server
// festlegen.
// Wenn Sie sich nicht 100% sicher sind, ob Sie hier etwas eintragen muessen, veraendern Sie die
// Standardeinstellungen nicht.
$config['SlaveServer']['servername'] = '';
$config['SlaveServer']['port'] = 3306;
$config['SlaveServer']['username'] = '';
$config['SlaveServer']['password'] = '';
$config['SlaveServer']['usepconnect'] = 0;



// ****** PFADE ZUM ADMINISTRATOR- UND MODERATOR-KONTROLLZENTRUM ******
// Hier koennen Sie fuer die Verzeichnisse, in denen sich die Dateien fuer das
// Administrator- und Moderator-Kontrollzentrum befinden, alternative Namen an-
// geben. Vielleicht moechten Sie dies aus Sicherheitsgruenden tun.
// Bitte beachten Sie, dass, wenn Sie die Namen hier aendern, Sie auch noch die
// Namen der Verzeichnisse auf dem Server aendern muessen.
$config['Misc']['admincpdir'] = 'admincp';
$config['Misc']['modcpdir'] = 'modcp';

// ****** COOKIE-PRAEFIX ******
// Praefix, das in allen vBulletin-Cookies enthalten ist.
// Halten Sie es kurz und verwenden Sie nur Zahlen und Buchstaben, d.h. 1-9 und a-Z
$config['Misc']['cookieprefix'] = 'bb';

// ******** VOLLSTAENDIGER PFAD ZUM VERZEICHNIS DES FORUMS ******
// Bei einigen Servern kann es noetig sein, den vollstaendigen Pfad zum Verzeichnis des Forums
// anzugeben, damit vBulletin ohne Probleme funktioniert. Sie muessen diese Einstellung nur
// aendern, wenn vBulletin Sie dazu auffordert.
// Hinweis: Verwenden Sie keinen abschliessenden Schraegstrich ('/') nach dem Verzeichnisnamen.
// Beispiel fuer Unix:
//   $config['Misc']['forumpath'] = '/home/users/public_html/forums';
// Beispiel fuer Win32:
//   $config['Misc']['forumpath'] = 'c:\program files\apache group\apache\htdocs\vb3';
$config['Misc']['forumpath'] = '';



// ****** BENUTZER, DIE DAS KONTROLLZENTRUM-LOG SEHEN DUERFEN ******
// Alle hier angegebenen Benutzer koennen im Administrator-Kontrollzentrum das
// Kontrollzentrum-Log ansehen.
// Die Benutzer werden hier durch ihre User-ID angegeben. Um die User-ID heraus-
// zufinden, sehen Sie sich den Benutzer im Administrator-Kontrollzentrum an.
// Falls Sie diese Datei fuer eine Neuinstallation aendern, lassen Sie den Standard-
// wert stehen, da der erste Benutzer (Administrator) die User-ID 1 erhaelt.
// Trennen Sie mehrere User-IDs mit einem Komma voneinander.
// Beispiel 1: $config['SpecialUsers']['canviewadminlog'] = '1';
// Beispiel 2: $config['SpecialUsers']['canviewadminlog'] = '1,5,9';
$config['SpecialUsers']['canviewadminlog'] = '1';

// ****** BENUTZER, DIE DAS KONTROLLZENTRUM-LOG LOESCHEN DUERFEN ******
// Alle hier angegebenen Benutzer koennen im Administrator-Kontrollzentrum
// Eintraege aus dem Kontrollzentrum-Log loeschen.
// Trennen Sie mehrere User-IDs mit einem Komma voneinander (s.o.).
$config['SpecialUsers']['canpruneadminlog'] = '1';

// ****** BENUTZER, DIE QUERYS AUSFUEHREN DUERFEN ******
// Alle hier angegebenen Benutzer koennen im Administrator-Kontrollzentrum
// Querys (Datenbankabfragen) ausfuehren.
// Trennen Sie mehrere User-IDs mit einem Komma voneinander (s.o.).
// Hinweis: Querys ausfuehren zu koennen, kann eine kritische Angelegenheit sein.
// Aus Sicherheitsgruenden sollten Sie in diese Liste keine User-IDs eintragen.
$config['SpecialUsers']['canrunqueries'] = '';

// ****** UNLOESCHBARE / UNVERAENDERBARE BENUTZER ******
// Alle hier angegebenen Benutzer koennen im Administrator-Kontrollzentrum
// von anderen Benutzern nicht geloescht oder bearbeitet werden.
// Trennen Sie mehrere User-IDs mit einem Komma voneinander (s.o.).
$config['SpecialUsers']['undeletableusers'] = '';

// ****** SUPER-ADMINISTRATOREN ******
// Alle hier angegebenen Benutzer koennen im Administrator-Kontrollzentrum die
// Seite fuer die Administrator-Berechtigungen aufrufen und damit die Rechte
// anderer Administratoren bearbeiten.
// Trennen Sie mehrere User-IDs mit einem Komma voneinander (s.o.).
$config['SpecialUsers']['superadministrators'] = '1';

// ****** DATASTORE-CACHE KONFIGURATION *****
// Hier koennen Sie die verschiedenen Methoden konfigurieren, die fuer den Cache
// der Datastore-Elemente verwendet werden.
// vB_Datastore_Filecache  - um eine Cache-Datei zu verwenden
// $config['Datastore']['class'] = 'vB_Datastore_Filecache';
// vB_Datastore_Memcached - um einen Memcache-Server zu verwenden
// Bei einem Memcache-Server ist es auch notwendig, dass Sie den Hostnamen bzw.
// die IP-Adresse und den Port angeben, unter denen der Server erreichbar ist:
/*
$config['Datastore']['class'] = 'vB_Datastore_Memcached';
$i = 0;
// Erster Server
$i++;
$config['Misc']['memcacheserver'][$i] = '127.0.0.1';
$config['Misc']['memcacheport'][$i] = 11211;
$config['Misc']['memcachepersistent'][$i] = true;
$config['Misc']['memcacheweight'][$i] = 1;
$config['Misc']['memcachetimeout'][$i] = 1;
$config['Misc']['memcacheretry_interval'][$i] = 15;
*/

#13

sun - May 4, 2008 - 20:33

vb is located in htdocs/1/forums

Is it forums (plural) or forum? Drupal vB currently assumes the latter one (singular).

If vB is located in 'forums', you might try to change the following line in the file drupalvb.inc.php:

<?php
function drupalvb_set_login_cookies() {
  ...
 
drupalvb_db_query("INSERT IGNORE INTO {session} (sessionhash, userid, host, idhash, lastactivity, location, useragent, loggedin) VALUES ('%s', %d, '%s', '%s', %d, '%s', '%s', %d)", $sessionhash, $vbuser['userid'], $_SERVER['REMOTE_ADDR'], $idhash, $now, '/forum/', $_SERVER['HTTP_USER_AGENT'], 2);
  ...
?>

...by replacing '/forum/' with '/forums/'.
If that works, we need to find a way to determine the actual directory of vBulletin automatically (instead of hard-coding it).

#14

anstosser - May 4, 2008 - 21:00

well, to be correct at all it´s

htdocs/1/arcade

I changed it to ...$now, '/arcade/', $_S... but behavior is still the same...

Wanna have look at the system?

PS: We´ll need to relaunch this night, cause promo for our first event is gonna be running tomorrow.... If you have a solution, you´ll be my best friend from now on... :-)

PPS: If you like to debug, you may do this at the page directly

#15

sun - May 4, 2008 - 23:21

@anstosser: I'd be willing to debug this on your site, however, didn't received a reply from you.

#16

anstosser - May 5, 2008 - 01:01

Hey sun,

ok, so please create an account on www.zockeroos.de. I´ll give you admin-rights and ftp-data.

ähm...I thought I´ve replied on every comment. did I forget anything?

#17

sun - May 5, 2008 - 12:35
Category:support request» bug report
Assigned to:Anonymous» sun
Status:active (needs more info)» patch (code needs review)

The cause for this sseems to be that PHP is unable to unserialize vB's options in the datastore table. Because of that, attached patch changes retrieval of vB's settings by directly fetching the uncached values from the setting table.

AttachmentSize
drupalvb-DRUPAL-5--2.datastore.patch1.3 KB

#18

anstosser - May 5, 2008 - 14:08

one more time thanks a lot for making the bridge running...

With this patch it works for vb3.6.10 & drupal 5.7 perfectly.

#19

sun - May 6, 2008 - 07:54
Status:patch (code needs review)» fixed

Thanks, committed.

 
 

Drupal is a registered trademark of Dries Buytaert.