настройка регулярного выражения

This commit is contained in:
2025-08-26 02:44:44 +03:00
parent 3759e0465d
commit 18c5109e14
3 changed files with 10290588 additions and 18 deletions

View File

@@ -1,9 +1,15 @@
<?php
require_once '../config.php';
$db = new PDO("sqlite:../db/dns.sqlite");
$topDomains = $db->query("SELECT domain, COUNT(*) as hits FROM logs GROUP BY domain ORDER BY hits DESC LIMIT 10")->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($topDomains);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
error_reporting(E_ALL);
try {
$db = new PDO("sqlite:../db/dns.sqlite");
$stmt = $db->query("SELECT domain, COUNT(*) as hits FROM logs GROUP BY domain ORDER BY hits DESC LIMIT 10");
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
header('Content-Type: application/json');
echo json_encode($data ?: []);
} catch (Exception $e) {
http_response_code(500);
echo json_encode(["error" => $e->getMessage()]);
}