<?php
include '../db.php';

include 'auth.php';
require_right('Create Role');


if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $roleName = trim($_POST['role_name']);

    if (!empty($roleName)) {
        $stmt = $conn->prepare("INSERT INTO roles (name) VALUES (?)");
        $stmt->bind_param("s", $roleName);
        $stmt->execute();
    }

    header("Location: ../index.php?success=role_created");
    exit();
}
?>
