X7ROOT File Manager
Current Path:
/home/u126090504/domains/chanakyahss.org.in/public_html/admin
home
/
u126090504
/
domains
/
chanakyahss.org.in
/
public_html
/
admin
/
📁
..
📄
achievers.php
(5.15 KB)
📄
admissions.php
(5.67 KB)
📄
banners.php
(5.86 KB)
📄
change_password.php
(3.54 KB)
📄
contacts.php
(3.83 KB)
📄
dashboard.php
(6.61 KB)
📄
downloads.php
(4.91 KB)
📄
export_franchise.php
(930 B)
📄
faculty.php
(7.22 KB)
📄
forgot_password.php
(6.52 KB)
📄
franchise.php
(7.28 KB)
📄
gallery.php
(3.08 KB)
📄
governing-body-manage.php
(9.12 KB)
📄
grievance-update.php
(1003 B)
📄
grievance-view.php
(5.32 KB)
📄
grievances.php
(5.79 KB)
📁
includes
📄
index.php
(82 B)
📄
login.php
(6.59 KB)
📄
logout.php
(102 B)
📄
manage_albums.php
(4.27 KB)
📄
manage_media.php
(3.02 KB)
📄
manage_photos.php
(6.87 KB)
📄
manage_videos.php
(3.62 KB)
📄
new_password.php
(3.9 KB)
📄
notice.php
(16.36 KB)
📄
notices.php
(8.24 KB)
📄
payments.php
(15.23 KB)
📁
phpmailer
📄
popup.php
(10.68 KB)
📄
public-disclosure.php
(7.33 KB)
📄
reset_password.php
(2.27 KB)
📄
secure_session.php
(1000 B)
📄
settings.php
(5.21 KB)
📄
submit-grievance.php
(4.97 KB)
📄
syllabus.php
(4.68 KB)
📄
testimonials.php
(10.25 KB)
📄
timetable.php
(3.68 KB)
📄
update_status.php
(1.29 KB)
📄
upi_settings.php
(1.52 KB)
Editing: syllabus.php
<?php include 'secure_session.php'; include 'includes/auth.php'; require_once '../config.php'; include 'includes/header.php'; $success = ""; $error = ""; $allowedTypes = ['pdf','doc','docx','jpg','jpeg','png']; $maxSize = 5 * 1024 * 1024; /* Add Syllabus */ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_syllabus'])) { $subject = trim($_POST['subject']); if ($subject == "") { $error = "❌ Subject is required."; } elseif (empty($_FILES['dfile']['name'])) { $error = "❌ Please select a file."; } else { $targetDir = __DIR__ . "/../uploads/syllabus/"; if (!is_dir($targetDir)) mkdir($targetDir, 0755, true); $ext = strtolower(pathinfo($_FILES['dfile']['name'], PATHINFO_EXTENSION)); if (!in_array($ext, $allowedTypes)) { $error = "❌ Only PDF, DOC, DOCX, JPG, PNG allowed."; } elseif ($_FILES['dfile']['size'] > $maxSize) { $error = "❌ Max file size is 5MB."; } else { $safeName = time() . "_" . bin2hex(random_bytes(5)) . "." . $ext; $targetFile = $targetDir . $safeName; if (move_uploaded_file($_FILES['dfile']['tmp_name'], $targetFile)) { $stmt = $conn->prepare("INSERT INTO syllabus (subject, file_name) VALUES (?, ?)"); $stmt->bind_param("ss", $subject, $safeName); if ($stmt->execute()) { $success = "✅ Syllabus uploaded successfully."; } $stmt->close(); } else { $error = "❌ Upload failed."; } } } } /* Delete Syllabus */ if (isset($_GET['delete'])) { $id = intval($_GET['delete']); $stmt = $conn->prepare("SELECT file_name FROM syllabus WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $stmt->bind_result($oldFile); $stmt->fetch(); $stmt->close(); if (!empty($oldFile)) { $filePath = __DIR__ . "/../uploads/syllabus/" . $oldFile; if (file_exists($filePath)) unlink($filePath); } $stmt = $conn->prepare("DELETE FROM syllabus WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $success = "⚠️ Syllabus deleted."; } ?> <div class="container mt-4"> <h3>📘 Manage Syllabus</h3> <?php if ($success): ?> <div class="alert alert-success"><?php echo $success; ?></div> <?php endif; ?> <?php if ($error): ?> <div class="alert alert-danger"><?php echo $error; ?></div> <?php endif; ?> <div class="card mb-4"> <div class="card-header">➕ Add Syllabus</div> <div class="card-body"> <form method="POST" enctype="multipart/form-data"> <div class="form-group"> <label>Subject</label> <input type="text" name="subject" class="form-control" required> </div> <div class="form-group"> <label>File</label> <input type="file" name="dfile" class="form-control" required> </div> <button type="submit" name="add_syllabus" class="btn btn-primary">Upload</button> </form> </div> </div> <table class="table table-bordered text-center"> <thead class="thead-dark"> <tr> <th>ID</th> <th>Subject</th> <th>File</th> <th>Action</th> </tr> </thead> <tbody> <?php $res = $conn->query("SELECT * FROM syllabus ORDER BY id DESC"); if ($res->num_rows > 0) { while ($row = $res->fetch_assoc()) { $fileUrl = "../uploads/syllabus/" . $row['file_name']; $ext = pathinfo($row['file_name'], PATHINFO_EXTENSION); if ($ext == "pdf") $icon = "<img src='../images/pd.png' style='height:40px;'>"; elseif ($ext == "doc" || $ext == "docx") $icon = "<img src='../images/doc.png' style='height:40px;'>"; elseif (in_array($ext, ['jpg','jpeg','png'])) $icon = "<img src='{$fileUrl}' style='height:40px;border-radius:5px;'>"; else $icon = "<img src='../images/file.png' style='height:40px;'>"; echo "<tr> <td>{$row['id']}</td> <td>{$row['subject']}</td> <td><a href='{$fileUrl}' target='_blank' download>{$icon}</a></td> <td> <a href='?delete={$row['id']}' class='btn btn-danger btn-sm' onclick='return confirm(\"Delete this syllabus?\")'>Delete</a> </td> </tr>"; } } ?> </tbody> </table> </div> <?php include 'includes/footer.php'; ?>
Upload File
Create Folder