本文介绍了Wordpress MD5密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过PHP脚本或MySQL将用户插入到Wordpress博客中,并且我有一个纯文本密码。我以为我可以这样做:

I need to insert users into a Wordpress blog via a PHP script or MySQL, and I have a plain text password. I thought I could do something like this:

$query = "INSERT INTO $new_db.wp_users (user_login, user_pass, user_nicename)
select user_email, md5(user_password), user_name from $source_db.users";

但密码与Wordpress密码现在看起来不一样。所有密码都以 $ P $ B开始

But the passwords all look different from what the Wordpress passwords look like now. All the passwords all start with $P$B

从阅读中可以看到有盐...是有一种方法可以使用test123这样的密码,并将其转换成Wordpress希望的加密密码?

From reading it says there is a salt... is there a way to take a password like test123 and turn it into the encrypted password that Wordpress expects?

推荐答案

最明智的解决方案只需使用相关的WordPress功能()。

The most sensible solution would simply be to use the relevant WordPress function (wp_generate_password) itself.

但是,如果这不是一个选项,您可以简单地提取 wp_generate_password 函数(它在/wp-includes/pluggable.php)和相关支持功能。

However, if this isn't an option, you could simply extract the wp_generate_password function (it's in /wp-includes/pluggable.php) and relevant support functions.

这篇关于Wordpress MD5密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 14:03