Files
clinic/passwordgen.php
T
2024-06-05 10:49:04 +08:00

25 lines
721 B
PHP

<?php
require 'dbconn.php';
// Replace with the desired password
$plainPassword = "admin";
$hashedPassword = password_hash($plainPassword, PASSWORD_DEFAULT);
// Replace with the username
$username = "admin";
// Set the default value for tbluserroles_roleid to 1
$defaultRoleId = 1;
// Create an SQL query to insert the hashed password with the default role ID
$sql = "INSERT INTO tbluserauth (username, password, tbluserroles_roleid) VALUES ('$username', '$hashedPassword', $defaultRoleId)";
// Execute the SQL query (ensure you have a database connection)
$result = mysqli_query($conn, $sql);
if ($result) {
echo "Hashed password inserted successfully.";
} else {
echo "Error: " . mysqli_error($conn);
}