Guest Joseppi83 Posted August 13, 2018 Report Posted August 13, 2018 (edited) So, I have followed the instructions to a 'T,' yet I get a notice after I update the password. I thought I might be missing something from the videos, so I cut what I typed out and copied and pasted the source code files for the video section in it, but the exact same notice rendered in the browser. Any idea what's up with the notice? Does it have to do with deprecated code from previous versions, since Ben's browser was not rendering the same notice? else { // insert into database if ($stmt = $mysqli->prepare("UPDATE members SET password = ? WHERE id = ?")) { $stmt->bind_param("ss", md5($input['pass'] . $config['salt']), $_SESSION['id']); $stmt->execute(); $stmt->close(); // add alert and clear form values $error['alert'] = 'Password updated successfully!'; $input['current_pass'] = ''; $input['pass'] = ''; $input['pass2'] = ''; // show form include('views/v_password.php'); } else { echo "ERROR: Could not prepare MySQLi statement."; } } Edited August 13, 2018 by Joseppi83 Quote
administrator Posted August 13, 2018 Report Posted August 13, 2018 Hi, I don't know what line is line 106, but look at this line: $stmt->bind_param("ss", md5($input['pass'] . $config['salt']), $_SESSION['id']); It could be he is trying to pass this into the array: md5($input['pass'] So instead, assign to a variable and pass that. So do something like: $salted = md5($input['pass']; And then: $stmt->bind_param("ss", $salted . $config['salt']), $_SESSION['id']); The md5 hash function is altering the stat of $input['pass'], so that could be causing the notice to appear. I haven't looked at what Ben did in that video, but he may have just turned off error_reporting for PHP. Hope that helps, Stef Quote
Guest Joseppi83 Posted August 24, 2018 Report Posted August 24, 2018 Breaking it up into smaller chunks as variables like that fixed it. Merci. Quote
123samueld Posted March 13, 2020 Report Posted March 13, 2020 I've been having some kind of problem with this too. This is the code I used based on Bens tutorial and Stephans update. $salted = md5($input['pass']); $password = ($salted . $config['salt']); $stmt->bind_param("ss", $input['user'], $password); $stmt->execute(); $stmt->store_result(); It still isn't working. It just says all usernames and passwords are incorrect, even the correct "admin" "admin". When I hard code in the correct details it processes it fine and goes to the members.php page. So it's connecting to the database correctly and the IF statements to check the input to the database are also working correctly. Any help would be hugely appreciated. SD Quote
administrator Posted March 18, 2020 Report Posted March 18, 2020 So if you hard code, that means the form submissions are not working. Check that code. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.