vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB5 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=263)
-   -   Single login (https://vborg.vbsupport.ru/showthread.php?t=293728)

qdesigns 01-09-2013 04:19 AM

Single login
 
Hey everyone,

I'm quite new to vBulletin and I need to create a single site-wide login for both the forums and my main site. We're currently using a custom-built PHP/MySQL app for the main site, so I'll need to handle the VB integration from scratch.

What's the easiest way to bridge logins between a custom application and VB? My initial thought was just to register a user with the same credentials in both the main app user db and vBulletins db when the user registers for either service. Maybe there's an easier way, though!

Any help is much appreciated! Thanks! :)

gtfreymann 02-25-2013 05:40 PM

I am facing the same issue. I would be happy with even inserting a hook that ensures they have a valid user account in our main system before allowing a login to begin....

betterthanyours 02-27-2013 01:34 PM

Hey, you could look at the following for an example of how it has been done?

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

gtfreymann 02-27-2013 02:31 PM

Quote:

Originally Posted by betterthanyours (Post 2406713)
Hey, you could look at the following for an example of how it has been done?

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

This seems to be geared towards using vBulletin as the "master". We have existing registration software and dozens of apps that authenticate through it.

What I'm after is a way to have vBulletin at least check our main user database before allowing a login to vBulletin, to ensure the user is already validated and exists in our registration software. They have already gone through the registration process and we would prefer not to make them register a second time to participate in the vBulletin Forums.

We don't need the Register process from vBulletin at all, nor do we want it.

If that makes any sense... ;-)

gtfreymann 03-06-2013 01:26 PM

I did have a look through this thread:

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

I preferred the class.forumops.php setup.

We just purchased VB v5 and these two includes don't seem to exist:

require_once($_SERVER['DOCUMENT_ROOT'] . '/forum/core/includes/class_dm.php'); // for class_dm_user.php
require_once($_SERVER['DOCUMENT_ROOT'] . '/forum/core/includes/class_dm_user.php'); // for user functions

Any ideas how to manage user records (add/edit/delete) in a script that can be called outside of the actual running VB system?

gtfreymann 03-08-2013 07:04 PM

I used the first example as the class wasn't working and using VB 5 I am able to add a new user from outside VB.

To update the user I am just accessing the 'user' table directly.

Couldn't be any simpler.

If anybody else is having issues trying to add a new user to VB from outside PM me and I can send you a copy of my scripts.

fungku 03-16-2013 03:34 AM

Interesting... So how do you manage logins/sessions?

If someone is logged into your site, and then goes to VB are they still considered logged in there as well?

gtfreymann 03-16-2013 11:53 AM

Quote:

Originally Posted by fungku (Post 2410284)
Interesting... So how do you manage logins/sessions?

If someone is logged into your site, and then goes to VB are they still considered logged in there as well?

No, they have to log into VB separately... that wasn't an issue for us.

fungku 03-20-2013 07:46 AM

Okay, I PM'd you.

I'd like to try this out extending my framework's user auth to do this.

I think I want to share cookies as well, though.

frankgeraci 04-05-2013 11:33 PM

I am also pretty interested in this. I initially saw the vbsso plugin, but it will not work with vb 5. I also have a site that handles registration and would like users to automatically have a forum account.

gtfreymann 04-06-2013 12:54 AM

Quote:

Originally Posted by frankgeraci (Post 2414598)
I am also pretty interested in this. I initially saw the vbsso plugin, but it will not work with vb 5. I also have a site that handles registration and would like users to automatically have a forum account.

I never heard back from that other fellow after I emailed him my scripts but like my message says. Pm me with your email address and I'll send you what I have.

fungku 04-06-2013 05:10 PM

thanks for the scripts. they are good. however, i haven't had time to set up my forum yet and now I'm thinking of waiting for fluxxBB 2.0 or making my own. disappointed with the direction of VB lately since vb5 came out and started thinking maybe the earlier I jump off the sinking ship the better. :P

nathan-mahdavi 04-12-2013 01:21 PM

This is a working script (tested on VB 5.0.1) that will create a random user and then log them in using their ID. If you already know a users ID then you can just log them in using the log_user_in function.

PHP Code:

<?php

chdir
("forum/core/"); // change to your core folder location
require_once("global.php");

function 
create_random_user(){
    
$dataman =& datamanager_init('User'$vbulletin);  
    
$dataman->set('username'"user".rand());
    
$dataman->set('email'rand()."@domain.com");
    
$dataman->set('password'"leighf");
    return 
$dataman->save();
}

function 
log_user_in($userid){
    
$user fetch_userinfo($userid);
    
$auth vB_User::verifyAuthentication($user['username'], "leighf"$user['password'], $user['password']);
    
$res vB_User::processNewLogin($auth);
    
vbsetcookie('userid'$res['userid']); 
    
vbsetcookie('password'$res['password']);
    
vbsetcookie('sessionhash'$res['sessionhash']);
}

// create random user
$userid create_random_user();

// log them in
log_user_in($userid);

It's a script in its simplest of states. The usernames password is hardcoded but assuming you know what's going on in the above snippet, you'll be fine adding this yourself.


All times are GMT. The time now is 08:50 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.02803 seconds
  • Memory Usage 1,754KB
  • 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
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (13)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