PDA

View Full Version : User Database integration


*****Sniper
05-17-2004, 09:26 AM
I dont have to integrate the software, I just have to be able to allow the users in another database to access VB3. This is because there are over 2M users in the Database and cannot be migrated over to the VB3 database.

What I think I have to do is edit the login page so it takes the userid, username & password from the other database. Following is the SQL that does so.

$sql = "SELECT id, username, password FROM anagrafica WHERE username='".addslashes(htmlspecialchars_uni($username))."'";
Also that DB is Oracle, not mysql.

problems: Password is plain text, not md5 encrypted. No "salt" field. different identifying names (eg. $bbuserinfo['id'] and not $bbuserinfo['userid'])
can anybody point me in the right direction?

I've started looking at the login.php file but am not sure what to modify?!?!

*****Sniper
05-17-2004, 12:25 PM
ok, maybe i'm asking too much....
ok, then can someone explain to me what line 156 of login.php does:

if ($bbuserinfo['password'] != iif($password AND !$md5password, md5(md5($password) . $bbuserinfo['salt']), '') AND $bbuserinfo['password'] != md5($md5password . $bbuserinfo['salt']))

it comes ust after the query that retrieves userid and password etc given a username.

Brad
05-17-2004, 02:54 PM
In includes/functions.php look for this:

// ###################### Start getuserinfo #######################
// set $option to load other relevant information
function fetch_userinfo(&$userid, $option = 0)

This is the function that builds $bbuserinfo, it is called like this in /includes/session.php

$bbuserinfo = fetch_userinfo($_COOKIE[COOKIE_PREFIX . 'userid'], iif(defined('IN_CONTROL_PANEL'), 16));

There are many calls over alot of files to the fetch_userinfo function, for the most part it will handle most of the work once you adapt it to your other user database. There will probbly be more work to be done but this is a good starting point.

*****Sniper
05-17-2004, 03:13 PM
so I should start from functions.php and altering the fetch_userinfo()

I have been changing login.php, line

if ($bbuserinfo = $DB_site->query_first("SELECT userid, usergroupid, membergroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '" . addslashes(htmlspecialchars_uni($username)) . "'"))
{

I do have to change this as well correct? even after changing the fetch_userinfo() function!?
if
one last thing... what is "iif" its not in any php manual! is it "if and only if"??

Brad
05-17-2004, 03:17 PM
so I should start from functions.php and altering the fetch_userinfo()

I have been changing login.php, line

if ($bbuserinfo = $DB_site->query_first("SELECT userid, usergroupid, membergroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '" . addslashes(htmlspecialchars_uni($username)) . "'"))
{

I do have to change this as well correct? even after changing the fetch_userinfo() function!?
if
one last thing... what is "iif" its not in any php manual! is it "if and only if"??
Yes you would have to change that line aswell.

iif basicly allows you to do a if on one line, think of it like this:

iif($var, "$var is true")

would be:


if($var)
{
echo("$var is true");
}

meowmeow
05-18-2004, 11:33 AM
that was very helpful, thanks. now I have a place to start.

(oh, yeah, I had to change name cuz i forgot the other password! so now I have two subscriptions. is there a way to fuse them together, or can the admin only do that?)

now just to have things clear.

$user= $DB_site->query_first("...");

this is where it gathers all the info from the database. so here I would have to change it to retrieve data from my other database.

but the query ends with
WHERE user.userid = $userid
the $userid variable, is that taken from the login input or the cookies?

last thing!! The admins and the moderators are not in the old database, they are in VB3's DB. So i want to do this

IF($userid is in the VB3 database) {do the query thats already there.}
else {query the other database.}

I tried doing this
if($userid == $DB_site->query_test("SELECT userid FROM user WHERE userid = ".$userid))
do originalQuery


and it logs in fine, is redirected, then when forum shows up its all backwards and the buttons are gone, I have no idea whats causing this!

Velocd
05-18-2004, 01:34 PM
*****Sniper,

You are currently showing up as unlicensed. To be able to download hacks and/or receive support here at vBulletin.org, we ask you to please click here (http://www.vbulletin.com/members/membersupport_priority.php) (vB-germany users click here (http://www.vbulletin-germany.com/members/forums.php)) and enter your email address, to show us that you are licensed.

You will need to use your customer number and password (which will be in the email you got when you paid for your license) to access that page. Please note that your email is case sensitive.

Thank you.

meowmeow
05-18-2004, 01:48 PM
yeah but pussySniper (surely that should be *****sniper) has forgotten his password (is username case-sensitive?) and when i do the "forgotten your password" post with my email, I don't get one! i've done 3 times today, still nothing. so I registered again as a different user!

meowmeow
05-19-2004, 10:08 AM
I'm trying to modify vb3 so that it will get the users (not the moderators) from another database.

so i'm trying to understand the relations between login.php, sessions.php and functions.php

which and where i have to modify it. I've been told I have to modify the fetch_userinfo() function.

but i cant tell where the cookies are set. where bbuserinfo is set.. i'm completely lost and in desperate need of some direction.