SMF Support > Converting to SMF

Elarkte Password support for SMF 2.0

(1/5) > >>

vbgamer45:
Here is a script to use Elkarte 1.1x passwords in SMF 2.0.x

Open Sources/LogInOut.php

Find

--- Code: ---elseif (strlen($user_settings['passwd']) == 40)
{
// Maybe they are using a hash from before the password fix.
$other_passwords[] = sha1(strtolower($user_settings['member_name']) . un_htmlspecialchars($_POST['passwrd']));

// BurningBoard3 style of hashing.
$other_passwords[] = sha1($user_settings['password_salt'] . sha1($user_settings['password_salt'] . sha1($_POST['passwrd'])));

// Perhaps we converted to UTF-8 and have a valid password being hashed differently.
if ($context['character_set'] == 'UTF-8' && !empty($modSettings['previousCharacterSet']) && $modSettings['previousCharacterSet'] != 'utf8')
{
// Try iconv first, for no particular reason.
if (function_exists('iconv'))
$other_passwords['iconv'] = sha1(strtolower(iconv('UTF-8', $modSettings['previousCharacterSet'], $user_settings['member_name'])) . un_htmlspecialchars(iconv('UTF-8', $modSettings['previousCharacterSet'], $_POST['passwrd'])));

// Say it aint so, iconv failed!
if (empty($other_passwords['iconv']) && function_exists('mb_convert_encoding'))
$other_passwords[] = sha1(strtolower(mb_convert_encoding($user_settings['member_name'], 'UTF-8', $modSettings['previousCharacterSet'])) . un_htmlspecialchars(mb_convert_encoding($_POST['passwrd'], 'UTF-8', $modSettings['previousCharacterSet'])));
}
}

--- End code ---
Add after

--- Code: --- elseif (strlen($user_settings['passwd']) == 60)
{
$other_passwords[] = validateLoginPasswordElkarte($_POST['passwrd'], $user_settings['passwd'],$user_settings['member_name']);

}

--- End code ---

Find at the end of the and add before ?>

--- Code: ---function validateLoginPasswordElkarte(&$password, $hash, $user = '', $returnhash = false)
{
    global $smcFunc, $sourcedir;

// Our hashing controller
require_once($sourcedir . '/PasswordHash.php');

// Base-2 logarithm of the iteration count used for password stretching, the
// higher the number the more secure and CPU time consuming
$hash_cost_log2 = 10;

// Do we require the hashes to be portable to older systems (less secure)?
$hash_portable = false;

// Get an instance of the hasher
$hasher = new PasswordHash($hash_cost_log2, $hash_portable);

// If the password is not 64 characters, lets make it a (SHA-256)
if (strlen($password) !== 64)
$password = hash('sha256', $smcFunc['strtolower']($user) . un_htmlspecialchars($password));

// They need a password hash, something to save in the db?
if ($returnhash)
{
$passhash = $hasher->HashPassword($password);

// Something is not right, we can not generate a valid hash that's <20 characters
if (strlen($passhash) < 20)
$passhash = false;
}
// Or doing a password check?
else
$passhash = (bool) $hasher->CheckPassword($password, $hash);

unset($hasher);

return $passhash;
}


--- End code ---


Then Copy attached PasswordHash.php to the Sources folder

gevv:
Hello,

Is there a converter from elkarte 1.1.6 to smf?

vbgamer45:
I did one for openimporter https://github.com/OpenImporter/openimporter/pull/105/commits

Attached you can use it to convert.

gevv:
Thanks  @vbgamer45

I tried it gave an error in the member groups.

Importing settings... ✔
Importing members... ✔
Importing categories... ✔
Importing boards... ✔
Importing topics... ✔
Importing messages... ✔
Importing polls... ✔
Importing poll choices... ✔
Importing poll votes... ✔
Importing personal messages... ✔
Importing pm recipients... ✔
Importing pm rules... ✔
Importing board moderators... ✔
Importing mark read data (boards)... ✔
Importing mark read data (topics)... ✔
Importing mark read data... ✔
Importing notifications... ✔
Importing membergroups...
Unsuccessful!
This query:

    REPLACE INTO `smf`.smf_membergroups
    (id_group, group_name, description, online_color, min_posts, max_messages, stars, group_type, hidden, id_parent)
    VALUES ('1', 'Yönetici', '', '#E1332D', '-1', '0', '5#iconadmin.png', '0', '0', '-2'),
    ('2', 'Genel Moderatör', '', '#0000FF', '-1', '0', '5#icongmod.png', '0', '0', '-2'),
    ('3', 'Moderatör', '', '', '-1', '0', '5#iconmod.png', '0', '0', '-2'),
    ('4', 'Yeni Üye', '', '', '0', '0', '1#icon.png', '0', '0', '-2'),
    ('5', 'Üye', '', '', '6', '0', '2#icon.png', '0', '0', '-2'),
    ('6', 'Tam Üye', '', '', '100', '0', '3#icon.png', '0', '0', '-2'),
    ('7', 'Kıdemli Üye', '', '', '250', '0', '4#icon.png', '0', '0', '-2'),
    ('8', 'Kahraman Üye', '', '', '500', '0', '5#icon.png', '0', '0', '-2');

Caused the error:

    Unknown column 'stars' in 'field list'

Line: 117
File: C:\wamp64\www\op\OpenImporter\Database.php

Unsuccessful!
This query:

    REPLACE INTO `smf`.smf_membergroups
    (id_group, group_name, description, online_color, min_posts, max_messages, stars, group_type, hidden, id_parent)
    VALUES ('1', 'Yönetici', '', '#E1332D', '-1', '0', '5#iconadmin.png', '0', '0', '-2'),
    ('2', 'Genel Moderatör', '', '#0000FF', '-1', '0', '5#icongmod.png', '0', '0', '-2'),
    ('3', 'Moderatör', '', '', '-1', '0', '5#iconmod.png', '0', '0', '-2'),
    ('4', 'Yeni Üye', '', '', '0', '0', '1#icon.png', '0', '0', '-2'),
    ('5', 'Üye', '', '', '6', '0', '2#icon.png', '0', '0', '-2'),
    ('6', 'Tam Üye', '', '', '100', '0', '3#icon.png', '0', '0', '-2'),
    ('7', 'Kıdemli Üye', '', '', '250', '0', '4#icon.png', '0', '0', '-2'),
    ('8', 'Kahraman Üye', '', '', '500', '0', '5#icon.png', '0', '0', '-2');

Caused the error:

    Unknown column 'stars' in 'field list'

vbgamer45:
Your smf membergroups table is missing the stars column for some reason... Add it to the table

Navigation

[0] Message Index

[#] Next page

Go to full version