News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

How to Transfer Password into Smf !

Started by Demirsoy, January 31, 2012, 08:57:10 PM

Previous topic - Next topic

Demirsoy

First of all , I would like to say Hello to everyone who is going to help me :)

My problem is different than the usual since It is not actually related with SMF's codes but my project codes.


I have game server which works with SMF, I mean , when new user apply registration , it is also done on my game server by using MYSQL relationship.

The thing that I would like to solve is actually nothing than transferring password from my game server to SMF  when password is updated.


For example, for the old smf forums which depends only on md5 password system made no problem with my game server since I used

DB.EXECUTE "UPDATE smf_members SET passwd=md5('<local.password>') WHERE member_name='<local.membername>'" in my game codes of course and it replace password from my game server database to smf's and there was no problem and they worked together properly.

But when I update my SMF forum into 2.0.2, there is i think new password system using SHA1 or something like I actually dont know.

From that point, I am using the same logic and apply ( DB.EXECUTE "UPDATE smf_members SET passwd=sha1('<local.password>') WHERE member_name='<local.membername>'" ).

As you may see, the thing changed is just SHA1 rather than MD5, but it does not work since I know the password system does not work like that way.

Is there anyone who can help me in order to send my password from my game database to SMF database.

In short, I could not unstand password algorithm.If there is one who knows algorithm of this password system please help me , I'll be very pleased.

Thanks in advance.

dataspiller

From what I can see, you are close. It appears you need to include the forum member's username into the mix, like so:


$userpassword = sha1(strtolower($user) . $password);




That is what I am getting from digging through ManageMembers.php and Subs-Auth.php - specifically Subs-Auth.php in the function resetPassword (around line 583).


Dataspiller

Oldiesmann

I posted the solution in his other topic regarding this yesterday.

For future reference, I'll post it here as well. The MySQL equivalent of that is this:
SHA1(CONCAT(LOWER('username'), 'password'))
Michael Eshom
Christian Metal Fans

Advertisement: