如题,因制作附加的用户导入功能需要。Discuz! 7 的加密方式貌似不管用了:$password = 'mypassword000';$salt = substr(uniqid(rand()), -6);
$password_uc = md5(md5($password).$salt);
$password_dz = md5(random(10));(其中 random 函数略去定义)这样子产生的值,将 $password_uc 和 $salt 写入 ucenter_members 表中,$password_dz 写入 discuz_common_member 表中,登录是提示失败的。请高手解答 万分感谢!
$password_uc = md5(md5($password).$salt);
$password_dz = md5(random(10));(其中 random 函数略去定义)这样子产生的值,将 $password_uc 和 $salt 写入 ucenter_members 表中,$password_dz 写入 discuz_common_member 表中,登录是提示失败的。请高手解答 万分感谢!
谢谢,UC是包含密码和salt值的二次MD5,而DZ密码纯粹就是一随机字符串MD5后的结果// random() 函数:来自DZ源代码
function random($length) {
$hash = '';
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
$max = strlen($chars) - 1;
PHP_VERSION < '4.2.0' && mt_srand((double)microtime() * 1000000);
for($i = 0; $i < $length; $i++) {
$hash .= $chars[mt_rand(0, $max)];
}
return $hash;
}// 假定密码为 mypassword000
$password = 'mypassword000';// 生成随机字符串 $salt
$salt = substr(uniqid(rand()), -6);
// UC 的二次MD5加密
$password_uc = md5(md5($password).$salt);
// DZ数据表的“密码”字串
$password_dz = md5(random(10));谢谢各位了,问题已解决,以上代码可用,有需要的可以参考。