How to show and hide a password in a secure way using PDO?

  javascript, pdo, php, sql-server

Good Day,

I would like to show a password stored in SQL-Server and display it once clicked on the button.
When the button is clicked a request must be made by using PDO. How would I go and do this in a secure way by storing the passwords encrypted in SQL Server and decrypting the password once clicked by the user?

What also would be nice is to add a button to edit this input field so that the user can update this password if they have the required permission.

I will add steps to keep an audit of who viewed the password.

For example

<!DOCTYPE html>
<html>
<head>
        <title>Change Input Text Value OnClick Event</title>
</head>
<body>
<input type="text" id="my_field" value="***********">
<button onclick="change()">Show Password</button>
<script>
function change(){
    var txt = "My Password"; // get this value using php, what would the best way be toencrypt and decrypt passwords
    document.getElementById("my_field").value = txt;
}
</script>
</body>
</html>

Source: Ask PHP

LEAVE A COMMENT