因此,我有一个数据库,用于存储用户信息以供他们登录或重置其密码。问题是重置密码仅适用于一个用户,而不适用于其他用户。
我尝试比较这两个用户,以找出不起作用的用户有什么或没有工作的用户做了什么,尽管我没有发现任何区别,这是我的数据库的图片可视化:https://gyazo.com/f231937058bc4c99ffa6bf1f9a5f7631
重置密码代码:
$email = $_GET['email'];
$token = $_GET['token'];
$stmt = $connection->prepare("SELECT email FROM users WHERE token = ? AND tokenexpire > NOW()");
$stmt->bind_param('s', $token);
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_array(MYSQLI_ASSOC);
if ($result->num_rows > 0 && md5($row['email']) == $email) {
$hash = $algorithm->create_hash($_POST['password']) // the create hash function comes from a PBKDF2 class from github
$token = '';
$normal_email = $row['email']; // the email on the top is a hashed email with md5
$query = $connection->prepare("UPDATE users SET hash = ?, token = ? WHERE email = ?");
$query->bind_param('sss', $hash, $token, $normal_email);
$query->execute(); // thats the line that does get executed on the 'nex' account but it doesn't on the 'veruz' account
没有错误消息