X7ROOT File Manager
Current Path:
/home/u126090504/domains/saiadarshainternationalschool.org.in/public_html/admin
home
/
u126090504
/
domains
/
saiadarshainternationalschool.org.in
/
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.79 KB)
📄
dashboard.php
(27.78 KB)
📄
downloads.php
(4.91 KB)
📄
edit_faculty.php
(6.85 KB)
📄
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
(6.39 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_delete.php
(543 B)
📄
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.35 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: popup.php
<?php include 'secure_session.php'; include 'includes/auth.php'; require_once '../config.php'; include 'includes/header.php'; $allowedTypes = ['jpg','jpeg','png']; $maxSize = 2 * 1024 * 1024; $success = $error = ""; /* ---------------- Add Popup ---------------- */ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_popup'])) { $link = trim($_POST['link']); $start_date = $_POST['start_date'] ?: NULL; $end_date = $_POST['end_date'] ?: NULL; $image = ''; if (!empty($_FILES['image']['name'])) { $targetDir = __DIR__ . "/../uploads/popup/"; if (!is_dir($targetDir)) mkdir($targetDir, 0755, true); $ext = strtolower(pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION)); if (!in_array($ext, $allowedTypes)) { $error = "❌ Only JPG/PNG allowed."; } elseif ($_FILES['image']['size'] > $maxSize) { $error = "❌ File too large (max 2MB)."; } else { $safeName = time() . "_" . bin2hex(random_bytes(5)) . "." . $ext; $targetFile = $targetDir . $safeName; if (move_uploaded_file($_FILES['image']['tmp_name'], $targetFile)) { $image = $safeName; } else { $error = "❌ Upload failed."; } } } else { $error = "⚠️ Please choose an image."; } if (!$error && $image) { // make others inactive $conn->query("UPDATE popup_banner SET status=0"); $stmt = $conn->prepare("INSERT INTO popup_banner (image, link, start_date, end_date, status) VALUES (?,?,?,?,1)"); $stmt->bind_param("ssss", $image, $link, $start_date, $end_date); $stmt->execute(); $success = "✅ Popup added successfully (old popups inactive)."; } } /* ---------------- Edit Popup ---------------- */ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['edit_popup'])) { $id = intval($_POST['id']); $link = trim($_POST['link']); $start_date = $_POST['start_date'] ?: NULL; $end_date = $_POST['end_date'] ?: NULL; $photo = ''; if (!empty($_FILES['image']['name'])) { $targetDir = __DIR__ . "/../uploads/popup/"; if (!is_dir($targetDir)) mkdir($targetDir, 0755, true); $ext = strtolower(pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION)); if (!in_array($ext, $allowedTypes)) { $error = "❌ Only JPG/PNG allowed."; } elseif ($_FILES['image']['size'] > $maxSize) { $error = "❌ File too large (max 2MB)."; } else { $safeName = time() . "_" . bin2hex(random_bytes(5)) . "." . $ext; $targetFile = $targetDir . $safeName; if (move_uploaded_file($_FILES['image']['tmp_name'], $targetFile)) { $photo = $safeName; // delete old $stmt = $conn->prepare("SELECT image FROM popup_banner WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $stmt->bind_result($oldFile); $stmt->fetch(); $stmt->close(); if ($oldFile && file_exists(__DIR__."/../uploads/popup/".$oldFile)) { @unlink(__DIR__."/../uploads/popup/".$oldFile); } } else { $error = "❌ Upload failed."; } } } if (!$error) { if ($photo) { $stmt = $conn->prepare("UPDATE popup_banner SET link=?, start_date=?, end_date=?, image=? WHERE id=?"); $stmt->bind_param("ssssi", $link, $start_date, $end_date, $photo, $id); } else { $stmt = $conn->prepare("UPDATE popup_banner SET link=?, start_date=?, end_date=? WHERE id=?"); $stmt->bind_param("sssi", $link, $start_date, $end_date, $id); } $stmt->execute(); $success = "✅ Popup updated successfully."; } } /* ---------------- Delete Popup ---------------- */ if (isset($_GET['delete'])) { $id = intval($_GET['delete']); $stmt = $conn->prepare("SELECT image FROM popup_banner WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $stmt->bind_result($oldFile); $stmt->fetch(); $stmt->close(); if ($oldFile && file_exists(__DIR__."/../uploads/popup/".$oldFile)) { @unlink(__DIR__."/../uploads/popup/".$oldFile); } $stmt = $conn->prepare("DELETE FROM popup_banner WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $success = "🗑️ Popup deleted."; } /* ---------------- Toggle Status ---------------- */ if (isset($_GET['toggle'])) { $id = intval($_GET['toggle']); $action = $_GET['action'] ?? 'activate'; if ($action === 'activate') { $conn->query("UPDATE popup_banner SET status=0"); $stmt = $conn->prepare("UPDATE popup_banner SET status=1 WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $success = "✅ Popup activated."; } else { $stmt = $conn->prepare("UPDATE popup_banner SET status=0 WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $success = "⚠️ Popup deactivated."; } } ?> <!-- ===== UI (same look & feel) ===== --> <style> :root{ --brand:#e30613; --ink:#0a0a0a; --panel:#f6f7f9; --ring:rgba(227,6,19,.18); } body{ background: var(--panel); } .page-wrap{ max-width:1150px; margin:40px auto; } .page-card{ background:#fff; border:1px solid #eee; border-radius:1rem; box-shadow:0 8px 26px rgba(0,0,0,.06); } .page-head{ padding:1rem 1.25rem .8rem; border-bottom:3px solid var(--brand); display:flex; justify-content:space-between; align-items:center; } .page-head h3{ margin:0; color:var(--ink); font-weight:600; } .alert{ border-radius:.75rem; font-weight:500; } .btn-brand{ background:var(--brand); color:#fff; border:none; font-weight:600; border-radius:.55rem; transition:.2s; } .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 card */ .upload-card{ border:2px dashed rgba(0,0,0,.15); border-radius:1rem; background:#fafafa; padding:1.5rem; text-align:center; transition:.25s; } .upload-card:hover{ border-color:var(--brand); background:#fff5f5; } #fileName{ color:#6b7280; font-size:.9rem; } /* Table modern */ .table-wrap{ border-radius: .9rem; overflow:hidden; box-shadow:0 6px 20px rgba(0,0,0,.05); } table thead{ background:var(--brand); color:#fff; } table tbody tr:hover{ background:rgba(227,6,19,.05); } /* Toggle */ .switch{ position:relative; display:inline-block; width:52px; height:28px; } .switch input{ display:none; } .slider{ position:absolute; inset:0; background:#d1d5db; transition:.3s; border-radius:28px; } .slider:before{ content:""; position:absolute; width:22px; height:22px; left:3px; top:3px; background:#fff; border-radius:50%; transition:.3s; box-shadow:0 1px 3px rgba(0,0,0,.2); } input:checked + .slider{ background:#22c55e; } input:checked + .slider:before{ transform:translateX(24px); } </style> <div class="page-wrap"> <div class="page-card"> <div class="page-head"> <h3>🪟 Popup 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; ?> <!-- Add Popup --> <div class="upload-card mb-4" id="dropZone"> <form method="POST" enctype="multipart/form-data" class="row g-3 justify-content-center"> <div class="col-12 text-danger fw-semibold">Click or Drop Popup Image (JPG/PNG ≤ 2MB)</div> <div class="col-md-6"> <label class="form-label">Image</label> <input type="file" name="image" id="image" class="form-control" accept=".jpg,.jpeg,.png" required> <div id="fileName" class="mt-1">No file chosen</div> </div> <div class="col-md-6"> <label class="form-label">Link (optional)</label> <input type="text" name="link" class="form-control" placeholder="https://example.com"> </div> <div class="col-md-3"> <label class="form-label">Start Date</label> <input type="date" name="start_date" class="form-control"> </div> <div class="col-md-3"> <label class="form-label">End Date</label> <input type="date" name="end_date" class="form-control"> </div> <div class="col-12 text-center"> <button type="submit" name="add_popup" class="btn btn-brand px-4">Upload Popup</button> </div> </form> </div> <!-- List Popups --> <div class="table-wrap"> <div class="table-responsive"> <table class="table table-bordered align-middle text-center m-0"> <thead> <tr><th>ID</th><th>Image</th><th>Link</th><th>Start</th><th>End</th><th>Status</th><th>Actions</th></tr> </thead> <tbody> <?php $res = $conn->query("SELECT * FROM popup_banner ORDER BY id DESC"); if ($res && $res->num_rows > 0): while ($row = $res->fetch_assoc()): $id = (int)$row['id']; $img = "<img src='../uploads/popup/".htmlspecialchars($row['image'])."' width='110' style='border-radius:.5rem'>"; $statusSwitch = ' <label class="switch"> <input type="checkbox" '.($row['status'] ? 'checked' : '').' onchange="window.location.href=\'?toggle='.$id.'&action='.( $row['status'] ? 'deactivate' : 'activate').'\'"> <span class="slider"></span> </label>'; ?> <tr> <td><?= $id ?></td> <td><?= $img ?></td> <td><?= htmlspecialchars($row['link']) ?></td> <td><?= htmlspecialchars($row['start_date']) ?></td> <td><?= htmlspecialchars($row['end_date']) ?></td> <td><?= $statusSwitch ?></td> <td> <button class="btn btn-warning btn-sm" data-bs-toggle="modal" data-bs-target="#editModal<?= $id ?>" data-toggle="modal" data-target="#editModal<?= $id ?>"> Edit </button> <a href="?delete=<?= $id ?>" class="btn btn-danger btn-sm" onclick="return confirm('Delete this popup?')">Delete</a> </td> </tr> <!-- Edit Modal --> <div class="modal fade" id="editModal<?= $id ?>" tabindex="-1" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Edit Popup #<?= $id ?></h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close" style="display:none">×</button> </div> <div class="modal-body"> <form method="POST" enctype="multipart/form-data"> <input type="hidden" name="id" value="<?= $id ?>"> <div class="mb-3"> <label class="form-label">Link</label> <input type="text" name="link" class="form-control" value="<?= htmlspecialchars($row['link']) ?>"> </div> <div class="row g-3"> <div class="col-md-6"> <label class="form-label">Start Date</label> <input type="date" name="start_date" class="form-control" value="<?= htmlspecialchars($row['start_date']) ?>"> </div> <div class="col-md-6"> <label class="form-label">End Date</label> <input type="date" name="end_date" class="form-control" value="<?= htmlspecialchars($row['end_date']) ?>"> </div> </div> <div class="mt-3"> <label class="form-label">Change Image (optional)</label> <input type="file" name="image" class="form-control" accept=".jpg,.jpeg,.png"> </div> <div class="mt-3 text-end"> <button type="submit" name="edit_popup" class="btn btn-brand">Update</button> </div> </form> </div> </div> </div> </div> <?php endwhile; else: ?> <tr><td colspan="7">No Popups Found</td></tr> <?php endif; ?> </tbody> </table> </div> </div> </div> </div> </div> <script> // drag & drop highlight + filename preview const drop = document.getElementById('dropZone'); const file = document.getElementById('image'); const fn = document.getElementById('fileName'); ['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){ file.files = e.dataTransfer.files; fn.textContent = file.files[0].name; }}); file.addEventListener('change', () => fn.textContent = file.files[0] ? file.files[0].name : 'No file chosen'); </script> <?php include 'includes/footer.php'; ?>
Upload File
Create Folder