Encryption 密码加密以使用phpbb3密码

Encryption 密码加密以使用phpbb3密码,encryption,passwords,phpbb3,Encryption,Passwords,Phpbb3,我有一个问题,如何从我的站点加密密码以使用phpbb3密码?这将允许您设置基本用户 define('IN_PHPBB', true); global $db; global $config; global $user; global $auth; global $cache; global $template; global $phpbb_root_path; global $phpEx; include('forums/common.php'); // THIS NEEDS TO BE

我有一个问题,如何从我的站点加密密码以使用phpbb3密码?

这将允许您设置基本用户

define('IN_PHPBB', true);
global $db;
global $config;
global $user;
global $auth;
global $cache;
global $template;

global $phpbb_root_path;
global $phpEx;

include('forums/common.php');   // THIS NEEDS TO BE CHANGED TO MATCH YOUR PHPBB3 INSTALL LOCATION;
                                // Currently, I am assuming you have this page at the root of your domain
                                // and PHPBB3 is install in the 'forums' subdirectory

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

require($phpbb_root_path .'includes/functions_user.php');

$username = $_POST['user'];
$password = $_POST['password'];     // Do not encrypt this password, it is handled later by an MD5 function and PHPBB3's own code
$email = $_POST['email'];

// You should add in a check to verify that the username is unique to your PHPBB3 install, otherwise you'll get errors
// I left this as an exercise for you so that you can handle it how you want (reload the page, fail completely, offer suggestions, etc)

$user_row = array(
    'username' => $username,
    'user_password' => md5($password), 'user_email' => $email,
    'group_id' => 2,                    // This is the 'Registered Users' group. Change this as you feel is appropriate
    'user_timezone' => '0.00',          // GMT
    'user_dst' => 0,                    // No Day Light Saving
    'user_lang' => 'en',
    'user_type' => '0',                 // This means 'Normal User'
    'user_actkey' => '',
    'user_dateformat' => 'd M Y H:i',
    'user_style' => 1,
    'user_regdate' => time(),
);

$id = user_add($user_row);              // Returns the ID of the new user
假设:

  • 此文件位于域的根目录中,论坛位于
    论坛
    子目录中。如果不是这样的话,我添加了注释以显示需要更改的内容
  • 没有对重复的用户名执行错误检查。假设您有一个方法来处理此问题,或者可以适当地修改此脚本

PHPBB3在创建用户时使用
salt
。这意味着具有相同密码的用户具有不同的哈希值。您是否能够使用上述代码中的新用户使用“123456789”登录您的论坛?