<?php
include 'config/db.php';
session_start();
if (!isset($_SESSION['usuario'])) {
    header("Location: login.php");
    exit;
}

$id = $_GET['id'];
$sql = "DELETE FROM usuarios WHERE id = ?";
$stmt = $conexion->prepare($sql);
$stmt->bind_param("i", $id);
if ($stmt->execute()) {
    header("Location: listar_usuarios.php");
    exit;
} else {
    echo "Error al eliminar usuario: " . $conexion->error;
}
?>
