Hi All,
I've recently setup an xampp web server as I needed some sort of system where users could log into a web page and upload some files to a pc.
I have the login working and I can create new users, however I can't seem to find a way to reset users passwords using mysql through phpmyadmin.
Below is the code taken from my register.php web page where it first process' the users password.
I'm guessing here but I think it something to do with how the password is hashed and put into the database?
This is the SQL query I've managed to get working to update the password field in the table, however when I try and login with the new password it doesn't work;
UPDATE `users` SET `password` = PASSWORD('2') WHERE `users`.`id` = 2
Any help would be appreciated, php/mysql isn't my strongest point so please be easy on me
Cheers,
Swain90
I've recently setup an xampp web server as I needed some sort of system where users could log into a web page and upload some files to a pc.
I have the login working and I can create new users, however I can't seem to find a way to reset users passwords using mysql through phpmyadmin.
Below is the code taken from my register.php web page where it first process' the users password.
Code:
// Check input errors before inserting in database
if(empty($username_err) && empty($password_err) && empty($confirm_password_err)){
// Prepare an insert statement
$sql = "INSERT INTO users (username, password) VALUES (?, ?)";
if($stmt = mysqli_prepare($link, $sql)){
// Bind variables to the prepared statement as parameters
mysqli_stmt_bind_param($stmt, "ss", $param_username, $param_password);
// Set parameters
$param_username = $username;
$param_password = password_hash($password, PASSWORD_DEFAULT); // Creates a password hash
// Attempt to execute the prepared statement
if(mysqli_stmt_execute($stmt)){
// Redirect to login page
header("location: login.php");
} else{
echo "Something went wrong. Please try again later.";
}
}
// Close statement
mysqli_stmt_close($stmt);
}
I'm guessing here but I think it something to do with how the password is hashed and put into the database?
This is the SQL query I've managed to get working to update the password field in the table, however when I try and login with the new password it doesn't work;
UPDATE `users` SET `password` = PASSWORD('2') WHERE `users`.`id` = 2
Any help would be appreciated, php/mysql isn't my strongest point so please be easy on me

Cheers,
Swain90