Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-03-2007, 11:31 AM
attilat attilat is offline
 
Join Date: Apr 2007
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Login integration

I have a login script already for my membership site. I match the $username and $password input variables against the vB database, and it works fine. The problem is that users have to log in twice if they want to log in to the forum - first the membership site, then the forum.
This doubled login is really disturbing, what I want is to log the user into the vb forum automatically when they login to the site.

I guess I have to set a cookie from my login script containing the same information as vB sets, and I have searched this forum, but so far have not been able to find a decent solution.
Reply With Quote
  #2  
Old 08-03-2007, 12:15 PM
consolegaming consolegaming is offline
 
Join Date: Jan 2007
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well if you want a very easy way you could use the following plugin:

https://vborg.vbsupport.ru/showthread.php?t=108026

This involves basically including parts of vB on your site (nothing visible but it auto fills some arrays, checks you're logged in etc). There are a few drawbacks to this though which is why we're not using it, if the forum is closed or if a user is temp suspended it seems this same block that stops the user from accessing the forum is also in place for the site too. At our site at least we don't want people not to able to view the site just because they spammed on the forums lol.

If those are disadvantages you can't put up with then the following may well help you:

What we did was use the forum's login script i.e. passed our login info to the login.php page and then on our own site header check for the existence of the cookies vb creates.

For the first part (passing the login info we simply looked at what the forum's login box usually passed to login.php and duplicated it.

and for checking if they were logged in we just did something like;

if (isset($_COOKIE['bbuserid']))
{
$userid = $_COOKIE['bbuserid'];
$userinfo = mysql_fetch_array(mysql_query("SELECT * FROM user WHERE userid = '$userid'"));
}

Also for my suggestion or the above plugin to work on multiple subdomains i.e. if you have forum.website.com or other subdomains you need to alter the value in the forum's admincp at: vBulletin Options -> Cookie and HTTP Header Options -> Cookie DOmain -> Custom Domain then do the following:

if you're website is http:www.google.com then you'd chaneg the cookie domain to .google.com
i.e. a dot then just the main domain.

Hope that helps at least a bit.
Reply With Quote
  #3  
Old 08-06-2007, 01:59 PM
attilat attilat is offline
 
Join Date: Apr 2007
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thx for the tips, I am getting closer to the solution, I can already login both to my site and the forums from my login script, BUT...

login.php makes a redirect on line 130:
// do redirect
do_login_redirect();

If I comment out this line then it will not redirect, BUT no vB login will take place either...
I just cannot figure out how to modify includes/functions_login.php in order to skip this redirection AND still log in to vB. Or if redirect is necessary, is it possible to redirect to an arbitrary mypage.php instead?
Reply With Quote
  #4  
Old 08-06-2007, 02:17 PM
Hex_legend Hex_legend is offline
 
Join Date: May 2007
Posts: 750
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For mine, I used the drupal vb script and it logged me into the site and the forums at the same time perfectly.
Reply With Quote
  #5  
Old 08-07-2007, 07:12 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes the redirect is needed for the cookie to be set.
Reply With Quote
  #6  
Old 08-07-2007, 10:39 AM
attilat attilat is offline
 
Join Date: Apr 2007
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Marco van Herwaarden View Post
Yes the redirect is needed for the cookie to be set.
Thanks for the info, then I will stop trying to get rid of it. Otherwise my script is finally working so I am happy after all... :up:

Well, I will not open a new thread just because of this, but a completely different question:

Now that the integrated login works, I would like to put my site's menubar above vBulletin's. Therefore I included my menubar.php under the <Navigation bar> in the header, however, it seems that php is not parsed within the template.

Now am I missing something, or is it really not so simple to do it as I thought?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:46 PM.


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.05225 seconds
  • Memory Usage 2,206KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete