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

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

$member_id = $_GET['member_id'] ?? null;
if ($member_id) {
    $viewer = $_SESSION['user']['name'];
    $role = $_SESSION['user']['role'];
    $stmt = $conn->prepare("INSERT INTO audit_logs (admin_id, member_id, action) VALUES (?, ?, ?)");
    $stmt->bind_param("iis", $_SESSION['user']['id'], $member_id, $action);
    $action = 'view_application';
    $stmt->execute();
}
?>