这是桌子。
在 phpmyadmin 中执行的查询是
SELECT * FROM users WHERE hashed_password = '8c1017982b2032cc059203e3d83dd0ee2e7a86b3'
结果是一个空的结果集。如果查询是
SELECT * FROM users WHERE username='tt'
Then 它按预期工作。
为什么 ?我有什么明显的遗漏吗?使用 php 的 sha1() 对密码进行哈希处理
SELECT * FROM users WHERE hashed_password LIKE '8c1017982b2032cc059203e3d83dd0ee2e7a86b3%'
给出空结果集。
“show create table users”的输出
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`hashed_password` varchar(255) NOT NULL,
`favourites` text,
`ip_address` varchar(40) DEFAULT NULL,
`enabled` tinyint(1) NOT NULL DEFAULT '1',
`trust_level` int(11) NOT NULL DEFAULT '0',
`time_stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1
的输出select hashed_password, length(hashed_password) from users