X7ROOT File Manager
Current Path:
/home/u126090504/domains/oceanicabeachresort.com/public_html/admin
home
/
u126090504
/
domains
/
oceanicabeachresort.com
/
public_html
/
admin
/
📁
..
📁
assets
📄
banners.php
(9.78 KB)
📄
booking-dashboard.php
(4.93 KB)
📄
booking_status_update.php
(6.14 KB)
📄
booking_view.php
(4.04 KB)
📄
branding_settings.php
(5.93 KB)
📄
change_password.php
(3.01 KB)
📄
contacts.php
(3.83 KB)
📄
dashboard.php
(5.64 KB)
📁
dompdf
📄
downloads.php
(4.91 KB)
📄
forgot_password.php
(5.76 KB)
📄
gallery.php
(3.08 KB)
📁
img
📁
includes
📄
index.php
(82 B)
📁
invoices
📄
login.php
(13.47 KB)
📄
logo.png
(19.29 KB)
📄
logout.php
(102 B)
📄
manage_albums.php
(10.82 KB)
📄
manage_media.php
(11.77 KB)
📄
manage_photos.php
(6.35 KB)
📄
manage_videos.php
(18.38 KB)
📄
new_password.php
(3.9 KB)
📄
notice.php
(15.52 KB)
📄
notice_error.log
(38.45 KB)
📄
notices.php
(8.24 KB)
📄
payments.php
(14.96 KB)
📄
pdf_bill_template.php
(30.69 KB)
📁
phpmailer
📄
popup.php
(14.07 KB)
📄
reset_password.php
(2.27 KB)
📄
secure_session.php
(1000 B)
📄
settings.php
(8.34 KB)
📄
test.php
(239 B)
📄
test_pdf.php
(1.58 KB)
📄
testimonials.php
(15.15 KB)
📁
tmp
📄
update_status.php
(1.66 KB)
📄
upi_settings.php
(1.52 KB)
Editing: manage_albums.php
<?php /******************************* * manage-albums.php * Albums: CRUD + Search (same look & feel) *******************************/ include 'secure_session.php'; include 'includes/auth.php'; require_once '../config.php'; // mysqli $conn include 'includes/header.php'; $success = $error = ""; /* ---------- HELPERS ---------- */ function parse_date_yyyy_mm_dd($in){ $in = trim((string)$in); if ($in==='') return null; if (preg_match('~^\d{2}-\d{2}-\d{4}$~',$in)){ [$d,$m,$y]=explode('-',$in); if (checkdate((int)$m,(int)$d,(int)$y)) return sprintf('%04d-%02d-%02d',$y,$m,$d); } if (preg_match('~^\d{4}-\d{2}-\d{2}$~',$in)) return $in; return null; } /* ---------- ADD ---------- */ if ($_SERVER['REQUEST_METHOD']==='POST' && (($_POST['action']??'')==='add')){ $name = trim($_POST['name']??''); $desc = trim($_POST['description']??''); if ($name===''){ $error = "Album name is required."; } else { $stmt = $conn->prepare("INSERT INTO albums(name, description) VALUES(?,?)"); $stmt->bind_param("ss",$name,$desc); $stmt->execute(); $success = "✅ Album added."; } } /* ---------- UPDATE ---------- */ if ($_SERVER['REQUEST_METHOD']==='POST' && (($_POST['action']??'')==='update')){ $id = (int)($_POST['id']??0); $name = trim($_POST['name']??''); $desc = trim($_POST['description']??''); if ($id<=0){ $error = "Invalid record."; } elseif ($name===''){ $error = "Album name is required."; } else { $u = $conn->prepare("UPDATE albums SET name=?, description=? WHERE id=?"); $u->bind_param("ssi",$name,$desc,$id); $u->execute(); $success = "✏️ Changes saved."; } } /* ---------- DELETE ---------- */ if (isset($_GET['delete'])){ $id = (int)$_GET['delete']; if ($id>0){ $d = $conn->prepare("DELETE FROM albums WHERE id=?"); $d->bind_param("i",$id); $d->execute(); $success = "⚠️ Album deleted."; } } /* ---------- SEARCH ---------- */ $kw = trim($_GET['q'] ?? ''); $fromUi = trim($_GET['from'] ?? ''); $toUi = trim($_GET['to'] ?? ''); $from = parse_date_yyyy_mm_dd($fromUi); $to = parse_date_yyyy_mm_dd($toUi); $where=[]; $params=[]; $types=''; if ($kw!==''){ $where[]="(name LIKE CONCAT('%',?,'%') OR description LIKE CONCAT('%',?,'%'))"; $params[]=$kw; $params[]=$kw; $types.='ss'; } if ($from){ $where[]="DATE(created_at)>=?"; $params[]=$from; $types.='s'; } if ($to){ $where[]="DATE(created_at)<=?"; $params[]=$to; $types.='s'; } $whereSql = $where?('WHERE '.implode(' AND ',$where)):''; $orderSql = " ORDER BY created_at DESC, id DESC"; $sql_list = "SELECT * FROM albums $whereSql $orderSql"; $sql_count = "SELECT COUNT(*) FROM albums"; $sql_count_f = "SELECT COUNT(*) FROM albums $whereSql"; $totalAll = 0; if ($rs = $conn->query($sql_count)) { $row = $rs->fetch_row(); $totalAll = (int)$row[0]; } if ($where){ $sc = $conn->prepare($sql_count_f); if ($types!=='') $sc->bind_param($types, ...$params); $sc->execute(); $sc->bind_result($cnt); $sc->fetch(); $sc->close(); $totalFiltered = (int)$cnt; $sl = $conn->prepare($sql_list); if ($types!=='') $sl->bind_param($types, ...$params); $sl->execute(); $list = $sl->get_result(); }else{ $totalFiltered = $totalAll; $list = $conn->query($sql_list); } ?> <style> :root{ --brand:#e0332f; --ink:#202427; --text:#3a3f44; --muted:#6f7780; --line:#eef0f3; --chip:#f6f7f9; --shadow:0 8px 24px rgba(20,28,36,.06); } .page-wrap{ padding:20px 10px 40px; } .title-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; } .page-title{ font-weight:700; color:var(--ink); display:flex; align-items:center; gap:10px; } .page-title .emoji{ width:36px; height:36px; display:grid; place-items:center; border-radius:10px; background:rgba(224,51,47,.08); } .underline{ height:4px; background:linear-gradient(90deg,var(--brand),transparent 50%); border-radius:4px; margin:8px 0 20px; } .chip{ background:var(--chip); border:1px solid var(--line); border-radius:999px; padding:6px 10px; font-weight:600; } .btn-pill{ border-radius:999px!important; padding:.45rem .95rem!important; font-weight:700; } .search-bar{ background:#fff; border:1px solid var(--line); border-radius:14px; padding:16px; box-shadow:var(--shadow); margin-bottom:18px; } .search-grid{ display:grid; grid-template-columns:1.2fr .7fr .7fr auto; gap:12px; } .search-grid .form-control{ border-radius:10px; border:1px solid var(--line); } .card{ border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow); } .card-header{ font-weight:800; } label{ font-weight:700; color:var(--text); } .form-control{ border-radius:10px; border:1px solid var(--line); } .muted{ color:var(--muted); font-size:.9rem; } .two-col .form-grid{ display:grid; grid-template-columns:repeat(2,minmax(260px,1fr)); gap:16px 20px; } .two-col .span-2{ grid-column:1 / -1; } .table-wrap{ border:1px solid var(--line); border-radius:14px; overflow:hidden; box-shadow:var(--shadow); } .table thead th{ background:#fafbfc; font-weight:800; } .modal-content{ border-radius:16px; } @media(max-width:992px){ .search-grid{ grid-template-columns:1fr 1fr; } } @media(max-width:576px){ .search-grid{ grid-template-columns:1fr; } .two-col .form-grid{ grid-template-columns:1fr; } .two-col .span-2{ grid-column:auto; } } </style> <div class="container page-wrap"> <div class="title-row"> <h3 class="page-title"><span class="emoji">📷</span> Manage Albums</h3> <span class="chip">Total: <strong><?= (int)$totalFiltered ?></strong></span> </div> <div class="underline"></div> <?php if($success): ?><div class="alert alert-success"><?= $success ?></div><?php endif; ?> <?php if($error): ?><div class="alert alert-danger"><?= $error ?></div><?php endif; ?> <!-- SEARCH BAR --> <div class="search-bar"> <form method="GET" class="search-grid" autocomplete="off"> <input type="text" name="q" value="<?= htmlspecialchars($kw) ?>" class="form-control" placeholder="Search name or description"> <input type="text" name="from" value="<?= htmlspecialchars($fromUi) ?>" class="form-control" placeholder="From (dd-mm-yyyy)"> <input type="text" name="to" value="<?= htmlspecialchars($toUi) ?>" class="form-control" placeholder="To (dd-mm-yyyy)"> <div> <button class="btn btn-primary btn-pill" type="submit">Search</button> <a class="btn btn-outline-secondary btn-pill" href="manage-albums.php">Reset</a> </div> </form> <div class="muted mt-2">Tip: Filter by date range to narrow records.</div> </div> <!-- ADD FORM (2-COLUMN) --> <div class="card mb-4 two-col"> <div class="card-header">➕ Add New Album</div> <div class="card-body"> <form method="POST" autocomplete="off" novalidate> <input type="hidden" name="action" value="add"> <div class="form-grid"> <div> <label>Album Name <span class="text-danger">*</span></label> <input type="text" name="name" class="form-control" required maxlength="150" placeholder="Upload Photos"> </div> <div class="span-2"> <label>Description</label> <textarea name="description" class="form-control" rows="3" maxlength="500" placeholder="Optional short description"></textarea> </div> </div> <div class="d-flex gap-2 mt-3"> <button type="submit" class="btn btn-primary btn-pill">Add Album</button> <a href="manage_photos.php" class="btn btn-success btn-pill">Add Photos</a> </div> </form> </div> </div> <!-- LIST --> <div class="table-wrap"> <div class="table-responsive"> <table class="table table-hover align-middle text-center"> <thead> <tr> <th>ID</th> <th class="text-left">Name</th> <th>Description</th> <th>Created</th> <th>Actions</th> </tr> </thead> <tbody> <?php $modals=[]; if($list && $list->num_rows): while($row=$list->fetch_assoc()): ?> <tr> <td><?= (int)$row['id'] ?></td> <td class="text-left"><strong><?= htmlspecialchars($row['name']) ?></strong></td> <td class="text-left"><?= nl2br(htmlspecialchars($row['description'])) ?></td> <td><?= !empty($row['created_at']) ? htmlspecialchars($row['created_at']) : '-' ?></td> <td> <button type="button" class="btn btn-info btn-sm btn-pill" data-bs-toggle="modal" data-bs-target="#edit<?= (int)$row['id'] ?>"> Edit </button> <a href="?delete=<?= (int)$row['id'] ?>" class="btn btn-danger btn-sm btn-pill" onclick="return confirm('Delete this album?')"> Delete </a> </td> </tr> <?php // modal markup (Bootstrap 5) outside table ob_start(); ?> <div class="modal fade" id="edit<?= (int)$row['id'] ?>" tabindex="-1" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content two-col"> <form method="POST" autocomplete="off" novalidate> <input type="hidden" name="action" value="update"> <input type="hidden" name="id" value="<?= (int)$row['id'] ?>"> <div class="modal-header"> <h5 class="modal-title">✏️ Edit Album</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <div class="form-grid"> <div> <label>Album Name <span class="text-danger">*</span></label> <input type="text" name="name" class="form-control" value="<?= htmlspecialchars($row['name']) ?>" required maxlength="150"> </div> <div class="span-2"> <label>Description</label> <textarea name="description" class="form-control" rows="4" maxlength="500"><?= htmlspecialchars($row['description']) ?></textarea> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary btn-pill" data-bs-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary btn-pill">Save changes</button> </div> </form> </div> </div> </div> <?php $modals[] = ob_get_clean(); endwhile; else: ?> <tr><td colspan="5">No albums found</td></tr> <?php endif; ?> </tbody> </table> </div> </div> <!-- render all modals here --> <?= implode("\n",$modals) ?> </div> <?php include 'includes/footer.php'; ?>
Upload File
Create Folder