MyBB Community Forums

Full Version: How to modify loginconvert.php to use it with joomla password
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everybody,
I'm working on a kunena 1.6 to Mybb 1.6.3 merge system, but i'm not such a good coder.
I hope someone here can help me extending loginconvert.php plugin in order to use it also with joomla passwords.
This is a little piece of code illustrating how joomla passwords (kunena uses joomla passwords) are generated:

//--your unencrypted password goes here-->
$password = 'mypassword';
//generate salt----------------------------------->
   for ($i=0; $i<=32; $i++) {
      $d=rand(1,30)%2;
      $salt .= $d ? chr(rand(65,90)) : chr(rand(48,57));
   } 
//end generate salt--------------------------------|

//hash password with salt-->
$hashed = md5($password . $salt);

//here is your new encrypted password, ready to store in the database table,  `jos_users`
$encrypted = $hashed . ':' . $salt;

//So now if you "UPDATE `#__users` SET `password`='$encrypted' WHERE `email`='$email';"
//You can change your password..

Any suggestions? Thanks a lot in advanceShy