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: fees_list.php
<?php // /admin/fees_list.php — MySQLi version (Single Active Logic) include 'secure_session.php'; include 'includes/auth.php'; require_once '../config.php'; include 'includes/header.php'; ini_set('display_errors', 1); error_reporting(E_ALL); // ---- CSRF token ---- if (empty($_SESSION['csrf_token'])) { $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); } $csrf = $_SESSION['csrf_token']; $errors = []; $success = ''; $dbError = ''; // DB handle check if (!isset($conn) || !($conn instanceof mysqli)) { $dbError = 'MySQLi $conn not found. Check config.php connection.'; } // --- Actions --- if ($_SERVER['REQUEST_METHOD'] === 'POST' && !$dbError) { if (!isset($_POST['csrf']) || !hash_equals($_SESSION['csrf_token'], $_POST['csrf'])) { $errors[] = 'Invalid request token. Please refresh and try again.'; } else { // Toggle Active if (isset($_POST['action']) && $_POST['action'] === 'toggle' && isset($_POST['id']) && ctype_digit($_POST['id'])) { $id = (int)$_POST['id']; // Get current status $stmt = $conn->prepare("SELECT is_active FROM fee_documents WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $res = $stmt->get_result(); $row = $res->fetch_assoc(); $stmt->close(); if ($row) { if ($row['is_active']) { // If already active, deactivate it $stmt = $conn->prepare("UPDATE fee_documents SET is_active=0 WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $stmt->close(); $success = 'Deactivated.'; } else { // Deactivate all others first $conn->query("UPDATE fee_documents SET is_active=0"); // Activate selected one $stmt = $conn->prepare("UPDATE fee_documents SET is_active=1 WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $stmt->close(); $success = 'Activated successfully.'; } } else { $errors[] = 'Record not found.'; } } // Delete if (isset($_POST['action']) && $_POST['action'] === 'delete' && isset($_POST['id']) && ctype_digit($_POST['id'])) { $id = (int)$_POST['id']; $stmt = $conn->prepare("SELECT file_path FROM fee_documents WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $res = $stmt->get_result(); $row = $res->fetch_assoc(); $stmt->close(); if ($row) { $abs = dirname(__DIR__) . '/' . $row['file_path']; if (is_file($abs)) @unlink($abs); $stmt = $conn->prepare("DELETE FROM fee_documents WHERE id=?"); $stmt->bind_param("i", $id); if ($stmt->execute()) $success = 'Deleted successfully.'; else $errors[] = 'Failed to delete: ' . $stmt->error; $stmt->close(); } else { $errors[] = 'Record not found.'; } } // Save Order if (isset($_POST['action']) && $_POST['action'] === 'save_order' && isset($_POST['orders']) && is_array($_POST['orders'])) { $stmt = $conn->prepare("UPDATE fee_documents SET display_order=? WHERE id=?"); foreach ($_POST['orders'] as $id => $order) { if (ctype_digit((string)$id) && is_numeric($order)) { $oid = (int)$id; $ord = (int)$order; $stmt->bind_param("ii", $ord, $oid); $stmt->execute(); } } $stmt->close(); $success = 'Order saved successfully.'; } } $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); $csrf = $_SESSION['csrf_token']; } // --- Fetch list --- $docs = []; if (!$dbError) { $res = $conn->query("SELECT * FROM fee_documents ORDER BY display_order ASC, uploaded_at DESC"); while ($row = $res->fetch_assoc()) $docs[] = $row; } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Manage Fee Documents</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial;background:#f6f7fb;padding:24px;} .card{max-width:1000px;margin:0 auto;background:#fff;border-radius:16px;box-shadow:0 10px 30px rgba(0,0,0,.08);padding:24px;} h1{margin:0 0 16px;} table{width:100%;border-collapse:collapse;} th,td{padding:12px;border-bottom:1px solid #eee;text-align:left;vertical-align:middle;} .badge{display:inline-block;padding:4px 10px;border-radius:999px;font-size:12px;font-weight:700;} .on{background:#e8fff1;color:#177a3f;} .off{background:#ffe8e8;color:#8a1f1f;} .nav{margin:0 auto 16px;max-width:1000px;display:flex;gap:10px;} .nav a{padding:8px 12px;text-decoration:none;border-radius:12px;background:#fff;border:1px solid #eee;color:#222;} .btn{padding:8px 12px;border-radius:10px;border:0;cursor:pointer;font-weight:700} .btn-primary{background:#ea0000;color:#fff;} .btn-light{background:#f2f2f2;} .btn-link{background:transparent;border:0;color:#0b5ed7;text-decoration:underline;cursor:pointer;} .alert{max-width:1000px;margin:0 auto 12px;padding:12px 14px;border-radius:12px;} .alert-ok{background:#e8fff1;color:#177a3f;border:1px solid #c8f2d8;} .alert-err{background:#ffe8e8;color:#8a1f1f;border:1px solid #ffd2d2;} input[type="number"]{width:90px;padding:8px;border:1px solid #e3e3e8;border-radius:10px;} .actions form{display:inline;} </style> </head> <body> <div class="nav"> <a href="fees_upload.php">Upload</a> <a href="fees_list.php">Manage</a> </div> <?php if ($success): ?> <div class="alert alert-ok"><?php echo htmlspecialchars($success); ?></div> <?php endif; ?> <?php if ($errors): ?> <div class="alert alert-err"><?php echo implode('<br>', array_map('htmlspecialchars', $errors)); ?></div> <?php endif; ?> <div class="card"> <h1>Manage Fee Structure Files</h1> <form method="post"> <input type="hidden" name="csrf" value="<?php echo htmlspecialchars($csrf); ?>"> <input type="hidden" name="action" value="save_order"> <table> <thead> <tr> <th>#</th> <th>Title</th> <th>Type</th> <th>Active</th> <th>Order</th> <th>Uploaded</th> <th>Actions</th> </tr> </thead> <tbody> <?php if (!$docs): ?> <tr><td colspan="7" style="color:#888;text-align:center;">No records</td></tr> <?php else: ?> <?php foreach ($docs as $i => $d): ?> <tr> <td><?php echo $i+1; ?></td> <td><?php echo htmlspecialchars($d['title']); ?></td> <td><?php echo strtoupper($d['file_type']); ?></td> <td> <span class="badge <?php echo $d['is_active']?'on':'off'; ?>"> <?php echo $d['is_active']?'ON':'OFF'; ?> </span> </td> <td><input type="number" name="orders[<?php echo (int)$d['id']; ?>]" value="<?php echo (int)$d['display_order']; ?>"></td> <td><?php echo date('d M Y, h:i A', strtotime($d['uploaded_at'])); ?></td> <td class="actions"> <!-- Toggle --> <form method="post" style="display:inline;"> <input type="hidden" name="csrf" value="<?php echo htmlspecialchars($csrf); ?>"> <input type="hidden" name="action" value="toggle"> <input type="hidden" name="id" value="<?php echo (int)$d['id']; ?>"> <button class="btn btn-light" type="submit"><?php echo $d['is_active'] ? 'Deactivate' : 'Activate'; ?></button> </form> <!-- Open --> <a class="btn-link" href="../<?php echo htmlspecialchars($d['file_path']); ?>" target="_blank">Open</a> <!-- Delete --> <form method="post" onsubmit="return confirm('Delete this file?');" style="display:inline;"> <input type="hidden" name="csrf" value="<?php echo htmlspecialchars($csrf); ?>"> <input type="hidden" name="action" value="delete"> <input type="hidden" name="id" value="<?php echo (int)$d['id']; ?>"> <button class="btn btn-link" type="submit">Delete</button> </form> </td> </tr> <?php endforeach; ?> <?php endif; ?> </tbody> </table> <div style="margin-top:12px;"> <button class="btn btn-primary" type="submit">Save Order</button> </div> </form> </div> </body> </html>
Upload File
Create Folder