Jump to content
Killersites Community

Recommended Posts

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.";
			}
		}

            

PHPLogin.png

Edited by Joseppi83

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×