<?php
session_start();
require_once 'inc/functions.php';
check404();
securityCheck();
if (!isLoggedIn()) {
    echo json_encode(['success' => false]);
    exit;
}

$user = getUserById($_SESSION['user_id']);
$clanId = isset($_GET['clan_id']) ? (int)$_GET['clan_id'] : 0;

if (!$clanId || isUserInClan($user['id']) != $clanId) {
    echo json_encode(['success' => false]);
    exit;
}

markAnnouncementAsSeen($user['id'], $clanId);
echo json_encode(['success' => true]);