<?php
// Check if the request is a POST request
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    header("Location: ../../../views/auth/403.php");
    exit;
}

require_once '../../../config/constants.php';
require_once '../../../database/db_connect.php';

if (isset($_POST['deleteUser'])) {
    $userID = $_POST['userId'];
    echo deleteUser($userID);
}


function deleteUser($userId)
{
    $stmt = PDO_CONNECTION->prepare("DELETE FROM users WHERE id = :id");
    $stmt->bindParam(":id", $userId);
    return $stmt->execute();
}
