I'm transferring users from my old database to a vBulletin database.
I want a script to do this as it'll take forever otherwise.
I have all the user's passwords stored just like md5(password)
But of course, this doesn't work with vBulletin due to salts etc.
So my code is this:
<?Php
mydatabase_connect();
$select=mysql_query("SELECT * from `users`");
while($user=mysql_fetch_array($select)) {
forum_connect();
$check=mysql_query("SELECT * from `user` where `username` = '{$user[username]}'");
if(mysql_num_rows($check)>="1") {
echo "fail";
}else{
$insert=mysql_query("INSERT into `user` SET `username` = '{$user[username]}', `password` = '{$user[password]}', `email` = '{$user[email]}'");
if($insert) {
echo 'success';
}else{
echo 'fail';
}
}
mydatabase_connect();
}
?>
How would I change it to work with vBulletin - so I can set a vBulletin user.password
field and vBulletin user.salt
correctly. Bearing in mind that my $user[password] or users
.password
is stored as an md5 hash of their real, text password.
Thanks!
I don't know if this answer is too late, but you should be able to automatically transfer your passwords into vBulletin.
vBulletin generates its hashes this way:
$hash = md5(md5($plaintext) . $salt);
So, to transfer the users over, do roughly the following:
$salt = /* generate salt */;
$vb_hash = md5($your_old_hash . $salt);
To make it easy on yourself, use vBulletin's salt generation method. It's in the vB_DataManager_User class.