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
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
Guest Joseppi83 Posted August 24, 2018 Report Posted August 24, 2018 Breaking it up into smaller chunks as variables like that fixed it. Merci.
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
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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now