X7ROOT File Manager
Current Path:
/home/u126090504/domains/sketkaranjia.com/public_html/admin
home
/
u126090504
/
domains
/
sketkaranjia.com
/
public_html
/
admin
/
📁
..
📄
achievers.php
(21.44 KB)
📄
achv_cat_manage.php
(7.99 KB)
📄
achv_edit.php
(9.58 KB)
📄
achv_list.php
(8.08 KB)
📄
achv_upload.php
(13.39 KB)
📄
admin-academic-calendar.php
(20.41 KB)
📄
admin-public-disclosure.php
(18.36 KB)
📄
admissions.php
(28.76 KB)
📄
admissions_error.log
(56 KB)
📁
assets
📄
banners.php
(9.78 KB)
📄
branding_settings.php
(5.93 KB)
📄
change_password.php
(3.01 KB)
📄
class_master.php
(4.32 KB)
📄
contacts.php
(3.83 KB)
📄
dashboard.php
(27.76 KB)
📄
downloads.php
(4.91 KB)
📄
edit_faculty.php
(6.85 KB)
📄
events.php
(920 B)
📄
export_franchise.php
(930 B)
📄
faculty.php
(8.36 KB)
📄
fees_list.php
(8.48 KB)
📄
fees_upload.php
(6.19 KB)
📄
forgot_password.php
(5.76 KB)
📄
franchise.php
(7.28 KB)
📄
gallery.php
(3.08 KB)
📄
grievance-update.php
(1003 B)
📄
grievance-view.php
(8.51 KB)
📄
grievances.php
(9.55 KB)
📄
homework_add.php
(5.98 KB)
📄
homework_edit.php
(9.39 KB)
📄
homework_list.php
(2.24 KB)
📁
img
📁
includes
📄
index.php
(82 B)
📄
login.php
(13.47 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)
📄
managing-committee.php
(13.64 KB)
📄
master_menu.php
(5.75 KB)
📄
master_menu_debug.php
(3.73 KB)
📄
new_password.php
(3.9 KB)
📄
non_academic_achievers.php
(21.2 KB)
📄
notice.php
(15.52 KB)
📄
notice_error.log
(38.45 KB)
📄
notices.php
(8.24 KB)
📄
payments.php
(14.96 KB)
📁
phpmailer
📄
popup.php
(14.07 KB)
📄
reset_password.php
(2.27 KB)
📄
section_master.php
(6.59 KB)
📄
sections_by_class.php
(346 B)
📄
secure_session.php
(1000 B)
📄
settings.php
(8.34 KB)
📄
student_photo_update.php
(1.8 KB)
📄
subject_master.php
(6.16 KB)
📄
submit-grievance.php
(4.97 KB)
📄
testimonials.php
(15.15 KB)
📄
update_status.php
(1.66 KB)
📄
upi_settings.php
(1.52 KB)
Editing: banners.php
<?php // admin/banner_manager.php include 'secure_session.php'; include 'includes/auth.php'; require_once '../config.php'; include 'includes/header.php'; $allowedTypes = ['jpg','jpeg','png']; $maxSize = 1 * 1024 * 1024; // 1MB $success = $error = ""; // CSRF Token if (empty($_SESSION['csrf'])) { $_SESSION['csrf'] = bin2hex(random_bytes(32)); } function csrf_ok() { return isset($_POST['csrf'], $_SESSION['csrf']) && hash_equals($_SESSION['csrf'], $_POST['csrf']); } // ---------- Add Banner ---------- if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_banner'])) { if (!csrf_ok()) die("❌ CSRF token mismatch."); $position = intval($_POST['position'] ?? 0); if (!empty($_FILES['bfile']['name'])) { $targetDir = __DIR__ . "/../uploads/banners/"; if (!is_dir($targetDir)) mkdir($targetDir, 0755, true); $ext = strtolower(pathinfo($_FILES['bfile']['name'], PATHINFO_EXTENSION)); if (!in_array($ext, $allowedTypes)) $error = "❌ Only JPG/PNG allowed."; elseif ($_FILES['bfile']['size'] > $maxSize) $error = "❌ File too large (max 1MB)."; elseif (!is_uploaded_file($_FILES['bfile']['tmp_name'])) $error = "❌ Invalid upload."; else { $safeName = time() . "_" . bin2hex(random_bytes(4)) . "." . $ext; if (move_uploaded_file($_FILES['bfile']['tmp_name'], $targetDir . $safeName)) { $stmt = $conn->prepare("INSERT INTO bannertab (imgfile, position) VALUES (?, ?)"); $stmt->bind_param("si", $safeName, $position); $stmt->execute(); $stmt->close(); $success = "✅ Banner added successfully."; } else $error = "❌ Upload failed."; } } else $error = "⚠️ Please choose an image."; } // ---------- Update Position ---------- if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['update_position'])) { if (!csrf_ok()) die("❌ CSRF token mismatch."); $id = intval($_POST['id']); $pos = intval($_POST['position']); $stmt = $conn->prepare("UPDATE bannertab SET position=? WHERE id=?"); $stmt->bind_param("ii", $pos, $id); $stmt->execute(); $stmt->close(); $success = "✅ Position updated."; } // ---------- Delete ---------- if (isset($_GET['delete'])) { if (!isset($_GET['csrf']) || !hash_equals($_SESSION['csrf'], $_GET['csrf'])) die("❌ CSRF token mismatch."); $id = intval($_GET['delete']); $stmt = $conn->prepare("SELECT imgfile FROM bannertab WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $stmt->bind_result($old); $stmt->fetch(); $stmt->close(); if ($old && file_exists(__DIR__ . "/../uploads/banners/" . $old)) @unlink(__DIR__ . "/../uploads/banners/" . $old); $stmt = $conn->prepare("DELETE FROM bannertab WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $stmt->close(); $success = "🗑️ Banner deleted."; } ?> <style> :root { --brand:#e30613; --dark:#0a0a0a; --bg:#f6f7f9; --ring:rgba(227,6,19,.18); } body { background: var(--bg); font-family: "Poppins", sans-serif; } .page-wrap { max-width: 1150px; margin: 40px auto; } .page-card { background:#fff; border-radius:1rem; box-shadow:0 8px 25px rgba(0,0,0,.06); border:1px solid #eee; } .page-head { border-bottom:3px solid var(--brand); padding:1rem 1.25rem .75rem; display:flex; justify-content:space-between; align-items:center; } .page-head h3 { margin:0; color:var(--dark); font-weight:600; } .alert { border-radius:.75rem; font-weight:500; } .btn-brand { background: var(--brand); color:#fff; font-weight:600; border:none; border-radius:.5rem; transition:all .25s ease; } .btn-brand:hover { background:#b9040f; box-shadow:0 6px 18px rgba(227,6,19,.35); } .form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem var(--ring); } /* Upload */ .upload-card { border:2px dashed rgba(0,0,0,.15); border-radius:1rem; background:#fafafa; text-align:center; padding:2rem; transition: all .3s ease; } .upload-card:hover { background:#fff5f5; border-color:var(--brand); } #fileName { font-size:.9rem; color:#6b7280; } /* Grid */ .grid { display:grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap:1rem; margin-top:1.5rem; } .banner-item { background:#fff; border-radius:.75rem; box-shadow:0 3px 12px rgba(0,0,0,.06); overflow:hidden; transition: all .3s ease; position:relative; } .banner-item:hover { transform: translateY(-5px); box-shadow:0 6px 22px rgba(227,6,19,.25); } .banner-item img { width:100%; height:150px; object-fit:cover; } .badge-id { position:absolute; top:8px; left:8px; background:var(--brand); color:#fff; font-size:.75rem; padding:.2rem .45rem; border-radius:.3rem; } .pos-form { padding:.5rem .75rem; background:#fff; border-top:1px solid #eee; display:flex; justify-content:space-between; align-items:center; gap:.5rem; flex-wrap:wrap; } .pos-form input[type=number] { width:70px; text-align:center; } .actions { display:flex; gap:.5rem; } .btn-light-outline { background:#fff; border:1px solid #ddd; } </style> <div class="page-wrap"> <div class="page-card"> <div class="page-head"> <h3>🖼 Banner Manager</h3> </div> <div class="p-4"> <?php if ($success): ?><div class="alert alert-success mb-3"><?= $success ?></div><?php endif; ?> <?php if ($error): ?><div class="alert alert-danger mb-3"><?= $error ?></div><?php endif; ?> <!-- Upload Form --> <form method="POST" enctype="multipart/form-data" class="mb-4" id="uploadForm"> <input type="hidden" name="csrf" value="<?= htmlspecialchars($_SESSION['csrf']); ?>"> <div class="upload-card" id="dropZone"> <div class="mb-2 fw-semibold text-danger">Click or Drop Banner Image (JPG/PNG ≤ 1MB)</div> <!-- Visible choose button --> <div class="d-flex justify-content-center gap-2"> <button type="button" id="chooseBtn" class="btn btn-light-outline">Choose Image</button> <input type="file" id="bfile" name="bfile" accept=".jpg,.jpeg,.png" class="form-control" style="max-width:360px;"> </div> <div id="fileName" class="mt-2">No file chosen</div> <div class="row justify-content-center mt-3"> <div class="col-md-4"> <input type="number" name="position" class="form-control text-center" min="0" value="0" placeholder="Display Position"> </div> </div> <button type="submit" name="add_banner" class="btn btn-brand mt-3">Upload Banner</button> </div> </form> <!-- Banner Grid --> <h5 class="fw-semibold mb-3">📋 Existing Banners</h5> <div class="grid"> <?php $res = $conn->query("SELECT * FROM bannertab ORDER BY position ASC, id DESC"); if ($res && $res->num_rows > 0): while ($row = $res->fetch_assoc()): $id = (int)$row['id']; $src = "../uploads/banners/" . htmlspecialchars($row['imgfile']); ?> <div class="banner-item"> <span class="badge-id">#<?= $id ?></span> <img src="<?= $src ?>" alt="banner" onclick="openLightbox('<?= $src ?>')" style="cursor:zoom-in;"> <!-- Inline Position Update + Visible Delete --> <form method="POST" class="pos-form"> <input type="hidden" name="csrf" value="<?= htmlspecialchars($_SESSION['csrf']); ?>"> <input type="hidden" name="id" value="<?= $id ?>"> <div class="d-flex align-items-center gap-2"> <small class="text-muted">Position</small> <input type="number" name="position" class="form-control form-control-sm" value="<?= (int)$row['position'] ?>" min="0"> <button name="update_position" class="btn btn-sm btn-outline-danger">Save</button> </div> <div class="actions"> <a href="<?= $src ?>" target="_blank" class="btn btn-sm btn-light-outline">View</a> <a href='?delete=<?= $id ?>&csrf=<?= htmlspecialchars($_SESSION["csrf"]); ?>' class='btn btn-sm btn-danger' onclick='return confirm("Delete this banner?")'>Delete</a> </div> </form> </div> <?php endwhile; else: ?> <div class="text-center text-muted">No banners uploaded yet.</div> <?php endif; ?> </div> </div> </div> </div> <!-- Tiny lightbox --> <div id="lb" style="display:none; position:fixed; inset:0; background:rgba(0,0,0,.8); z-index:9999; align-items:center; justify-content:center;"> <img id="lbimg" src="" style="max-width:92%; max-height:92%; border-radius:.5rem; box-shadow:0 10px 30px rgba(0,0,0,.5);"> </div> <script> // Drag & drop + choose button + filename const drop = document.getElementById('dropZone'); const input = document.getElementById('bfile'); const chooseBtn = document.getElementById('chooseBtn'); const fileName = document.getElementById('fileName'); chooseBtn.addEventListener('click', () => input.click()); input.addEventListener('change', () => { fileName.textContent = input.files[0] ? input.files[0].name : 'No file chosen'; }); ['dragover','dragenter'].forEach(ev => drop.addEventListener(ev, e => { e.preventDefault(); drop.style.borderColor = 'var(--brand)'; }) ); ['dragleave','drop'].forEach(ev => drop.addEventListener(ev, e => { e.preventDefault(); drop.style.borderColor = 'rgba(0,0,0,.15)'; }) ); drop.addEventListener('drop', e => { if (e.dataTransfer.files.length) { input.files = e.dataTransfer.files; fileName.textContent = input.files[0].name; } }); // simple lightbox function openLightbox(src){ const lb = document.getElementById('lb'); const img = document.getElementById('lbimg'); img.src = src; lb.style.display='flex'; } document.getElementById('lb').addEventListener('click', function(){ this.style.display='none'; }); </script> <?php include 'includes/footer.php'; ?>
Upload File
Create Folder