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

Reply
 
Thread Tools Display Modes
  #1  
Old 01-02-2005, 12:33 AM
dave conz dave conz is offline
 
Join Date: Dec 2004
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Importing encrypted passwords

I need to import a database of usernames and passwords into a new vB installation. The passwords are encrypted using perl like so:
$encryptedpassword = crypt($password,"aa");

I would like to hack vB to recognize either the standard vB password or the imported (encrypted) passwords. I'm thinking that users with the old style password will be able to update their passwords as normal, and the old password will be replaced by a vB-format one.

Will this work? If so, could someone give me some pointers on where to start? Thanks.
Reply With Quote
  #2  
Old 01-02-2005, 12:38 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by dave conz
I need to import a database of usernames and passwords into a new vB installation. The passwords are encrypted using perl like so:
$encryptedpassword = crypt($password,"aa");

I would like to hack vB to recognize either the standard vB password or the imported (encrypted) passwords. I'm thinking that users with the old style password will be able to update their passwords as normal, and the old password will be replaced by a vB-format one.

Will this work? If so, could someone give me some pointers on where to start? Thanks.
Are you importing from another forum system?
Reply With Quote
  #3  
Old 01-02-2005, 12:56 AM
dave conz dave conz is offline
 
Join Date: Dec 2004
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sort of - I'm migrating from WebBBS. I'm not going to import the existing messages but I do need to import the usernames and passwords. The complication is that I've been using my own custom MySQL database to manage my WebBBS users, since the WebBBS username/password system is useless.

So the passwords are encrypted using the same format as WebBBS but stored in a different way (MySQL as opposed to WebBBS profiles). I don't believe there's any way to directly import the passwords into the standard vB format. Actually I don't even know how vB formats passwords yet - I haven't got that far.
Reply With Quote
  #4  
Old 01-04-2005, 08:24 AM
dave conz dave conz is offline
 
Join Date: Dec 2004
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please, can anyone help? All I want to know is where to find the code which says "If the password entered in the form equals the password in the database..." so I can add "...OR if it equals the old encrypted version".

If I can just get some guidance on where to start I'm happy to try and figure out the rest.
Reply With Quote
  #5  
Old 01-04-2005, 08:50 AM
rake's Avatar
rake rake is offline
 
Join Date: Nov 2002
Posts: 311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

login.php is the file you need to look at. But if i were you, i'd have the users reset their passwords, or i'd make a script to autogenerate new passwords and mail them.
Reply With Quote
  #6  
Old 01-04-2005, 06:40 PM
dave conz dave conz is offline
 
Join Date: Dec 2004
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks rake. Unfortunately a huge number of our users don't have email addies in the database, and can't add them. It's a long story - I never quite finished writing my user management script for WebBBS when I gave up on it altogether. Now I'm stuck in a horrible no-mans land, with a password/email catch-22.

Anyway, if the only file I need to look at is login.php, I'll have a look and see what I can figure out. Thanks again.
Reply With Quote
  #7  
Old 01-04-2005, 08:13 PM
rake's Avatar
rake rake is offline
 
Join Date: Nov 2002
Posts: 311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

actually, you need to look at the includes/functions_login.php file, very last function in the file. Add your code there.
Reply With Quote
  #8  
Old 01-04-2005, 09:17 PM
dave conz dave conz is offline
 
Join Date: Dec 2004
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah, I see it. So I believe I need to do something like:
Code:
if (
	$bbuserinfo['password'] != iif($password AND !$md5password, md5(md5($password) . $bbuserinfo['salt']), '') AND
	$bbuserinfo['password'] != md5($md5password . $bbuserinfo['salt']) AND
	$bbuserinfo['password'] != iif($md5password_utf, md5($md5password_utf . $bbuserinfo['salt']), '')
	// Add a line here:
	// AND $bbuserinfo['password'] != (this bit I haven't figured out yet)
	)
{
	return false;
}
... where I have to figure out how to check for the old perl crypt($password,"aa") password. If anyone would like to tell me what I should put in that line, I promise to be your best friend. Otherwise I'm off to learn how PHP deals with encryption.
Reply With Quote
  #9  
Old 01-04-2005, 09:47 PM
rake's Avatar
rake rake is offline
 
Join Date: Nov 2002
Posts: 311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

AND $bbuserinfo['password'] != crypt($password,"aa")

that would be it... check the php manual for the crypt function. aa is your salt, right?
Reply With Quote
  #10  
Old 01-04-2005, 10:29 PM
dave conz dave conz is offline
 
Join Date: Dec 2004
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Dammit, that simple!? For some reson I thought PHP handled it differently. As you can see, I'm a PHP newbie. I've got to go away for a while now but I'll try this as soon as I get back. Thanks heaps for your help rake.
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 07:00 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.04214 seconds
  • Memory Usage 2,245KB
  • Queries Executed 11 (?)
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_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete