gpt4 book ai didi

php - Zendcart - 将现有的用户数据库与 zendcart 数据库合并

转载 作者:可可西里 更新时间:2023-11-01 13:27:48 25 4
gpt4 key购买 nike

我刚刚在我的系统上安装了 zendcart,我尝试将我已有的站点的用户数据库与 zendcart 数据库合并。

我已设法正确移植所有内容,只是密码似乎不起作用。我自己的系统 md5 在密码进入数据库时​​对密码进行哈希处理,我不知道 zencart 如何对其密码进行哈希处理,但据我所知,它与我目前使用的算法几乎相同,仅附加了 3 个字符。

ex current password: sad97213sd123js123
ex zendcart pass: sad97213sd123js123:c1

我如何重新设置我的密码以匹配 zendcarts 标准,或者..我如何编辑 zendcart 以接受通过 zendcart 以外的其他方式生成的加盐密码

先谢谢你

最佳答案

class.zcPassword.php (/includes/classes) 中,你会发现它:

  /**
* Determine the password type
*
* Legacy passwords were hash:salt with a salt of length 2
* php < 5.3.7 updated passwords are hash:salt with salt of length > 2
* php >= 5.3.7 passwords are BMCF format

它描述了在决定如何处理密码之前使用 ircmaxell/password-compat 进行的遗留比较。图书馆,就在这里:

  function detectPasswordType($encryptedPassword)
{
$type = 'unknown';
$tmp = explode(':', $encryptedPassword); // try to break the hash in an array of 2 elements at :, first being the hash, second a suffix
if (count($tmp) == 2) { // if it breaks...
if (strlen($tmp [1]) > 2) { //...then check if 2nd has a length > 2...
$type = 'compatSha256'; //...if it does, it's SHA2
} elseif (strlen($tmp [1]) == 2) {//...if not, make sure it's == 2...
$type = 'oldMd5';// ...just to confirm it's MD5
}
}
return $type; // and return the string to be treated ahead
}

编辑://注释了代码。

如您所见,:c1 只是 salt 后缀(他 explodes 当他找到它时)它读取以定义它应该运行哪种算法以保持向后兼容性(在您的情况下,MD5)根据 PHP 版本,这就是哈希值相同的原因。

我建议您只删除位于 : 点的所有密码末尾的后缀,或者处理该函数及其依赖项以忽略此检查。

关于php - Zendcart - 将现有的用户数据库与 zendcart 数据库合并,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32606674/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com