What are the potential security risks of storing passwords in plain text for testing purposes?
Storing passwords in plain text for testing purposes poses a significant security risk as anyone with access to the database can easily view and misuse the passwords. To mitigate this risk, passwords should be securely hashed before storing them in the database. This ensures that even if the database is compromised, the actual passwords cannot be easily retrieved.
// Hashing the password before storing it in the database
$password = "secretPassword";
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
// Storing the hashed password in the database
// INSERT INTO users (username, password) VALUES ('john_doe', '$hashedPassword');