gpt4 book ai didi

mysql - 为什么 MySQL ENCRYPT() 给出相同的值?

转载 作者:行者123 更新时间:2023-11-29 05:45:48 24 4
gpt4 key购买 nike

我使用的部分代码是:

        $password = MD5($password);

$account_created = date("Y-m-d H-i-s");

db_insert("users","user_id,username,password,account_created,registration_ip","ENCRYPT('$_POST[username] $account_created'),'$_POST[username]',MD5('$_POST[password]'),'$account_created','$_SERVER[REMOTE_ADDR]'");

$user = db_get_array("users","username='$_POST[username]'");

db_insert("usersettings","user_id,timezone","'$user[user_id]','$_POST[timezone]'");

db_update("users","login_id = ENCRYPT('$user[username] $password')","user_id='$user[user_id]'");

脚本在此之前和之后继续

无论如何,我遇到的问题是,在 MySQL 查询中有两个对 ENCRYPT() 的调用,但由于某种原因,它们都具有相同的值

用户 ID 和登录 ID 应该不同,有什么问题吗?

最佳答案

ENCRYPT() ignores all but the first eight characters of str, at least on some systems. This behavior is determined by the implementation of the underlying crypt() system call.

http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html#function_encrypt

所以如果您的用户名超过 8 个字符...

关于mysql - 为什么 MySQL ENCRYPT() 给出相同的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2245582/

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