first commit
This commit is contained in:
18
adduser.php
Normal file
18
adduser.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
// Example to add a user with hashed password
|
||||
include("functions.php");
|
||||
$conn = connectDb();
|
||||
|
||||
$username = 'fire';
|
||||
$password = 'egfh2204'; // Plain password, to be hashed
|
||||
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
|
||||
|
||||
// Insert the user into the users table
|
||||
$stmt = $conn->prepare("INSERT INTO users (username, password) VALUES (?, ?)");
|
||||
$stmt->bind_param("ss", $username, $hashedPassword);
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
|
||||
echo "User added successfully!";
|
||||
$conn->close();
|
||||
?>
|
||||
Reference in New Issue
Block a user