Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. To jest ta instrukcja :)
  2.  
  3.  
  4. ##############################################################
  5. ## MOD Title: Allow login for smf users
  6. ## MOD Author: Dicky < dicky@askmaggymae.com >
  7. ## MOD Description: Allows converted smf users to log in to the new phpBB board with their smf passwords
  8. ## MOD Version: 1.0.2
  9. ## MOD date: Jan 31, 2007
  10. ##
  11. ## Installation Level: easy
  12. ## Installation Time: 3 Minutes
  13. ## Files To Edit: (1) login.php
  14. ## Included Files: n/a
  15. ##############################################################
  16. ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
  17. ##############################################################
  18. #
  19. #-----[ OPEN ]------------------------------------------
  20. #
  21. login.php
  22. #
  23. #-----[ FIND ]------------------------------------------
  24. # Line 86
  25. {
  26. message_die(GENERAL_MESSAGE, sprintf($lang['Login_attempts_exceeded'], $board_config['max_login_attempts'], $board_config['login_reset_time']));
  27. }
  28. #
  29. #-----[ AFTER, ADD ]------------------------------------
  30. #
  31. // check if this is a converted user
  32. // handles smf user passwords
  33. if( md5($password) !== $row['user_password'] && $row['user_active'] )
  34. {
  35. if (( $row['user_password'] == substr( sha1(strtolower($username) . $password), 0, 32)) || ( $row['user_password'] == md5_hmac($password, strtolower($username))))
  36. {
  37. // this is a converted user. Now make them a phpBB user!
  38. // take the subbed pass and put a md5 encryption on it and insert it into the database
  39. $sql = "UPDATE " . USERS_TABLE . " SET user_password = '" . md5( $HTTP_POST_VARS['password'] ) . "' WHERE user_id = '" . $row['user_id'] . "'";
  40. if( !$db->sql_query($sql) )
  41. {
  42. message_die(GENERAL_ERROR, 'Password Error:<br />Please contact the board administrator immediately.', '', __LINE__, __FILE__, $sql);
  43. }
  44. // reset $row[user_password]
  45. $sql = "SELECT user_id, username, user_password, user_active, user_level FROM " . USERS_TABLE . "
  46. WHERE username = '" . str_replace("\\'", "''", $username) . "'";
  47.  
  48. if ( !($result = $db->sql_query($sql)) )
  49. {
  50. message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__, __FILE__, $sql);
  51. }
  52. $row = $db->sql_fetchrow($result);
  53. }
  54. }
  55. #
  56. #-----[ FIND ]------------------------------------------
  57. # At end of file
  58. ?>
  59. #
  60. #-----[ BEFORE, ADD ]------------------------------------
  61. #
  62. // encrypts password for smf users
  63. function md5_hmac($data, $key)
  64. {
  65. $key = str_pad(strlen($key) <= 64 ? $key : pack('H*', md5($key)), 64, chr(0x00));
  66. return md5(($key ^ str_repeat(chr(0x5c), 64)) . pack('H*', md5(($key ^ str_repeat(chr(0x36), 64)). $data)));
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement