<?php
session_start();
if (!isset($_SESSION['user_id'])) exit;

include 'includes/db.php';

$nachricht = trim($_POST['nachricht'] ?? '');
if ($nachricht !== '') {
    $stmt = $conn->prepare("INSERT INTO chat_nachrichten (user_id, nachricht) VALUES (?, ?)");
    $stmt->bind_param("is", $_SESSION['user_id'], $nachricht);
    $stmt->execute();
}
