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_videos.php
<?php // manage_videos.php โ Stable for shared hosting (no get_result, no bound LIMIT) // DEBUG: remove these two lines after things work error_reporting(E_ALL); ini_set('display_errors', 1); include 'secure_session.php'; include 'includes/auth.php'; require_once '../config.php'; include 'includes/header.php'; /* ============== Helpers ============== */ function h($s){ return htmlspecialchars($s ?? '', ENT_QUOTES, 'UTF-8'); } function parse_ddmmyyyy($d){ $d = trim($d ?? ''); if ($d==='') return null; $p = explode('-', $d); if (count($p)!==3) return null; [$dd,$mm,$yy] = $p; if (!checkdate((int)$mm,(int)$dd,(int)$yy)) return null; return sprintf('%04d-%02d-%02d',(int)$yy,(int)$mm,(int)$dd); } function detect_video($url){ $u = trim($url ?? ''); $out = ['provider'=>'other','id'=>null]; if (preg_match('~(?:youtube\.com/(?:watch\?v=|embed/)|youtu\.be/)([A-Za-z0-9_\-]{6,})~', $u, $m)) return ['provider'=>'youtube','id'=>$m[1]]; if (preg_match('~drive\.google\.com/(?:file/d/|open\?id=)([^/&\?]+)~', $u, $m)) return ['provider'=>'drive','id'=>$m[1]]; if (preg_match('~vimeo\.com/(?:video/)?(\d+)~', $u, $m)) return ['provider'=>'vimeo','id'=>$m[1]]; return $out; } function embed_url($url){ $d = detect_video($url); if ($d['provider']==='youtube') return 'https://www.youtube.com/embed/'.$d['id']; if ($d['provider']==='drive') return 'https://drive.google.com/file/d/'.$d['id'].'/preview'; if ($d['provider']==='vimeo') return 'https://player.vimeo.com/video/'.$d['id']; return $url; } function thumb_url($url){ $d = detect_video($url); if ($d['provider']==='youtube') return 'https://img.youtube.com/vi/'.$d['id'].'/hqdefault.jpg'; if ($d['provider']==='drive') return 'https://drive.google.com/thumbnail?id='.$d['id']; return null; } function column_exists($conn, $table, $col){ $col = $conn->real_escape_string($col); $table = $conn->real_escape_string($table); $res = $conn->query("SHOW COLUMNS FROM `$table` LIKE '$col'"); return $res && $res->num_rows > 0; } $success = $error = ""; /* ============== Actions (safe prepared) ============== */ /* Create */ if ($_SERVER['REQUEST_METHOD']==='POST' && ($_POST['action']??'')==='create'){ $title = trim($_POST['title'] ?? ''); $url = trim($_POST['video_url'] ?? ''); $cat = trim($_POST['category'] ?? ''); if ($title==='' || $url===''){ $error="Please enter both title and video URL."; } else { $stmt = $conn->prepare("INSERT INTO videos (title, video_url, category) VALUES (?, ?, ?)"); $stmt->bind_param('sss', $title, $url, $cat); if ($stmt->execute()) $success = "โ Video added successfully!"; else $error = "DB error: ".$stmt->error; } } /* Update */ if ($_SERVER['REQUEST_METHOD']==='POST' && ($_POST['action']??'')==='update'){ $id = (int)($_POST['id'] ?? 0); $title = trim($_POST['title'] ?? ''); $url = trim($_POST['video_url'] ?? ''); $cat = trim($_POST['category'] ?? ''); if ($id<=0 || $title==='' || $url===''){ $error="Invalid data."; } else { $stmt = $conn->prepare("UPDATE videos SET title=?, video_url=?, category=? WHERE id=?"); $stmt->bind_param('sssi', $title, $url, $cat, $id); if ($stmt->execute()) $success = "โ Video updated!"; else $error = "DB error: ".$stmt->error; } } /* Single delete */ if (isset($_GET['delete'])){ $id = (int)$_GET['delete']; if ($id>0){ $stmt = $conn->prepare("DELETE FROM videos WHERE id=?"); $stmt->bind_param('i', $id); if ($stmt->execute()) $success = "๐๏ธ Video deleted!"; else $error = "DB error: ".$stmt->error; } } /* Bulk delete */ if ($_SERVER['REQUEST_METHOD']==='POST' && ($_POST['action']??'')==='bulk_delete'){ $ids = $_POST['ids'] ?? []; if (is_array($ids) && count($ids)){ $ids = array_map('intval', $ids); $in = implode(',', $ids); if (!$conn->query("DELETE FROM videos WHERE id IN ($in)")) { $error = "DB error: ".$conn->error; } else { $success = "๐งน Deleted ".count($ids)." video(s)."; } } else { $error = "Select at least one video."; } } /* ============== Filters & Pagination (simple, safe) ============== */ $q = trim($_GET['q'] ?? ''); $cat_filt = trim($_GET['category'] ?? ''); $from_raw = trim($_GET['from'] ?? ''); $to_raw = trim($_GET['to'] ?? ''); $from = parse_ddmmyyyy($from_raw); $to = parse_ddmmyyyy($to_raw); $hasCreatedAt = column_exists($conn, 'videos', 'created_at'); $whereParts = []; if ($q!==''){ $like = $conn->real_escape_string("%$q%"); $whereParts[] = "title LIKE '$like'"; } if ($cat_filt!==''){ $catEsc = $conn->real_escape_string($cat_filt); $whereParts[] = "category = '$catEsc'"; } if ($hasCreatedAt){ if ($from){ $fromEsc = $conn->real_escape_string($from); $whereParts[] = "DATE(created_at) >= '$fromEsc'"; } if ($to){ $toEsc = $conn->real_escape_string($to); $whereParts[] = "DATE(created_at) <= '$toEsc'"; } } $where = count($whereParts) ? ('WHERE '.implode(' AND ', $whereParts)) : ''; /* Count */ $count_sql = "SELECT COUNT(*) c FROM videos $where"; $ctRes = $conn->query($count_sql); $total_rows = 0; if ($ctRes){ $row = $ctRes->fetch_assoc(); $total_rows = (int)$row['c']; } /* Pagination numbers */ $per_page = 10; $page = max(1, (int)($_GET['page'] ?? 1)); $pages = max(1, (int)ceil($total_rows/$per_page)); if ($page>$pages) $page=$pages; $offset = ($page-1)*$per_page; /* Fetch page (LIMIT numbers inline) */ $per_page = (int)$per_page; $offset = (int)$offset; $select_cols = "id, title, video_url, category".($hasCreatedAt?", created_at":""); $sql = "SELECT $select_cols FROM videos $where ORDER BY id DESC LIMIT $per_page OFFSET $offset"; $list = $conn->query($sql); /* Distinct categories */ $cats = []; $catRes = $conn->query("SELECT DISTINCT category FROM videos WHERE category IS NOT NULL AND category<>'' ORDER BY category ASC"); if ($catRes){ while($r=$catRes->fetch_assoc()){ $cats[]=$r['category']; } } ?> <style> .page-wrap { background:#f7f8fb; padding:16px; border-radius:20px; } .section-card { background:#fff; border-radius:18px; box-shadow:0 6px 16px rgba(0,0,0,.06); } .section-header { font-weight:700; font-size:28px; display:flex; gap:10px; align-items:center; } .badge-total { background:#eef2ff; color:#3b82f6; border-radius:16px; padding:6px 12px; font-weight:600; } .label-req { color:#ef4444; } .grid-videos { display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:12px; } .card-video { border:none; border-radius:14px; overflow:hidden; box-shadow:0 3px 10px rgba(0,0,0,.05); transition:.2s; background:#fff; } .card-video:hover { transform:translateY(-3px); box-shadow:0 6px 14px rgba(0,0,0,.1); } .thumb { position:relative; width:100%; aspect-ratio:16/9; background:#000; } .thumb img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; } .thumb .play { position:absolute; left:8px; bottom:8px; background:rgba(0,0,0,.65); color:#fff; border:0; border-radius:8px; padding:6px 10px; font-size:12px; } .card-video .card-body { padding:8px 10px; text-align:center; } .card-video .title { font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .card-video .meta { font-size:12px; color:#6c757d; } .btn-edit { background:#111; color:#fff; border:none; font-size:12px; padding:4px 10px; border-radius:6px; } .btn-edit:hover { background:#333; } .btn-del { background:#dc3545; color:#fff; border:none; font-size:12px; padding:4px 10px; border-radius:6px; } .btn-del:hover { background:#bb2d3b; } .btn-light-outline { border:1px solid #ddd; background:#fff; } .sel-all { font-size:12px; color:#555; user-select:none; cursor:pointer; } .pagination { display:flex; gap:6px; flex-wrap:wrap; justify-content:center; } .pagination .page-link { border-radius:8px; padding:6px 10px; border:1px solid #e5e7eb; color:#374151; background:#fff; text-decoration:none; } .pagination .active { background:#3b82f6; color:#fff; border-color:#3b82f6; } </style> <div class="container my-3 page-wrap"> <div class="d-flex justify-content-between align-items-center mb-3"> <div class="section-header"><i class="fas fa-video"></i> Manage Video Gallery</div> <div class="badge-total">Total: <?php echo (int)$total_rows; ?></div> </div> <?php if ($success): ?><div class="alert alert-success"><?php echo h($success); ?></div><?php endif; ?> <?php if ($error): ?><div class="alert alert-danger"><?php echo h($error); ?></div><?php endif; ?> <!-- Filters --> <div class="section-card p-3 mb-4"> <form class="row g-2 align-items-end" method="get"> <div class="col-lg-4"> <label class="form-label">Search</label> <input type="text" class="form-control" name="q" placeholder="Search title" value="<?php echo h($q); ?>"> </div> <div class="col-lg-3"> <label class="form-label">Category</label> <select name="category" class="form-select"> <option value="">All</option> <?php foreach($cats as $c): ?> <option value="<?php echo h($c); ?>" <?php echo $cat_filt===$c?'selected':''; ?>><?php echo h($c); ?></option> <?php endforeach; ?> </select> </div> <div class="col-md-2"> <label class="form-label">From</label> <input type="text" class="form-control" name="from" placeholder="dd-mm-yyyy" value="<?php echo h($from_raw); ?>"> </div> <div class="col-md-2"> <label class="form-label">To</label> <input type="text" class="form-control" name="to" placeholder="dd-mm-yyyy" value="<?php echo h($to_raw); ?>"> </div> <div class="col-md-1 d-flex gap-2"> <button class="btn btn-primary w-100" type="submit">Search</button> <a href="manage_videos.php" class="btn btn-light-outline">Reset</a> </div> <?php if(!$hasCreatedAt): ?> <div class="col-12 text-muted" style="font-size:12px">Note: Your table has no <code>created_at</code>; date filters are ignored.</div> <?php endif; ?> </form> </div> <!-- Add New Video --> <div class="section-card p-3 mb-4"> <div class="fs-5 fw-bold mb-2">โ Add New Video</div> <form method="POST" id="createForm"> <input type="hidden" name="action" value="create"> <div class="row g-3"> <div class="col-md-4"> <label class="form-label">Video Title <span class="label-req">*</span></label> <input type="text" name="title" class="form-control" required> </div> <div class="col-md-4"> <label class="form-label">Video URL (YouTube / Drive / Vimeo) <span class="label-req">*</span></label> <input type="text" name="video_url" id="video_url" class="form-control" placeholder="https://..." required> </div> <div class="col-md-3"> <label class="form-label">Category (optional)</label> <input type="text" name="category" class="form-control" list="catList" placeholder="e.g., Events"> <datalist id="catList"> <?php foreach($cats as $c): ?><option value="<?php echo h($c); ?>"><?php echo h($c); ?></option><?php endforeach; ?> </datalist> </div> <div class="col-md-1 d-flex align-items-end"> <button type="submit" class="btn btn-primary w-100">Add</button> </div> </div> <!-- Live thumbnail preview --> <div class="mt-3" id="previewBox" style="display:none;"> <div class="small text-muted mb-1">Preview thumbnail (auto):</div> <img id="thumbPreview" src="" style="max-width:320px;border-radius:10px;"> </div> </form> </div> <!-- Bulk + Grid --> <form method="POST" id="bulkForm"> <input type="hidden" name="action" value="bulk_delete"> <div class="d-flex justify-content-between align-items-center mb-2"> <div class="sel-all"><input type="checkbox" id="selectAll"> <label for="selectAll" class="ms-1">Select all on this page</label></div> <button type="submit" class="btn btn-del" onclick="return confirm('Delete selected videos?')">Bulk Delete</button> </div> <div class="grid-videos"> <?php if($list && $list->num_rows): while($row = $list->fetch_assoc()): $id=(int)$row['id']; $title=h($row['title']); $url=$row['video_url']; $cat=h($row['category']); $date = ($hasCreatedAt && !empty($row['created_at'])) ? h(date('d M Y', strtotime($row['created_at']))) : ''; $thumb = thumb_url($url); $embed = embed_url($url); ?> <div class="card-video"> <div class="thumb"> <?php if ($thumb): ?> <img loading="lazy" src="<?php echo h($thumb); ?>" alt="<?php echo $title; ?>"> <?php else: ?> <img loading="lazy" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 450'%3E%3Crect width='100%25' height='100%25' fill='%23000'/%3E%3C/svg%3E" alt="<?php echo $title; ?>"> <?php endif; ?> <button type="button" class="play" data-bs-toggle="modal" data-bs-target="#playModal" data-embed="<?php echo h($embed); ?>">Play โถ</button> </div> <div class="card-body"> <div class="title" title="<?php echo $title; ?>"><?php echo $title; ?></div> <div class="meta"><?php echo $date; ?><?php echo $cat? " โข ".$cat : ""; ?></div> <div class="d-flex justify-content-center gap-2 mt-2"> <button type="button" class="btn-edit" data-bs-toggle="modal" data-bs-target="#editModal" data-id="<?php echo $id; ?>" data-title="<?php echo $title; ?>" data-url="<?php echo h($url); ?>" data-cat="<?php echo $cat; ?>">Edit</button> <a href="manage_videos.php?delete=<?php echo $id; ?>" class="btn-del" onclick="return confirm('Delete this video?')">Delete</a> <div class="form-check ms-1"><input class="form-check-input item-check" type="checkbox" name="ids[]" value="<?php echo $id; ?>"></div> </div> </div> </div> <?php endwhile; else: ?> <div class="text-center text-muted py-4" style="grid-column:1/-1;">No videos found.</div> <?php endif; ?> </div> </form> <!-- Pagination --> <?php if ($pages>1): ?> <div class="mt-3 pagination"> <?php $base = 'manage_videos.php?'.http_build_query(array_merge($_GET, ['page'=>null])); ?> <?php for($p=1;$p<=$pages;$p++): $link = $base.'page='.$p; ?> <a class="page-link <?php echo $p===$page?'active':''; ?>" href="<?php echo h($link); ?>"><?php echo $p; ?></a> <?php endfor; ?> </div> <?php endif; ?> </div> <!-- Play Modal --> <div class="modal fade" id="playModal" tabindex="-1" aria-hidden="true"> <div class="modal-dialog modal-xl modal-dialog-centered"> <div class="modal-content"> <div class="modal-body p-0"> <div style="position:relative;padding-top:56.25%;"> <iframe id="playerFrame" src="" allowfullscreen style="position:absolute;inset:0;width:100%;height:100%;border:0;"></iframe> </div> </div> <div class="modal-footer"> <button class="btn btn-outline-secondary" data-bs-dismiss="modal">Close</button> </div> </div> </div> </div> <!-- Edit Modal --> <div class="modal fade" id="editModal" tabindex="-1" aria-hidden="true"> <div class="modal-dialog"> <form class="modal-content" method="POST"> <input type="hidden" name="action" value="update"> <input type="hidden" name="id" id="edit-id"> <div class="modal-header"> <h5 class="modal-title">Edit Video</h5> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <div class="modal-body"> <label class="form-label">Title</label> <input type="text" class="form-control mb-2" name="title" id="edit-title" required> <label class="form-label">Video URL</label> <input type="text" class="form-control mb-2" name="video_url" id="edit-url" required> <label class="form-label">Category</label> <input type="text" class="form-control" name="category" id="edit-cat" list="catList"> </div> <div class="modal-footer"> <button class="btn btn-outline-secondary" type="button" data-bs-dismiss="modal">Cancel</button> <button class="btn btn-primary" type="submit">Save Changes</button> </div> </form> </div> </div> <script> // Live thumbnail preview const urlInput = document.getElementById('video_url'); const pBox = document.getElementById('previewBox'); const pImg = document.getElementById('thumbPreview'); function computeThumb(u){ if(!u) return ''; const yt = u.match(/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([A-Za-z0-9_\-]{6,})/); if (yt) return 'https://img.youtube.com/vi/'+yt[1]+'/hqdefault.jpg'; const gd = u.match(/drive\.google\.com\/(?:file\/d\/|open\?id=)([^\/&\?]+)/); if (gd) return 'https://drive.google.com/thumbnail?id='+gd[1]; return ''; } urlInput?.addEventListener('input', e=>{ const t = computeThumb(e.target.value.trim()); if (t){ pImg.src=t; pBox.style.display='block'; } else { pBox.style.display='none'; } }); // Select all document.getElementById('selectAll')?.addEventListener('change', e=>{ document.querySelectorAll('.item-check').forEach(cb=> cb.checked = e.target.checked); }); // Play modal const playModal = document.getElementById('playModal'); playModal.addEventListener('show.bs.modal', e=>{ document.getElementById('playerFrame').src = e.relatedTarget.getAttribute('data-embed'); }); playModal.addEventListener('hidden.bs.modal', ()=>{ document.getElementById('playerFrame').src=''; }); // Edit modal fill const editModal = document.getElementById('editModal'); editModal.addEventListener('show.bs.modal', e=>{ const b = e.relatedTarget; document.getElementById('edit-id').value = b.getAttribute('data-id'); document.getElementById('edit-title').value = b.getAttribute('data-title'); document.getElementById('edit-url').value = b.getAttribute('data-url'); document.getElementById('edit-cat').value = b.getAttribute('data-cat') || ''; }); // dd-mm-yyyy mask document.querySelectorAll('input[name="from"],input[name="to"]').forEach(inp=>{ inp.addEventListener('input', e=>{ e.target.value = e.target.value.replace(/[^\d-]/g,'') .replace(/^(\d{2})(\d)/,'$1-$2') .replace(/^(\d{2}-\d{2})(\d)/,'$1-$3'); }); }); </script> <?php include 'includes/footer.php'; ?>
Upload File
Create Folder