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
/
dondedy
/
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(); } try { $conn->exec("CREATE TABLE IF NOT EXISTS `delivery_zones` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(100) NOT NULL, `fee` DECIMAL(10,2) NOT NULL DEFAULT 0, `is_active` TINYINT(1) NOT NULL DEFAULT 1, `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `uq_zone_name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;"); } catch (Throwable $e) { } $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 = []; } ?> <!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 | DONDEEDY</title> <link rel="icon" href="../images/favicon.png" type="image/x-icon"> <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> .zones-wrapper{max-width:1200px;margin:0 auto;padding:0 18px 40px;} .section-title{font-size:2rem;font-weight:800;color:#111;margin:24px 0;display:flex;align-items:center;gap:.6rem} .card{background:#fff;border:1px solid rgba(0,0,0,.06);border-radius:16px;box-shadow:0 10px 26px rgba(0,0,0,.08);padding:18px} .grid{display:flex;flex-direction:column;gap:18px} .manage-card{display:flex;align-items:center;justify-content:space-between;gap:18px;flex-wrap:wrap} .manage-card p{margin:0;color:#555;max-width:520px} .manage-card .btn{width:auto;padding:.85rem 1.4rem;flex-shrink:0;white-space:nowrap} .form-group{margin-bottom:12px} .form-label{display:block;font-weight:700;margin-bottom:6px;color:#333} .form-control{width:100%;padding:.8rem 1rem;border:2px solid #e6e6e6;border-radius:10px;font-size:1rem} .form-control:focus{outline:none;border-color:#b30000;box-shadow:0 0 0 3px rgba(179,0,0,.08)} .btn{border:none;border-radius:10px;padding:.85rem 1.2rem;font-weight:800;cursor:pointer} .btn-primary{background:linear-gradient(135deg,#28a745,#1e7e34);color:#fff} .btn-danger{background:linear-gradient(135deg,#dc3545,#a71d2a);color:#fff} .btn-secondary{background:#6c757d;color:#fff} .modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.35);display:none;align-items:center;justify-content:center;z-index:2500;padding:24px} .modal-overlay.active{display:flex} .modal-dialog{background:#fff;border-radius:18px;box-shadow:0 18px 40px rgba(0,0,0,.18);width:100%;max-width:520px;padding:28px 26px;position:relative} .modal-title{font-size:1.45rem;font-weight:800;color:#111;margin-bottom:10px;display:flex;align-items:center;gap:.55rem} .modal-close{position:absolute;top:16px;right:16px;background:none;border:none;font-size:1.5rem;color:#999;cursor:pointer} .modal-close:hover{color:#333} .modal-actions{display:flex;justify-content:flex-end;gap:12px;margin-top:18px} table{width:100%;border-collapse:separate;border-spacing:0 10px} thead th{font-weight:800;color:#555;text-align:left;padding:8px 10px} tbody tr{background:#fff;border:1px solid #eee} tbody td{padding:10px;border-top:1px solid #f0f0f0} .badge{display:inline-block;padding:.35rem .6rem;border-radius:999px;font-weight:800;font-size:.85rem} .badge-success{background:#e9f7ef;color:#1e7e34;border:1px solid #c7ecd4} .badge-muted{background:#f5f5f5;color:#555;border:1px solid #e6e6e6} .actions{display:flex;gap:8px} .actions .btn{width:46px;height:46px;display:flex;align-items:center;justify-content:center;padding:0;border-radius:10px} .actions .btn i{font-size:1.1rem} .alert{padding:.85rem 1rem;border-radius:10px;margin:10px 0;font-weight:700} .alert-success{background:#e8fff0;border:1px solid #b7f0c9;color:#1e7e34} .alert-danger{background:#fff0f0;border:1px solid #f0b7b7;color:#a71d2a} </style> </head> <body> <?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>COP <?= number_format((float)$z['fee'], 0, ',', '.') ?></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" onsubmit="return confirm('¿Eliminar esta zona?');"> <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 (COP)</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 (COP)</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> (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); } })(); </script> </body> </html>
Coded With 💗 by
0x6ick