vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   vB login/bridge question (https://vborg.vbsupport.ru/showthread.php?t=266181)

transparentb 07-02-2011 11:33 PM

vB login/bridge question
 
I am trying to integrate vBulletin's login with our CMS login. In the login extension I am trying to get it to mimic the functionality as if you clicked the 'Remember Me' checkbox when logging onto vb's login page.

I am setting the cookies that vb uses and have verified that my cookies look exactly like the cookies that vb generated. But for some reason, vbulletin logs out all of our users based on the session expiration timing. I have looked at the data being inserted into the session table and mine matches what is insert by vb.

I am at a complete loss as to why this isn't working and vb won't leave our users logged in. Any insight would be fantastic. Thanks in advance for your help.

In case it helps, cookie calls:

Code:

setcookie($cookie_prefix.'sessionhash', $now, 0, "/", $base_forum_url, 0, true);
  setcookie($cookie_prefix.'userid', $userid, time()+60*60*24*365, "/", $base_forum_url, 0, true);
  setcookie($cookie_prefix.'lastvisit', $timenow, time()+60*60*24*365, "/", $base_forum_url, 0, false);
  setcookie($cookie_prefix.'lastactivity', 0, time()+60*60*24*365, "/", $base_forum_url,0, false);
  setcookie($cookie_prefix.'password', $password, time()+60*60*24*365, "/", $base_forum_url, 0, true);
$base_forum_url = .ourwebsite.com


kh99 07-02-2011 11:48 PM

Someone asked a similar question recently and it turned out to be the cookie path setting in the vb admin CP. It needs to be set to '/' or else it won't get the cookies. (Not sure if you're having the same problem because IIRC that problem was with people being logged out immediately).

transparentb 07-03-2011 12:10 AM

Quote:

Originally Posted by kh99 (Post 2216081)
Someone asked a similar question recently and it turned out to be the cookie path setting in the vb admin CP. It needs to be set to '/' or else it won't get the cookies. (Not sure if you're having the same problem because IIRC that problem was with people being logged out immediately).

We're setting / as the path when creating the cookies and the vB admin matches it. I think that's all fine. Thank you for replying.

kh99 07-03-2011 12:31 AM

The only other thing I can think of when looking at the session code is that because of this line:

Code:

if (md5($userinfo['password'] . COOKIE_SALT) == $password)
{


it looks like the password you set in the cookie needs to be md5($password . COOKIE_SALT)

(sorry if you've already done that - after this I'm done :))

transparentb 07-03-2011 07:10 AM

Quote:

Originally Posted by kh99 (Post 2216086)
The only other thing I can think of when looking at the session code is that because of this line:

Code:

if (md5($userinfo['password'] . COOKIE_SALT) == $password)
{


it looks like the password you set in the cookie needs to be md5($password . COOKIE_SALT)

(sorry if you've already done that - after this I'm done :))

That got us in the right direction actually. It was already setup like that but from 4.0 > 4.1.4 they md5 3 deep instead of 2 I believe so had to make the changes.

Final issue is that logging into the admincp goes into an infinite loop. Once again seems to be some kind of cookie problem. Blah.

Thanks for your input so far kh, you rock.

35mm 08-04-2011 03:23 PM

Quote:

Originally Posted by transparentb (Post 2216135)
...from 4.0 > 4.1.4 they md5 3 deep instead of 2 I believe so had to make the changes.

What changes? Can you show us an example? I'm trying to auto login to vb from my site's login system too. Having trouble generating the bb_password - how does the hashing & salting go?

--------------- Added [DATE]1312475427[/DATE] at [TIME]1312475427[/TIME] ---------------

No worries. Just got it working - I had got my variables confused lol. I'm not having any problems logging into admin panel though.

dog199200 08-06-2011 03:21 AM

What CMS are you using? Is it custom made, or by a company? The reason I ask, is if it's custom made, then it would almost just be easier to use integrate the vb systems into it directly. This will allow you to use the same cookie for everything, which would just be the cookie vb set itself.

I don't mess around with the Remember Me settings, but i just used something like:

Code:

<form action="*forum_url*/login.php" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
<script type="text/javascript" src="*forum_url*/clientscript/vbulletin_md5.js"></script>

<label for="user">Username:</label><br />
<input name="vb_login_username" size="15" accesskey="u" type="text" /><br />
<label for="pass">Password:</label><br />
<input name="vb_login_password" type="password" size="15" /><br />

<input name="s" value="" type="hidden">
<input name="do" value="login" type="hidden">
<input name="vb_login_md5password" type="hidden">
<input name="vb_login_md5password_utf" type="hidden">

<input type="image" src="http://www.divineshadowsonline.com/images/login.png" accesskey="s" alt="Login">
</form>

All you have to do is find the field value for the Remember Me, and vB's internal settings should do the rest


All times are GMT. The time now is 01:07 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01235 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete