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: achv_cat_manage.php
<?php // /admin/achv_cat_manage.php — Manage Achievement Categories 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); if (empty($_SESSION['csrf_token'])) $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); $csrf = $_SESSION['csrf_token']; $errors = []; $success = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!isset($_POST['csrf']) || !hash_equals($_SESSION['csrf_token'], $_POST['csrf'])) { $errors[] = 'Invalid request token.'; } else { $action = $_POST['action'] ?? ''; // Add if ($action === 'add') { $name = trim($_POST['name'] ?? ''); $slug = trim($_POST['slug'] ?? ''); if ($name === '') $errors[] = 'Name required.'; if (!$errors) { if ($slug === '') { $slug = strtolower(preg_replace('/[^a-z0-9]+/i','-', $name)); $slug = trim($slug,'-'); } $stmt = $conn->prepare("INSERT INTO achievement_categories (name, slug, is_active, display_order) VALUES (?, ?, 1, 0)"); $stmt->bind_param("ss", $name, $slug); if ($stmt->execute()) $success = 'Category added.'; else $errors[] = $stmt->error; $stmt->close(); } } // Toggle if ($action === 'toggle' && isset($_POST['id']) && ctype_digit($_POST['id'])) { $id = (int)$_POST['id']; $res = $conn->query("SELECT is_active FROM achievement_categories WHERE id={$id}"); if ($row = $res->fetch_assoc()) { $new = $row['is_active'] ? 0 : 1; $stmt = $conn->prepare("UPDATE achievement_categories SET is_active=? WHERE id=?"); $stmt->bind_param("ii", $new, $id); if ($stmt->execute()) $success = 'Status updated.'; else $errors[] = $stmt->error; $stmt->close(); } } // Delete (blocked if in use) if ($action === 'delete' && isset($_POST['id']) && ctype_digit($_POST['id'])) { $id = (int)$_POST['id']; $cnt = 0; $r = $conn->query("SELECT COUNT(*) c FROM achievements WHERE category_id={$id}"); if ($x = $r->fetch_assoc()) $cnt = (int)$x['c']; if ($cnt > 0) { $errors[] = 'Cannot delete: category in use by achievements.'; } else { $stmt = $conn->prepare("DELETE FROM achievement_categories WHERE id=?"); $stmt->bind_param("i", $id); if ($stmt->execute()) $success = 'Deleted.'; else $errors[] = $stmt->error; $stmt->close(); } } // Save order if ($action === 'save_order' && isset($_POST['orders']) && is_array($_POST['orders'])) { $stmt = $conn->prepare("UPDATE achievement_categories SET display_order=? WHERE id=?"); foreach ($_POST['orders'] as $id => $ord) { if (ctype_digit((string)$id) && is_numeric($ord)) { $oid = (int)$id; $o = (int)$ord; $stmt->bind_param("ii", $o, $oid); $stmt->execute(); } } $stmt->close(); $success = 'Order saved.'; } } $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); $csrf = $_SESSION['csrf_token']; } $cats = []; $res = $conn->query("SELECT * FROM achievement_categories ORDER BY display_order ASC, created_at DESC"); while ($c = $res->fetch_assoc()) $cats[] = $c; ?> <style> body{ font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial; background:#f6f7fb; margin:0; padding:0; } .main-wrapper{ margin-left:260px; /* match sidebar width */ margin-top:90px; /* match fixed header height */ padding:24px; } .wrap{max-width:1100px;margin:0 auto;display:grid;gap:16px} .card{background:#fff;border-radius:16px;box-shadow:0 10px 30px rgba(0,0,0,.08);padding:24px;} h1,h2{margin:0 0 12px} table{width:100%;border-collapse:collapse} th,td{padding:12px;border-bottom:1px solid #eee;text-align:left;vertical-align:middle} input[type="text"]{width:100%;padding:10px 12px;border:1px solid #e3e3e8;border-radius:10px} input[type="number"]{width:90px;padding:8px;border:1px solid #e3e3e8;border-radius:10px} .btn{padding:8px 12px;border-radius:10px;border:0;cursor:pointer;font-weight:700} .btn-primary{background:#ea0000;color:#fff} .btn-link{background:transparent;color:#0b5ed7;text-decoration:underline;cursor:pointer;border:0} .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 4px;max-width:1100px;display:flex;gap:10px} .nav a{padding:8px 12px;text-decoration:none;border-radius:12px;background:#fff;border:1px solid #eee;color:#222} .alert{max-width:1100px;margin:0 auto 8px;padding:10px 12px;border-radius:12px} .alert-ok{background:#e8fff1;color:#177a3f;border:1px solid #c8f2d8} .alert-err{background:#ffe8e8;color:#8a1f1f;border:1px solid #ffd2d2} </style> <div class="main-wrapper"> <div class="nav"> <a href="achv_upload.php">Add Achievement</a> <a href="achv_list.php">Manage Achievements</a> <a href="achv_cat_manage.php">Categories</a> </div> <?php if($success):?><div class="alert alert-ok"><?=htmlspecialchars($success)?></div><?php endif;?> <?php if($errors):?><div class="alert alert-err"><?=implode('<br>',array_map('htmlspecialchars',$errors))?></div><?php endif;?> <div class="wrap"> <div class="card"> <h1>Achievement Categories</h1> <form method="post" style="display:grid;grid-template-columns:1fr 1fr auto;gap:10px;margin-bottom:12px"> <input type="hidden" name="csrf" value="<?=htmlspecialchars($csrf)?>"> <input type="hidden" name="action" value="add"> <input type="text" name="name" placeholder="Category name (e.g., Sports, Scholarships)" required> <input type="text" name="slug" placeholder="Slug (optional, auto if blank)"> <button class="btn btn-primary" type="submit">Add</button> </form> <form method="post"> <input type="hidden" name="csrf" value="<?=htmlspecialchars($csrf)?>"> <input type="hidden" name="action" value="save_order"> <table> <thead> <tr> <th>#</th><th>Name</th><th>Slug</th><th>Active</th><th>Order</th><th>Actions</th> </tr> </thead> <tbody> <?php if(!$cats): ?> <tr><td colspan="6" style="text-align:center;color:#888">No categories</td></tr> <?php else: foreach($cats as $i=>$c): ?> <tr> <td><?=$i+1?></td> <td><?=htmlspecialchars($c['name'])?></td> <td><?=htmlspecialchars($c['slug'])?></td> <td><span class="badge <?=$c['is_active']?'on':'off'?>"><?=$c['is_active']?'ON':'OFF'?></span></td> <td><input type="number" name="orders[<?=$c['id']?>]" value="<?=$c['display_order']?>"></td> <td> <form method="post" style="display:inline"> <input type="hidden" name="csrf" value="<?=htmlspecialchars($csrf)?>"> <input type="hidden" name="action" value="toggle"> <input type="hidden" name="id" value="<?=$c['id']?>"> <button class="btn btn-link" type="submit"><?=$c['is_active']?'Deactivate':'Activate'?></button> </form> <form method="post" style="display:inline" onsubmit="return confirm('Delete this category?');"> <input type="hidden" name="csrf" value="<?=htmlspecialchars($csrf)?>"> <input type="hidden" name="action" value="delete"> <input type="hidden" name="id" value="<?=$c['id']?>"> <button class="btn btn-link" type="submit">Delete</button> </form> </td> </tr> <?php endforeach; endif; ?> </tbody> </table> <div style="margin-top:10px"><button class="btn btn-primary" type="submit">Save Order</button></div> </form> </div> </div> </div> <?php include 'includes/footer.php'; ?>
Upload File
Create Folder