Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 04 May 2008, 18:00
Siraris Siraris is offline
 
Join Date: May 2008
How does VBulletin hash its passwords?

I am curious how Vbulletin gets its password (is it through MD5 with salt?). The reason I am asking is, I want to have it so that when someone registers on my main site, I insert the account into the vbulletin user table as well, so that they don't have to register twice on my site and the forum as well. I inserted a straight record, and copied the MD5 hash as the PW, but when I entered the PW on vbulletin, it didn't login (even though it did on my main site).

Is this something very difficult to do, and can anyone help me with the process?

Also, so I don't have to post a second thread, how does it do the date in the user table? Under join date, I see this number: 1209845112 which makes no sense to me as to what it represents. I'd like to insert the correct date that they joined as well, and not have to just insert some wacky number each time
Reply With Quote
  #2  
Old 04 May 2008, 18:06
nothing4me nothing4me is offline
 
Join Date: Oct 2007
$hash=MD5(MD5($password)+$salt)
Reply With Quote
  #3  
Old 04 May 2008, 18:08
Siraris Siraris is offline
 
Join Date: May 2008
Originally Posted by nothing4me View Post
$hash=MD5(MD5($password)+$salt)
Thanks for the quick response. Where do I find out what the salt is?

I just tried updating the pw in the db with $hash = md5(md5($pw) + $salt); and I output the hash at the end, and it says 1454ca2270599546dfcd2a3700e4d2f1 but when I look in the DB it says: a3ddf69cbd7d58651119fb5265774ebb...

Last edited by Siraris : 04 May 2008 at 18:23.
Reply With Quote
  #4  
Old 04 May 2008, 19:32
cheesegrits's Avatar
cheesegrits cheesegrits is offline
 
Join Date: May 2006
If you want the currently logged in users salt, that's in $vbulletin->userinfo['salt'].

If you need the salt for some other user, assuming your target user ID is in $userid, this should grab it for you:

$my_userinfo = verify_id('user', $userid, 1, 1);

It'll then be in $my_userinfo['salt'].

-- hugh

--------------- Added 04 May 2008 at 20:20 ---------------

I just reread your post, realized you are creating new users, so my response above doesn't help much.

Are you using the user datamanager, or trying to do it by steam yourself?

You might want to take a look at the code for 'addmember' in register.php, which shows how to use the datamanager to do this stuff.

If you still want to do it by steam, for a new user you just need to generate a 3 character salt randomly ...


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

The date you asked about is a simple UNIX style "seconds since epoch", as per:

http://www.php.net/time

-- hugh
__________________
Hugh Messenger
Itinerant PHP Mechanic and vB Therapist
Will Work for Food or PayPal

Last edited by cheesegrits : 04 May 2008 at 20:20. Reason: Auto-Merged DoublePost
Reply With Quote
  #5  
Old 04 May 2008, 22:06
ssslippy's Avatar
ssslippy ssslippy is offline
 
Join Date: Jan 2006
Why dont u just redirect the user to the vbulletin register page? This would be 200x easier.
__________________
Immortal Guild - My Guilds Website
Reply With Quote
  #6  
Old 04 May 2008, 22:11
cheesegrits's Avatar
cheesegrits cheesegrits is offline
 
Join Date: May 2006
Like it says in the original post ... "so that they don't have to register twice on my site and the forum as well".

It's not hard doing the initial registration automatically. The hard part is keeping the two accounts syncronized when the user starts changing passwords, but that's another story!

-- hugh
__________________
Hugh Messenger
Itinerant PHP Mechanic and vB Therapist
Will Work for Food or PayPal
Reply With Quote
  #7  
Old 04 May 2008, 22:14
ssslippy's Avatar
ssslippy ssslippy is offline
 
Join Date: Jan 2006
Then intergrating the front page system he is using to the forum system would be easier and more effecient.
__________________
Immortal Guild - My Guilds Website
Reply With Quote
  #8  
Old 04 May 2008, 22:25
cheesegrits's Avatar
cheesegrits cheesegrits is offline
 
Join Date: May 2006
Erm ... that's what he's trying to do ... and unless he's using something like Joomla for which commercial bridges for vB exist, he doesn't have much choice but to roll his own.

