X7ROOT File Manager
Current Path:
/home/u126090504/domains/svmbaripada.org.in/public_html/admin
home
/
u126090504
/
domains
/
svmbaripada.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: admin-academic-calendar.php
<?php /******************************** * admin-academic-calendar.php * Academic Calendar: CRUD + Search (2-column forms) ********************************/ include 'secure_session.php'; include 'includes/auth.php'; require_once '../config.php'; // mysqli $conn include 'includes/header.php'; /* ----------------- CONFIG ----------------- */ $relDir = 'uploads/academic_calendar/'; $absDir = realpath(__DIR__ . '/..') . '/' . $relDir; $maxSize = 8 * 1024 * 1024; // 8MB $allowedExt = ['pdf','jpg','jpeg','png']; // allow PDF or image $success = $error = ''; if (!is_dir($absDir)) { @mkdir($absDir, 0755, true); } /* ----------------- HELPERS ----------------- */ function sanitize_name($n) { $n = preg_replace('/[^a-zA-Z0-9\.\-_]/','_', $n); return preg_replace('/\.+/','.', $n); } function detect_mime_ok($tmp, $ext) { if (!is_file($tmp)) return false; $f = finfo_open(FILEINFO_MIME_TYPE); $m = finfo_file($f, $tmp); finfo_close($f); $map = [ 'pdf' => 'application/pdf', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'png' => 'image/png' ]; return isset($map[$ext]) && ($m === $map[$ext]); } function parse_date_yyyy_mm_dd($in) { $in = trim((string)$in); if ($in === '') return null; // accept dd-mm-yyyy or yyyy-mm-dd 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)) { [$y,$m,$d] = explode('-', $in); if (checkdate((int)$m, (int)$d, (int)$y)) return $in; } return null; } /* ----------------- ADD ----------------- */ if ($_SERVER['REQUEST_METHOD']==='POST' && ($_POST['action']??'')==='add') { $title = trim($_POST['title'] ?? ''); $year = trim($_POST['academic_year'] ?? ''); $status = (($_POST['status']??'active')==='inactive') ? 'inactive' : 'active'; $sort = (int)($_POST['sort_order'] ?? 0); if ($title==='' || $year==='') $error = 'Title & Academic Year required.'; if (!$error && (!isset($_FILES['afile']) || $_FILES['afile']['error']!==UPLOAD_ERR_OK)) { $error = 'Please choose a file.'; } if (!$error) { $ext = strtolower(pathinfo($_FILES['afile']['name'], PATHINFO_EXTENSION)); if (!in_array($ext, $allowedExt)) $error = 'Only PDF/JPG/PNG allowed.'; elseif ($_FILES['afile']['size'] > $maxSize) $error = 'File too large (max 8MB).'; elseif (!detect_mime_ok($_FILES['afile']['tmp_name'], $ext)) $error = 'Invalid file.'; } if (!$error) { $base = sanitize_name(pathinfo($_FILES['afile']['name'], PATHINFO_FILENAME)); $new = time().'_'.bin2hex(random_bytes(4)).'_'.$base.'.'.$ext; if (move_uploaded_file($_FILES['afile']['tmp_name'], $absDir.$new)) { $rel = $relDir.$new; $st = $conn->prepare("INSERT INTO academic_calendars(title, academic_year, file_path, status, sort_order) VALUES(?,?,?,?,?)"); $st->bind_param("ssssi", $title, $year, $rel, $status, $sort); $st->execute(); $success = '✅ Calendar added.'; } else $error = 'Upload failed.'; } } /* ----------------- DELETE ----------------- */ if (isset($_GET['delete'])) { $id = (int)$_GET['delete']; if ($id>0) { $q = $conn->prepare("SELECT file_path FROM academic_calendars WHERE id=?"); $q->bind_param("i",$id); $q->execute(); $q->bind_result($old); $q->fetch(); $q->close(); if ($old) { $abs = realpath(__DIR__ . '/..') . '/' . $old; if (is_file($abs)) @unlink($abs); } $d = $conn->prepare("DELETE FROM academic_calendars WHERE id=?"); $d->bind_param("i",$id); $d->execute(); $success = '⚠️ Calendar deleted.'; } } /* ----------------- TOGGLE STATUS ----------------- */ if (isset($_GET['toggle'])) { $id = (int)$_GET['toggle']; $q = $conn->prepare("UPDATE academic_calendars SET status=IF(status='active','inactive','active') WHERE id=?"); $q->bind_param("i",$id); $q->execute(); $success = '🔁 Status changed.'; } /* ----------------- UPDATE (EDIT) ----------------- */ if ($_SERVER['REQUEST_METHOD']==='POST' && ($_POST['action']??'')==='update') { $id = (int)($_POST['id'] ?? 0); $title = trim($_POST['title'] ?? ''); $year = trim($_POST['academic_year'] ?? ''); $status = (($_POST['status']??'active')==='inactive') ? 'inactive' : 'active'; $sort = (int)($_POST['sort_order'] ?? 0); $replace = isset($_POST['replace_file']); if ($id<=0) $error = 'Invalid record.'; if ($title==='' || $year==='') $error = 'Title & Academic Year required.'; if (!$error) { $q = $conn->prepare("SELECT file_path FROM academic_calendars WHERE id=?"); $q->bind_param("i",$id); $q->execute(); $q->bind_result($old); $q->fetch(); $q->close(); $rel = $old; if ($replace && isset($_FILES['afile']) && $_FILES['afile']['error']===UPLOAD_ERR_OK) { $ext = strtolower(pathinfo($_FILES['afile']['name'], PATHINFO_EXTENSION)); if (!in_array($ext,$allowedExt)) $error='Only PDF/JPG/PNG allowed.'; elseif ($_FILES['afile']['size'] > $maxSize) $error='File too large (max 8MB).'; elseif (!detect_mime_ok($_FILES['afile']['tmp_name'],$ext)) $error='Invalid file.'; else { $base = sanitize_name(pathinfo($_FILES['afile']['name'], PATHINFO_FILENAME)); $new = time().'_'.bin2hex(random_bytes(4)).'_'.$base.'.'.$ext; if (move_uploaded_file($_FILES['afile']['tmp_name'], $absDir.$new)) { $rel = $relDir.$new; if ($old) { $oldAbs = realpath(__DIR__ . '/..') . '/' . $old; if (is_file($oldAbs)) @unlink($oldAbs); } } else $error = 'Upload failed.'; } } } if (!$error) { $u = $conn->prepare("UPDATE academic_calendars SET title=?, academic_year=?, file_path=?, status=?, sort_order=? WHERE id=?"); $u->bind_param("ssssii", $title, $year, $rel, $status, $sort, $id); $u->execute(); $success = '✏️ Changes saved.'; } } /* ----------------- SEARCH / FILTERS ----------------- */ $kw = trim($_GET['q'] ?? ''); $status = trim($_GET['status'] ?? 'all'); $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[] = "(title LIKE CONCAT('%',?,'%') OR academic_year LIKE CONCAT('%',?,'%'))"; $params[] = $kw; $types.='s'; $params[] = $kw; $types.='s'; } if ($status === 'active' || $status === 'inactive') { $where[] = "status = ?"; $params[] = $status; $types.='s'; } 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 sort_order ASC, created_at DESC"; $sql_list = "SELECT * FROM academic_calendars $whereSql $orderSql"; $sql_count = "SELECT COUNT(*) FROM academic_calendars"; $sql_count_f= "SELECT COUNT(*) FROM academic_calendars $whereSql"; $totalAll = 0; if ($rs = $conn->query($sql_count)) { $row = $rs->fetch_row(); $totalAll = (int)$row[0]; } $totalFiltered = 0; $list = null; if ($where) { $stmtC = $conn->prepare($sql_count_f); if ($types !== '') { $stmtC->bind_param($types, ...$params); } $stmtC->execute(); $stmtC->bind_result($cnt); $stmtC->fetch(); $stmtC->close(); $totalFiltered = (int)$cnt; $stmtL = $conn->prepare($sql_list); if ($types !== '') { $stmtL->bind_param($types, ...$params); } $stmtL->execute(); $list = $stmtL->get_result(); } else { $totalFiltered = $totalAll; $list = $conn->query($sql_list); } ?> <style> :root{ --brand:#e0332f; /* red accent */ --ink:#202427; /* headings */ --text:#3a3f44; /* body */ --muted:#6f7780; --line:#eef0f3; --chip:#f6f7f9; --success:#28a745; --input-bg:#ffffff; --shadow:0 8px 24px rgba(20,28,36,.06); } .page-wrap{ padding: 18px 10px 40px; } .title-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; } .page-title{ margin:0; font-weight:700; color:var(--ink); letter-spacing:.2px; display:flex; align-items:center; gap:10px; } .page-title .emoji{ width:36px; height:36px; display:inline-grid; place-items:center; border-radius:10px; background:rgba(224,51,47,.08); font-size:18px; } .underline{ height:4px; width:100%; background:linear-gradient(90deg,var(--brand),transparent 50%); border-radius:4px; margin:8px 0 20px; } .chip{ background:var(--chip); border:1px solid var(--line); color:var(--ink); padding:6px 10px; border-radius:999px; font-size:.86rem; font-weight:600; } .chip .k{ color:#111; } .chip.brand{ border-color:rgba(224,51,47,.25); } .btn-pill{ border-radius:999px !important; padding:.45rem .95rem !important; font-weight:700; } /* Search bar */ .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 .6fr .6fr .6fr auto; gap:12px; } .search-grid .form-control, .search-grid .custom-select{ border-radius:10px; border:1px solid var(--line); background:var(--input-bg); } .search-actions{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; } /* Cards & Forms */ .card{ border:1px solid var(--line); border-radius:14px; overflow:hidden; box-shadow:var(--shadow); } .card-header{ background:#fff; border-bottom:1px solid var(--line); font-weight:800; color:var(--ink); } label{ font-weight:700; color:var(--text); } .form-control,.custom-select, select.form-control{ border-radius:10px; border:1px solid var(--line); } .muted{ color:var(--muted); font-size:.9rem; } /* 2-column grid */ .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 */ .table-wrap{ background:#fff; border:1px solid var(--line); border-radius:14px; overflow:hidden; box-shadow:var(--shadow); } .table{ margin:0; } .table thead th{ background:#fafbfc; color:#4b5157; font-weight:800; border-bottom:1px solid var(--line); } .table tbody td{ vertical-align:middle; color:var(--text); } .badge{ border-radius:999px; padding:.42rem .7rem; font-weight:800; } .badge-success{ background:rgba(40,167,69,.12); color:#237a3b; } .badge-secondary{ background:#eef1f5; color:#5b6270; } /* Modal polish */ .modal-content{ border-radius:16px; } .modal-header{ border-bottom:1px solid var(--line); } .modal-footer{ border-top:1px solid var(--line); } /* Responsive */ @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> Admission Applications / <span style="color:var(--brand)">Academic Calendar</span> </h3> <div class="search-actions"> <span class="chip brand">Total: <span class="k"><?= (int)$totalFiltered ?></span></span> <?php $exportQs = http_build_query(['q'=>$kw,'status'=>$status,'from'=>$fromUi,'to'=>$toUi]); ?> <a href="export-academic-calendar.php?<?= htmlspecialchars($exportQs) ?>" class="chip" title="Export CSV">Export: CSV</a> <button type="button" class="btn btn-light btn-pill">List View</button> </div> </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" novalidate> <input type="text" name="q" value="<?= htmlspecialchars($kw) ?>" class="form-control" placeholder="Name, Title, Year..."> <select name="status" class="custom-select"> <option value="all" <?= $status==='all'?'selected':'' ?>>All</option> <option value="active" <?= $status==='active'?'selected':'' ?>>Active</option> <option value="inactive" <?= $status==='inactive'?'selected':'' ?>>Inactive</option> </select> <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 class="search-actions"> <button class="btn btn-primary btn-pill" type="submit">Search</button> <a class="btn btn-outline-secondary btn-pill" href="admin-academic-calendar.php">Reset</a> </div> </form> <div class="muted mt-2">Tip: Filter by date range or status to narrow down records.</div> </div> <!-- ============== ADD NEW (2-COLUMN) ============== --> <div class="card mb-4 two-col"> <div class="card-header">➕ Add New Calendar</div> <div class="card-body"> <form method="POST" enctype="multipart/form-data" autocomplete="off" novalidate> <input type="hidden" name="action" value="add"> <div class="form-grid"> <div> <label>Title <span class="text-danger">*</span></label> <input type="text" name="title" class="form-control" required placeholder="e.g., Academic Calendar – 2024-25" maxlength="180"> <small class="muted">Use a clear, descriptive title.</small> </div> <div> <label>Academic Year <span class="text-danger">*</span></label> <input type="text" name="academic_year" class="form-control" placeholder="2024-25" required maxlength="20"> </div> <div> <label>Sort</label> <input type="number" name="sort_order" class="form-control" value="0"> <small class="muted">Lower shows first.</small> </div> <div> <label>Status</label> <select name="status" class="form-control"> <option value="active" selected>Active</option> <option value="inactive">Inactive</option> </select> </div> <div class="span-2"> <label>File (PDF/JPG/PNG) <span class="text-danger">*</span></label> <input type="file" name="afile" class="form-control" accept=".pdf,.jpg,.jpeg,.png" required> <small class="muted d-block mt-1">Max 8MB. Keep file name short & meaningful.</small> </div> </div> <button type="submit" class="btn btn-primary btn-pill mt-3">Upload</button> </form> </div> </div> <!-- ============== LIST ============== --> <?php // ... keep code above untouched // ---------- 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">Title</th> <th>Academic Year</th> <th>File</th> <th>Status</th> <th>Order</th> <th>Actions</th> </tr> </thead> <tbody> <?php $modals = []; // collect modals and print after table (not inside <table>) if($list && $list->num_rows): while($r = $list->fetch_assoc()): $fileUrl = '../'.htmlspecialchars($r['file_path']); ob_start(); ?> <tr> <td><?= (int)$r['id'] ?></td> <td class="text-left" style="min-width:240px;"> <strong><?= htmlspecialchars($r['title']) ?></strong> <?php if(!empty($r['created_at'])): ?> <div class="muted small">Added: <?= htmlspecialchars($r['created_at']) ?></div> <?php endif; ?> </td> <td><?= htmlspecialchars($r['academic_year']) ?></td> <td> <?php if(!empty($r['file_path'])): ?> <a href="<?= $fileUrl ?>" target="_blank" class="btn btn-sm btn-outline-secondary btn-pill">View</a> <?php else: ?> <span class="text-danger">Missing</span> <?php endif; ?> </td> <td> <span class="badge <?= $r['status']==='active'?'badge-success':'badge-secondary' ?>"> <?= htmlspecialchars($r['status']) ?> </span> <a class="btn btn-link btn-sm btn-pill" href="?toggle=<?= (int)$r['id'] ?>">Status</a> </td> <td><?= (int)$r['sort_order'] ?></td> <td> <!-- NOTE: Bootstrap 5 attributes --> <button type="button" class="btn btn-info btn-sm btn-pill" data-bs-toggle="modal" data-bs-target="#edit<?= (int)$r['id'] ?>"> Edit </button> <a href="?delete=<?= (int)$r['id'] ?>" class="btn btn-danger btn-sm btn-pill" onclick="return confirm('Delete this item?')">Delete</a> </td> </tr> <?php // Build modal HTML (Bootstrap 5) OUTSIDE table $mid = (int)$r['id']; $modalHtml = ' <div class="modal fade" id="edit'.$mid.'" tabindex="-1" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content two-col"> <form method="POST" enctype="multipart/form-data" autocomplete="off" novalidate> <input type="hidden" name="action" value="update"> <input type="hidden" name="id" value="'.$mid.'"> <div class="modal-header"> <h5 class="modal-title">✏️ Edit Calendar</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>Title <span class="text-danger">*</span></label> <input type="text" name="title" class="form-control" value="'.htmlspecialchars($r['title']).'" required maxlength="180"> </div> <div> <label>Academic Year <span class="text-danger">*</span></label> <input type="text" name="academic_year" class="form-control" value="'.htmlspecialchars($r['academic_year']).'" required maxlength="20"> </div> <div> <label>Sort</label> <input type="number" name="sort_order" class="form-control" value="'.(int)$r['sort_order'].'"> </div> <div> <label>Status</label> <select name="status" class="form-control"> <option value="active" '.($r['status']==='active'?'selected':'').'>Active</option> <option value="inactive" '.($r['status']==='inactive'?'selected':'').'>Inactive</option> </select> </div> <div class="span-2"> <label>Replace File (optional)</label> <input type="file" name="afile" class="form-control" accept=".pdf,.jpg,.jpeg,.png"> <div class="form-check mt-2"> <input class="form-check-input" type="checkbox" name="replace_file" id="rf'.$mid.'"> <label class="form-check-label" for="rf'.$mid.'">Yes, replace current file</label> </div>'; if(!empty($r['file_path'])){ $modalHtml .= '<small class="form-text text-muted">Current: <a href="'.$fileUrl.'" target="_blank">view</a></small>'; } $modalHtml .= ' </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>'; $modals[] = $modalHtml; echo ob_get_clean(); endwhile; else: ?> <tr><td colspan="7">No records found.</td></tr> <?php endif; ?> </tbody> </table> </div> </div> <!-- Print all modals outside the table --> <?= implode("\n", $modals) ?> </div> <?php include 'includes/footer.php'; ?>
Upload File
Create Folder