<?php
include 'db.connection.php';
include 'auth.php';
require_right('Create User');

$username = $_POST['username'];
$email = $_POST['email'];
$password = password_hash($_POST['password'], PASSWORD_BCRYPT);
$roleId = $_POST['role_id'];

$stmt = $conn->prepare("INSERT INTO users (username, email, password, role_id) VALUES (?, ?, ?, ?)");
$stmt->bind_param("sssi", $username, $email, $password, $roleId);
$stmt->execute();

echo "User created!";
?>
