<?php
session_start();
require_once '../includes/admin_auth_check.php';

// Check if admin_notifications.php exists in admin/includes
if (file_exists('includes/admin_notifications.php')) {
    require_once 'includes/admin_notifications.php';
} else {
    require_once '../includes/admin_notifications.php';
}

$database = new Database();
$db = $database->getConnection();

markAllAdminNotificationsAsRead($db, $_SESSION['admin_id']);

// Redirect back to the previous page or to the dashboard
$redirect_to = $_SERVER['HTTP_REFERER'] ?? 'index.php';
header("Location: $redirect_to");
exit();
?>
