Advertisement:

Author Topic: How to Transfer Password into Smf !  (Read 985 times)

Offline Demirsoy

  • Newbie
  • *
  • Posts: 3
How to Transfer Password into Smf !
« on: January 31, 2012, 08:57:10 PM »
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

Code: [Select]
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
Code: [Select]
( 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.
« Last Edit: January 31, 2012, 09:10:54 PM by Demirsoy »

Offline dataspiller

  • Semi-Newbie
  • *
  • Posts: 18
Re: How to Transfer Password into Smf !
« Reply #1 on: February 02, 2012, 11:02:36 AM »
From what I can see, you are close. It appears you need to include the forum member's username into the mix, like so:

Code: [Select]
$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

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,872
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: How to Transfer Password into Smf !
« Reply #2 on: February 02, 2012, 02:47:59 PM »
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:
Code: [Select]
SHA1(CONCAT(LOWER('username'), 'password'))
Michael Eshom
Cincy Space - now open!