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: preparers.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' => '', 'phone' => '', 'status' => 'activo']; $editForm = ['id' => '', 'name' => '', 'phone' => '', 'status' => 'activo']; $shouldOpenCreateModal = false; $shouldOpenEditModal = false; if($_SERVER['REQUEST_METHOD'] === 'POST'){ $action = $_POST['action'] ?? ''; if($action === 'create'){ $name = trim($_POST['name'] ?? ''); $phone = trim($_POST['phone'] ?? ''); $isActive = isset($_POST['is_active']) ? 1 : 0; $createForm = [ 'name' => $name, 'phone' => $phone, 'status' => $isActive ? 'activo' : 'inactivo', ]; if($name === ''){ $errors[] = 'El nombre es obligatorio.'; } if(!$errors){ try{ $stmt = $conn->prepare("INSERT INTO `preparers` (name, phone, status) VALUES (?,?,?)"); $stmt->execute([$name, $phone, $isActive ? 'activo' : 'inactivo']); $success = 'Preparador registrado correctamente.'; $createForm = ['name' => '', 'phone' => '', 'status' => 'activo']; }catch (Throwable $e){ $errors[] = 'No se pudo registrar el preparador.'; } } if($errors){ $shouldOpenCreateModal = true; } } elseif($action === 'update'){ $id = (int)($_POST['id'] ?? 0); $name = trim($_POST['name'] ?? ''); $phone = trim($_POST['phone'] ?? ''); $isActive = isset($_POST['is_active']) ? 1 : 0; $editForm = [ 'id' => (string)$id, 'name' => $name, 'phone' => $phone, 'status' => $isActive ? 'activo' : 'inactivo', ]; if($id <= 0){ $errors[] = 'Preparador inválido.'; } if($name === ''){ $errors[] = 'El nombre es obligatorio.'; } if(!$errors){ try{ $stmt = $conn->prepare("UPDATE `preparers` SET name = ?, phone = ?, status = ? WHERE id = ?"); $stmt->execute([$name, $phone, $isActive ? 'activo' : 'inactivo', $id]); $success = 'Preparador actualizado.'; }catch (Throwable $e){ $errors[] = 'No se pudo actualizar el preparador.'; } } if($errors){ $shouldOpenEditModal = true; } } elseif($action === 'delete'){ $id = (int)($_POST['id'] ?? 0); if($id <= 0){ $errors[] = 'Preparador inválido.'; } if(!$errors){ try{ $stmt = $conn->prepare("DELETE FROM `preparers` WHERE id = ?"); $stmt->execute([$id]); $success = 'Preparador eliminado.'; }catch (Throwable $e){ $errors[] = 'No se pudo eliminar el preparador.'; } } } } $preparers = []; try{ $stmt = $conn->query("SELECT * FROM `preparers` ORDER BY status DESC, name ASC"); $preparers = $stmt ? $stmt->fetchAll(PDO::FETCH_ASSOC) : []; } catch (Throwable $e){ $preparers = []; } $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>Preparadores | <?= 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> .preparers-wrapper{max-width:1200px;margin:0 auto;padding:0 18px 40px;} .preparers-title{font-size:2rem;font-weight:800;color:#111;margin:24px 0;display:flex;align-items:center;gap:.6rem} .preparers-title i{color:#b30000;} .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,#b30000,#7a0000);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} body.preparers-page{ --color-primary: #0ea5e9; --color-success: #22c55e; --color-warning: #f59e0b; --color-danger: #ef4444; background: linear-gradient(135deg, #f5f9ff 0%, #fff7f3 100%); min-height: 100vh; } body.preparers-page .preparers-title{color:#0f172a;font-weight:900;letter-spacing:.2px;} body.preparers-page .preparers-title i{color:#0ea5e9;} body.preparers-page .card, body.preparers-page tbody tr, body.preparers-page .modal-dialog{ background: rgba(255, 255, 255, 0.86); border: 1px solid rgba(226, 232, 240, 0.85); box-shadow: 0 18px 42px rgba(17, 24, 39, 0.10); backdrop-filter: blur(10px); } body.preparers-page .form-control{ border-color: rgba(148, 163, 184, 0.55); background: rgba(255,255,255,0.92); box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06); } body.preparers-page .form-control:focus{ border-color: rgba(37, 99, 235, 0.55); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12), 0 10px 24px rgba(15, 23, 42, 0.10); } body.preparers-page .btn{transition:transform .2s ease, box-shadow .2s ease, filter .2s ease;} body.preparers-page .btn:hover{transform:translateY(-2px)} body.preparers-page .btn-primary{ background: linear-gradient(135deg, #0ea5e9, #2563eb); box-shadow: 0 12px 26px rgba(37, 99, 235, 0.22); } body.preparers-page .btn-primary:hover{filter:brightness(1.02);box-shadow:0 14px 30px rgba(37, 99, 235, 0.26);} body.preparers-page .btn-secondary{ background: rgba(255, 255, 255, 0.85); color: #0f172a; border: 1px solid rgba(148, 163, 184, 0.55); box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10); backdrop-filter: blur(6px); } body.preparers-page .btn-secondary:hover{border-color: rgba(148, 163, 184, 0.75);box-shadow:0 12px 28px rgba(15, 23, 42, 0.12);} body.preparers-page .btn-danger{ background: linear-gradient(135deg, #ef4444, #b91c1c); box-shadow: 0 10px 24px rgba(239, 68, 68, 0.20); } body.preparers-page .modal-overlay{background:rgba(17,24,39,.55);backdrop-filter:blur(6px)} body.preparers-page .modal-title{color:#0f172a} </style> </head> <body class="admin-panel preparers-page"> <?php include '../components/admin_header.php'; ?> <section class="preparers-wrapper"> <h1 class="preparers-title"><i class="fas fa-user-tie"></i> Preparadores</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:#b30000;margin-bottom:6px">Gestiona tus preparadores</h2> <p>Registra a las personas que preparan las comidas para poder asignarlas a las comandas y pedidos.</p> </div> <button type="button" class="btn btn-primary" id="openCreatePreparerModal"><i class="fas fa-plus"></i> Agregar preparador</button> </div> <div class="card"> <table> <thead> <tr> <th>Nombre</th> <th>Teléfono</th> <th>Estado</th> <th style="width:220px">Acciones</th> </tr> </thead> <tbody> <?php if(!$preparers): ?> <tr><td colspan="4" style="padding:16px;color:#777">No hay preparadores registrados.</td></tr> <?php else: foreach($preparers as $p): ?> <tr> <td><?= htmlspecialchars($p['name']) ?></td> <td><?= htmlspecialchars($p['phone']) ?></td> <td> <?php if(($p['status'] ?? 'activo') === 'activo'): ?> <span class="badge badge-success">Activo</span> <?php else: ?> <span class="badge badge-muted">Inactivo</span> <?php endif; ?> </td> <td> <div class="actions"> <button type="button" class="btn btn-secondary edit-preparer-btn" data-id="<?= (int)$p['id'] ?>" data-name="<?= htmlspecialchars($p['name'], ENT_QUOTES, 'UTF-8') ?>" data-phone="<?= htmlspecialchars($p['phone'], ENT_QUOTES, 'UTF-8') ?>" data-status="<?= ($p['status'] ?? 'activo') ?>"> <i class="fas fa-pen"></i> </button> <form method="post" class="delete-preparer-form"> <input type="hidden" name="action" value="delete"> <input type="hidden" name="id" value="<?= (int)$p['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="createPreparerModal" aria-hidden="true" role="dialog" aria-modal="true"> <div class="modal-dialog" role="document"> <button class="modal-close" type="button" aria-label="Cerrar" id="closeCreatePreparerModal">×</button> <h2 class="modal-title"><i class="fas fa-user-plus"></i> Agregar preparador</h2> <p style="margin-bottom:18px;color:#555">Ingresa la información del nuevo preparador.</p> <form method="post"> <input type="hidden" name="action" value="create"> <div class="form-group"> <label class="form-label" for="modalPreparerName">Nombre</label> <input type="text" name="name" id="modalPreparerName" class="form-control" required value="<?= htmlspecialchars($createForm['name']) ?>"> </div> <div class="form-group"> <label class="form-label" for="modalPreparerPhone">Teléfono (opcional)</label> <input type="text" name="phone" id="modalPreparerPhone" class="form-control" value="<?= htmlspecialchars($createForm['phone']) ?>"> </div> <div class="form-group" style="display:flex;align-items:center;gap:8px"> <input type="checkbox" name="is_active" id="modalPreparerActive" <?= $createForm['status'] === 'activo' ? 'checked' : '' ?>> <label for="modalPreparerActive" class="form-label" style="margin:0;cursor:pointer">Activo</label> </div> <div class="modal-actions"> <button type="button" class="btn btn-secondary" id="cancelCreatePreparerModal">Cancelar</button> <button class="btn btn-primary" type="submit"><i class="fas fa-save"></i> Guardar</button> </div> </form> </div> </div> <div class="modal-overlay" id="editPreparerModal" aria-hidden="true" role="dialog" aria-modal="true"> <div class="modal-dialog" role="document"> <button class="modal-close" type="button" aria-label="Cerrar" id="closeEditPreparerModal">×</button> <h2 class="modal-title"><i class="fas fa-pen"></i> Editar preparador</h2> <p style="margin-bottom:18px;color:#555">Actualiza los datos del preparador seleccionado.</p> <form method="post"> <input type="hidden" name="action" value="update"> <input type="hidden" name="id" id="editPreparerId" value="<?= htmlspecialchars($editForm['id']) ?>"> <div class="form-group"> <label class="form-label" for="editPreparerName">Nombre</label> <input type="text" name="name" id="editPreparerName" class="form-control" required value="<?= htmlspecialchars($editForm['name']) ?>"> </div> <div class="form-group"> <label class="form-label" for="editPreparerPhone">Teléfono (opcional)</label> <input type="text" name="phone" id="editPreparerPhone" class="form-control" value="<?= htmlspecialchars($editForm['phone']) ?>"> </div> <div class="form-group" style="display:flex;align-items:center;gap:8px"> <input type="checkbox" name="is_active" id="editPreparerActive" <?= $editForm['status'] === 'activo' ? 'checked' : '' ?>> <label for="editPreparerActive" class="form-label" style="margin:0;cursor:pointer">Activo</label> </div> <div class="modal-actions"> <button type="button" class="btn btn-secondary" id="cancelEditPreparerModal">Cancelar</button> <button class="btn btn-primary" type="submit"><i class="fas fa-save"></i> Actualizar preparador</button> </div> </form> </div> </div> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script> (function(){ const createModal = document.getElementById('createPreparerModal'); const editModal = document.getElementById('editPreparerModal'); if(!createModal && !editModal) return; const flashSuccess = <?= json_encode((string)$success, JSON_UNESCAPED_UNICODE); ?>; const flashErrors = <?= json_encode($errors, JSON_UNESCAPED_UNICODE); ?>; if(window.Swal){ if(flashSuccess){ Swal.fire({ toast:true, position:'top-end', icon:'success', title:flashSuccess, showConfirmButton:false, timer:1800, timerProgressBar:true }); } if(Array.isArray(flashErrors) && flashErrors.length){ Swal.fire({ toast:true, position:'top-end', icon:'error', title:'No se pudo completar la acción', text:String(flashErrors[0] || ''), showConfirmButton:false, timer:2600, timerProgressBar:true }); } } const openCreateBtn = document.getElementById('openCreatePreparerModal'); const closeCreateBtn = document.getElementById('closeCreatePreparerModal'); const cancelCreateBtn = document.getElementById('cancelCreatePreparerModal'); const createNameField = document.getElementById('modalPreparerName'); const closeEditBtn = document.getElementById('closeEditPreparerModal'); const cancelEditBtn = document.getElementById('cancelEditPreparerModal'); const editNameField = document.getElementById('editPreparerName'); const editPhoneField = document.getElementById('editPreparerPhone'); const editActiveField = document.getElementById('editPreparerActive'); const editIdField = document.getElementById('editPreparerId'); const editButtons = document.querySelectorAll('.edit-preparer-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'); document.body.style.overflow = 'hidden'; if(focusEl){ setTimeout(() => { focusEl.focus(); }, 100); } } function hideModal(modal){ if(!modal) return; modal.classList.remove('active'); modal.setAttribute('aria-hidden', 'true'); document.body.style.overflow = ''; } document.querySelectorAll('form.delete-preparer-form').forEach(form => { form.addEventListener('submit', (e) => { const row = form.closest('tr'); const nameCell = row ? row.querySelector('td') : null; const name = nameCell ? nameCell.textContent.trim() : 'este preparador'; if(window.Swal){ e.preventDefault(); Swal.fire({ title: '¿Eliminar preparador?', text: `Se eliminará "${name}". Esta acción no se puede deshacer.`, icon: 'warning', showCancelButton: true, confirmButtonText: 'Sí, eliminar', cancelButtonText: 'Cancelar', confirmButtonColor: '#ef4444', cancelButtonColor: '#6b7280' }).then((res) => { if(res.isConfirmed){ form.submit(); } }); } else { if(!confirm('¿Eliminar este preparador?')){ e.preventDefault(); } } }); }); 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 phone = btn.getAttribute('data-phone') || ''; const status = btn.getAttribute('data-status') || 'activo'; if(editIdField) editIdField.value = id; if(editNameField) editNameField.value = name; if(editPhoneField) editPhoneField.value = phone; if(editActiveField) editActiveField.checked = (status === 'activo'); 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