<?php
include 'db.php';
session_start();

if (!isset($_SESSION['user'])) exit('Unauthorized');

$user_id = $_POST['user_id'] ?? null;
$viewer = $_SESSION['user']['name'] ?? 'unknown';

if ($user_id) {
    $stmt = $conn->prepare("INSERT INTO audit_logs (admin_id, member_id, action) VALUES (?, ?, 'print_application')");
    $stmt->bind_param("ii", $_SESSION['user']['id'], $user_id);
    $stmt->execute();
}
?>