-- hugh
__________________
Hugh Messenger
Itinerant PHP Mechanic and vB Therapist
Will Work for Food or PayPal
Reply With Quote
  #9  
Old 04 May 2008, 22:26
ssslippy's Avatar
ssslippy ssslippy is offline
 
Join Date: Jan 2006
Then he is doing it the wrong way, he should just be using the vbulletin cookie system. Duplicating information back and forth across 2 database's can be a very nasty thing and cause alot of issues.

What happens if someone registers in his forums? It wont work on the main page?
__________________
Immortal Guild - My Guilds Website
Reply With Quote
  #10  
Old 05 May 2008, 00:04
Siraris Siraris is offline
 
Join Date: May 2008
OK, after doing a lot of thinking, I definitely need to integrate the two, let me post my thoughts and maybe someone can help me sort them out and tell me the right direction to go. This is my first time ever using VBulletin as an admin, and it's a bit overwhelming. I hope my post here makes sense, I'm a big discombobulated.

I have a user register on my site, I collect the Username, pass, zipcode, gender, birthday, and that's it. I can then insert that data into the VBulletin forum.user table - although for some reason, I think I am still doing the PW generation incorrectly (I still can't find the salt that VBulletin uses to generate the password, and in the DB it has something like *4e for when I registered) - and insert it into my tblUser database as well.

Is this stupid? Should I just use the VBulletin user database? If I do that, can I just add on my own columns on there, and then replace any reference to my tblUser in my code to the vbulletins user db?

If I do that, and just use the vbulletin user DB, then everything is solved. If a user changes his PW, it is reflected on both my site and the forum without any messing around.

The thing I'm most worried about is messing with VBulletins code and breaking everything, since I don't know how exactly their system is designed, and I am much better at working with code I wrote than other peoples code.

Anyways, if I don't just move all my data over to their DB, and continue to use mine and theirs, it could turn out to be a nightmare, at least in my thinking.

The only other issue there is, when they login on the main site, they will need to be logging in to the messageboard, correct? At that point, it will create the necessary cookies for Vbulletin, and I can also reflect it in my session variables in my login script. Can I have it so that it logs in with my user forum, posts to the message board, logs in, and redirects back to my front page?

If so, that should be everything. Taking into that I am thinking about this as me putting all my data into the VBulletin user table, and using that for both sections, any change of a PW will reflect on both sites, it will register on my site, it will login through VBulletin, create all the necessary cookie data for vbulletin, then go back to my site where I will use the userID in the VBulletin cookie to get the data I need from my site, and complete the login.

Please help!
Reply With Quote
  #11  
Old 05 May 2008, 00:21
King Kovifor's Avatar
King Kovifor King Kovifor is offline
 
Join Date: Nov 2004
Real name: Jeremy
Probably the most efficient and easiest way in the long run would to create your site based around vBulletin code. Using their user system (if you redirect your "register.php" to vBulletin's, it will handle most of that) you could easily have cookies log you in to both places. Also, you can use "Custom Profile Fields" for certain data and import them into those (I forget how they are stored tho...)
__________________
Do not request support through any other means except the forums.

Useful Post With Links on Learning How To Develop vBulletin Plugins

Latest Modification: Stop Forum Spam Integration
Reply With Quote
  #12  
Old 05 May 2008, 18:56
cheesegrits's Avatar
cheesegrits cheesegrits is offline
 
Join Date: May 2006
Originally Posted by ssslippy View Post
Then he is doing it the wrong way, he should just be using the vbulletin cookie system. Duplicating information back and forth across 2 database's can be a very nasty thing and cause alot of issues.

What happens if someone registers in his forums? It wont work on the main page?
Absolutely no argument here. We just have different approaches. Rather than starting out saying "that's the wrong way", I tend to answer the question being asked, then start pointing out that there might be a different and better approach.

Obviously the best approach is as you suggested. Use the usual mechanisms for including vB in external apps, and drive the portal site off of vB's authentication and registration.

-- hugh
__________________
Hugh Messenger
Itinerant PHP Mechanic and vB Therapist
Will Work for Food or PayPal
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 22:19.

Layout Options | Width: Wide Color: