You must be logged in to change your password.';
} else {
echo '
Change your password
';
}
?>
';
foreach ($errors as $err) {
echo '' . $err . '';
}
echo '';
} else {
$sql = "UPDATE users SET user_pass = ? WHERE user_id = ?;";
$stmt = mysqli_stmt_init($dbc);
if (!mysqli_stmt_prepare($stmt, $sql)) {
die('Could not create account due to internal error: ' . mysqli_error($dbc));
}
$pass_hash = password_hash($user_pass, PASSWORD_DEFAULT);
mysqli_stmt_bind_param($stmt, "ss", $pass_hash, $_SESSION['user_id']);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
echo 'Password successfully changed!';
}
}
?>