<?php
// Sends a test push to the signed-in user's devices.
session_start();
header('Content-Type: application/json');
require_once __DIR__ . '/config/db.php';
require_once __DIR__ . '/includes/webpush.php';
if (empty($_SESSION['user_id'])) { http_response_code(401); echo json_encode(['ok' => false]); exit; }
dabil_push_to_user($conn, (int)$_SESSION['user_id'], 'Dabil', 'Push notifications are on — you\'re all set! 🎉', 'notifications.php');
echo json_encode(['ok' => true]);
