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: non_academic_achievers.php
<?php // admin/non_academic_achievers.php β Non-Academic Achievers (Advanced UI, 2/2 Grid) include 'secure_session.php'; include 'includes/auth.php'; require_once '../config.php'; // --- DEV DEBUGGING (optional; remove on live) --- // ini_set('display_errors', 1); // ini_set('display_startup_errors', 1); // error_reporting(E_ALL); // ------------------------------------------------ $success = $error = ""; // CSRF if (empty($_SESSION['csrf_token'])) { $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); } $csrf = $_SESSION['csrf_token']; $allowedTypes = ['jpg','jpeg','png']; $maxSize = 500 * 1024; // 500KB // Redirect-safe helper (prevents white screen) function safe_redirect(string $url){ if (!headers_sent()) { header("Location: ".$url); exit; } $u = htmlspecialchars($url, ENT_QUOTES, 'UTF-8'); echo "<script>location.replace('{$u}');</script>"; echo "<noscript><meta http-equiv='refresh' content='0;url={$u}'></noscript>"; exit; } // Helpers function column_exists(mysqli $conn, $table, $col){ $q=$conn->query("SHOW COLUMNS FROM `$table` LIKE '".$conn->real_escape_string($col)."'"); return ($q && $q->num_rows>0); } // ---- Image helper: center-crop & resize 500x500 ---- function crop_and_resize_500($srcPath, $destPath, $mime) { $info = getimagesize($srcPath); if (!$info) return false; [$w, $h] = $info; if ($mime==='image/jpeg' || $mime==='image/jpg') $src = imagecreatefromjpeg($srcPath); elseif ($mime==='image/png') $src = imagecreatefrompng($srcPath); else return false; if (!$src) return false; if ($w > $h) { $side=$h; $sx=intval(($w-$h)/2); $sy=0; } else { $side=$w; $sx=0; $sy=intval(($h-$w)/2); } $dst = imagecreatetruecolor(500,500); if ($mime==='image/png'){ imagealphablending($dst,false); imagesavealpha($dst,true); $t=imagecolorallocatealpha($dst,0,0,0,127); imagefilledrectangle($dst,0,0,500,500,$t); } if (!imagecopyresampled($dst,$src,0,0,$sx,$sy,500,500,$side,$side)){ imagedestroy($src); imagedestroy($dst); return false; } $ok = ($mime==='image/png') ? imagepng($dst,$destPath,6) : imagejpeg($dst,$destPath,90); imagedestroy($src); imagedestroy($dst); return $ok; } /* ------------------------- POST: Add / Update -------------------------- */ if (isset($_POST['save_achiever'])) { if (!hash_equals($_SESSION['csrf_token'], $_POST['csrf_token'] ?? '')) die("CSRF validation failed"); $id = isset($_POST['id']) ? intval($_POST['id']) : 0; $name = trim($_POST['name'] ?? ''); $activity = trim($_POST['activity'] ?? ''); // Sport/Event $achievement = trim($_POST['achievement'] ?? ''); // Winner/Gold/etc. $session = trim($_POST['session_year'] ?? ''); $org = trim($_POST['org'] ?? ''); // Organizer/Place (optional) $status = ($_POST['status'] ?? 'active') === 'inactive' ? 'inactive' : 'active'; $photo = ''; // Upload if (!empty($_FILES['photo']['name'])) { $ext = strtolower(pathinfo($_FILES['photo']['name'], PATHINFO_EXTENSION)); if (!in_array($ext,$allowedTypes)) $error = "β Only JPG/PNG allowed."; elseif ($_FILES['photo']['size'] > $maxSize) $error = "β File too large. Max 500KB."; else { $safe = time().'_'.preg_replace("/[^a-zA-Z0-9\\._-]/","_", $_FILES['photo']['name']); $dir = __DIR__ . "/../uploads/non_academic/"; if (!is_dir($dir)) mkdir($dir,0755,true); $tmp = $_FILES['photo']['tmp_name']; $tmpS = $dir."tmp_".$safe; $final= $dir.$safe; if (!move_uploaded_file($tmp,$tmpS)) $error = "β Upload failed."; else { $info = getimagesize($tmpS); if (!$info){ @unlink($tmpS); $error="β Invalid image file."; } else { $mime = $info['mime']; if (!crop_and_resize_500($tmpS,$final,$mime)){ @unlink($tmpS); $error="β Image processing failed."; } else { @unlink($tmpS); $photo = $safe; } } } } } if (empty($error) && $name && $activity && $achievement && $session) { $hasStatus = column_exists($conn,'n_achievers','status'); if ($id > 0) { // remove old photo if new one provided if ($photo) { $g=$conn->prepare("SELECT photo FROM n_achievers WHERE id=? LIMIT 1"); if ($g){ $g->bind_param("i",$id); $g->execute(); if($r=$g->get_result()->fetch_assoc()){ $old=__DIR__."/../uploads/non_academic/".$r['photo']; if (is_file($old)) @unlink($old); } } } $cols = "name=?, activity=?, achievement=?, session_year=?, org=?"; $types = "sssss"; $vals = [$name,$activity,$achievement,$session,$org]; if ($photo) { $cols.=", photo=?"; $types.="s"; $vals[]=$photo; } if ($hasStatus) { $cols.=", status=?"; $types.="s"; $vals[]=$status; } $sql = "UPDATE n_achievers SET $cols WHERE id=?"; $types.="i"; $vals[]=$id; $stmt = $conn->prepare($sql); $bind = [$types]; foreach ($vals as $k=>$v) { $bind[] = &$vals[$k]; } call_user_func_array([$stmt,'bind_param'],$bind); $stmt->execute(); safe_redirect("non_academic_achievers.php?msg=updated"); } else { $cols = "name, activity, achievement, session_year, org"; $qs = "?,?,?,?,?"; $types = "sssss"; $vals = [$name,$activity,$achievement,$session,$org]; if ($photo) { $cols.=", photo"; $qs.=", ?"; $types.="s"; $vals[]=$photo; } if ($hasStatus) { $cols.=", status"; $qs.=", ?"; $types.="s"; $vals[]=$status; } $sql = "INSERT INTO n_achievers ($cols) VALUES ($qs)"; $stmt = $conn->prepare($sql); $bind = [$types]; foreach ($vals as $k=>$v) { $bind[] = &$vals[$k]; } call_user_func_array([$stmt,'bind_param'],$bind); $stmt->execute(); safe_redirect("non_academic_achievers.php?msg=added"); } } } /* ------------------------- GET: Delete -------------------------- */ if (isset($_GET['delete']) && !isset($_POST['save_achiever'])) { $id = intval($_GET['delete']); $g = $conn->prepare("SELECT photo FROM n_achievers WHERE id=? LIMIT 1"); if ($g){ $g->bind_param("i",$id); $g->execute(); if($r=$g->get_result()->fetch_assoc()){ $old=__DIR__."/../uploads/non_academic/".$r['photo']; if (is_file($old)) @unlink($old); } } $d = $conn->prepare("DELETE FROM n_achievers WHERE id=?"); if ($d){ $d->bind_param("i",$id); $d->execute(); } safe_redirect("non_academic_achievers.php?msg=deleted"); } /* ------------------------- Edit fetch -------------------------- */ $editData=null; if (isset($_GET['edit'])) { $id=intval($_GET['edit']); $e=$conn->prepare("SELECT * FROM n_achievers WHERE id=? LIMIT 1"); if ($e){ $e->bind_param("i",$id); $e->execute(); $editData=$e->get_result()->fetch_assoc(); } } /* ------------------------- Filters (Session/Activity/Search) -------------------------- */ $fsession = trim($_GET['filter_session'] ?? ''); $fact = trim($_GET['filter_activity'] ?? ''); $fq = trim($_GET['q'] ?? ''); $where = []; $params = []; $types = ''; if ($fsession !== '') { $where[] = "session_year = ?"; $params[]=$fsession; $types.='s'; } if ($fact !== '') { $where[] = "activity = ?"; $params[]=$fact; $types.='s'; } if ($fq !== '') { $where[]="(name LIKE ? OR activity LIKE ? OR achievement LIKE ? OR session_year LIKE ? OR org LIKE ?)"; $s="%{$fq}%"; array_push($params,$s,$s,$s,$s,$s); $types.='sssss'; } if (column_exists($conn,'n_achievers','status')) { $where[] = "COALESCE(status,'active') IN ('active','inactive')"; } $whereSql = $where ? ('WHERE '.implode(' AND ',$where)) : ''; $sessions=[]; $activities=[]; if ($r1=$conn->query("SELECT DISTINCT session_year FROM n_achievers ORDER BY session_year DESC")) while($r=$r1->fetch_assoc()) $sessions[]=$r['session_year']; if ($r2=$conn->query("SELECT DISTINCT activity FROM n_achievers ORDER BY activity ASC")) while($r=$r2->fetch_assoc()) $activities[]=$r['activity']; // β Load the header only after all possible redirects include 'includes/header.php'; ?> <style> :root{ --brand:#e40000; --brand-2:#ffe0e0; --ink:#14171a; --muted:#6b7280; --bg:#f6f7fb; --card:rgba(255,255,255,.88); --ring:rgba(228,0,0,.18); --radius:16px; } body{ background:var(--bg); } .top-bar{ height:5px; background:linear-gradient(90deg,var(--brand),#ff5757); border-radius:8px; } .card{ border:0; border-radius:var(--radius); background:var(--card); backdrop-filter: blur(8px); box-shadow:0 8px 26px rgba(30,30,30,.08); } .card-header{ background:transparent; border-bottom:1px solid rgba(0,0,0,.06); font-weight:600; } .badge-soft{ background:var(--brand-2); color:var(--brand); border-radius:999px; padding:.35rem .6rem; font-weight:700; } .btn-brand{ background:var(--brand); border-color:var(--brand); color:#fff!important; border-radius:14px; box-shadow:0 8px 18px var(--ring); } .btn-brand:hover{ filter:brightness(.95); } .btn-ghost{ background:#fff; border:1px solid rgba(0,0,0,.08); color:var(--ink); border-radius:14px; } .chip{ border:1px solid rgba(0,0,0,.08); background:#fff; border-radius:999px; padding:6px 12px; font-size:.85rem; } .help-text{ color:var(--muted); font-size:.82rem; } /* ===== Advanced Form Grid (2/2) ===== */ .form-grid{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; } @media (max-width: 768px){ .form-grid{ grid-template-columns:1fr; } } .fg{ display:flex; flex-direction:column; } .fg label{ font-weight:700; margin-bottom:6px; } .form-control, .custom-select{ border-radius:12px; border-color:rgba(0,0,0,.12); box-shadow:none; transition:box-shadow .15s ease, border-color .15s ease; } .form-control:focus, .custom-select:focus{ border-color:var(--brand); box-shadow:0 0 0 .20rem var(--ring); } .thumb{ width:64px;height:64px;object-fit:cover;border-radius:12px;box-shadow:0 4px 12px rgba(0,0,0,.08); } /* Table */ .table-modern thead th{ background:#fff; border-bottom:1px solid rgba(0,0,0,.08); font-size:.82rem; text-transform:uppercase; letter-spacing:.02em; } .table-modern tbody td{ vertical-align:middle; } .table-modern tbody tr{ border-bottom:1px solid rgba(0,0,0,.05); } .table-modern tbody tr:hover{ background:#fff; box-shadow:inset 0 0 0 9999px rgba(228,0,0,.02); } .grid .card-img-top{ height:180px; object-fit:cover; border-top-left-radius:var(--radius); border-top-right-radius:var(--radius); } .card.grid{ transition:transform .15s ease, box-shadow .15s ease; } .card.grid:hover{ transform:translateY(-3px); box-shadow:0 10px 24px rgba(0,0,0,.12); } </style> <div class="container mt-3 mb-4"> <div class="d-flex align-items-center justify-content-between mb-2"> <h4 class="m-0">π Manage Non-Academic Achievers</h4> <div class="chip"><strong>Images:</strong> 500Γ500 β’ Max 500KB</div> </div> <div class="top-bar mb-3"></div> <div class="mb-3 d-flex justify-content-end"> <button class="btn btn-ghost me-2" data-bs-toggle="modal" data-bs-target="#allAchieversModal">π Quick Grid View</button> <a class="btn btn-brand" href="#achiever-form">β Add New</a> </div> <?php if (!empty($_GET['msg'])) { $m=$_GET['msg']; if ($m==='deleted') echo '<div class="alert alert-success shadow-sm">ποΈ Achiever deleted.</div>'; if ($m==='added') echo '<div class="alert alert-success shadow-sm">β Achiever added.</div>'; if ($m==='updated') echo '<div class="alert alert-success shadow-sm">β Achiever updated.</div>'; } if ($error) echo '<div class="alert alert-danger shadow-sm">'.htmlspecialchars($error).'</div>'; ?> <!-- ===== Form (2/2 Grid) ===== --> <div class="card mb-4" id="achiever-form"> <div class="card-header d-flex align-items-center justify-content-between"> <span><?= $editData ? "βοΈ Edit Achiever" : "β Add Achiever"; ?></span> <span class="badge-soft"><?= $editData ? "Edit Mode" : "Create Mode"; ?></span> </div> <div class="card-body"> <form method="POST" enctype="multipart/form-data"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <?php if ($editData): ?><input type="hidden" name="id" value="<?= (int)$editData['id'] ?>"><?php endif; ?> <div class="form-grid"> <div class="fg"> <label>Name</label> <input type="text" name="name" class="form-control" required value="<?= htmlspecialchars($editData['name'] ?? '') ?>"> </div> <div class="fg"> <label>Activity (Sport/Event)</label> <input type="text" name="activity" class="form-control" required value="<?= htmlspecialchars($editData['activity'] ?? '') ?>"> </div> <div class="fg"> <label>Achievement (Winner/Gold/1stβ¦)</label> <input type="text" name="achievement" class="form-control" required value="<?= htmlspecialchars($editData['achievement'] ?? '') ?>"> </div> <div class="fg"> <label>Session/Year</label> <input type="text" name="session_year" class="form-control" required value="<?= htmlspecialchars($editData['session_year'] ?? '') ?>" placeholder="e.g., 2024β25"> </div> <div class="fg"> <label>Organizer / Place (optional)</label> <input type="text" name="org" class="form-control" value="<?= htmlspecialchars($editData['org'] ?? '') ?>"> </div> <div class="fg"> <label>Status</label> <?php $hasStatus = column_exists($conn,'n_achievers','status'); ?> <?php if ($hasStatus): ?> <select name="status" class="custom-select"> <option value="active" <?= ($editData['status'] ?? 'active')==='active'?'selected':'' ?>>Active</option> <option value="inactive" <?= ($editData['status'] ?? 'active')==='inactive'?'selected':'' ?>>Inactive</option> </select> <?php else: ?> <input type="text" class="form-control" value="(Add status column to enable)" disabled> <?php endif; ?> </div> <div class="fg"> <label>Photo (auto 500Γ500 crop)</label> <input type="file" name="photo" class="form-control"> </div> <div class="fg d-flex align-items-end"> <?php if (!empty($editData['photo'])): ?> <img src="../uploads/non_academic/<?= htmlspecialchars($editData['photo']) ?>" class="thumb" alt=""> <?php else: ?> <div class="help-text">Preview appears here after upload.</div> <?php endif; ?> </div> </div> <div class="mt-3 d-flex gap-2"> <button type="submit" name="save_achiever" class="btn btn-brand"> <?= $editData ? "Update Achiever" : "Add Achiever" ?> </button> <?php if ($editData): ?><a href="non_academic_achievers.php" class="btn btn-ghost">Cancel</a><?php endif; ?> </div> </form> </div> </div> <!-- Filters --> <form class="card mb-3 p-3" method="get" action=""> <div class="form-grid"> <div> <label class="mb-1"><strong>Filter Session</strong></label> <select name="filter_session" class="custom-select"> <option value="">All</option> <?php foreach ($sessions as $s): ?> <option value="<?= htmlspecialchars($s) ?>" <?= $fsession===$s?'selected':'' ?>><?= htmlspecialchars($s) ?></option> <?php endforeach; ?> </select> </div> <div> <label class="mb-1"><strong>Filter Activity</strong></label> <select name="filter_activity" class="custom-select"> <option value="">All</option> <?php foreach ($activities as $a): ?> <option value="<?= htmlspecialchars($a) ?>" <?= $fact===$a?'selected':'' ?>><?= htmlspecialchars($a) ?></option> <?php endforeach; ?> </select> </div> <div> <label class="mb-1"><strong>Search</strong></label> <div class="input-group"> <input type="text" name="q" class="form-control" placeholder="Name, activity, achievement, sessionβ¦" value="<?= htmlspecialchars($fq) ?>"> <div class="input-group-append"> <button class="btn btn-ghost" type="submit">Apply</button> </div> </div> </div> <div class="d-flex align-items-end"> <?php if ($fsession || $fact || $fq): ?> <a class="btn btn-link p-0" href="<?= htmlspecialchars(strtok($_SERVER['REQUEST_URI'],'?')) ?>">Clear filters</a> <?php endif; ?> </div> </div> </form> <!-- Table --> <div class="card"> <div class="card-header d-flex align-items-center justify-content-between"> <span>All Non-Academic Achievers</span> <span class="badge-soft">List View</span> </div> <div class="table-responsive"> <table class="table table-modern table-borderless align-middle mb-0"> <thead> <tr> <th>ID</th><th>Photo</th><th>Name</th><th>Activity</th><th>Achievement</th><th>Session</th><th>Org/Place</th><?php if (column_exists($conn,'n_achievers','status')) echo '<th>Status</th>'; ?><th>Action</th> </tr> </thead> <tbody> <?php $sqlList = "SELECT * FROM n_achievers $whereSql ORDER BY id DESC"; $stl = $conn->prepare($sqlList); if ($types) $stl->bind_param($types, ...$params); $stl->execute(); $res = $stl->get_result(); if ($res && $res->num_rows>0) { while ($row = $res->fetch_assoc()) { echo "<tr>", "<td>".(int)$row['id']."</td>", "<td>".($row['photo'] ? "<img src='../uploads/non_academic/".htmlspecialchars($row['photo'])."' class='thumb'>" : "β")."</td>", "<td><strong>".htmlspecialchars($row['name'])."</strong></td>", "<td>".htmlspecialchars($row['activity'])."</td>", "<td>".htmlspecialchars($row['achievement'])."</td>", "<td>".htmlspecialchars($row['session_year'])."</td>", "<td>".htmlspecialchars($row['org'])."</td>"; if (column_exists($conn,'n_achievers','status')) { $badge = ($row['status']==='inactive') ? "<span class='badge-soft' style='background:#e5e7eb;color:#374151;'>Inactive</span>" : "<span class='badge-soft'>Active</span>"; echo "<td>$badge</td>"; } echo "<td class='text-nowrap'>", "<a href='?edit=".$row['id']."' class='btn btn-sm btn-ghost me-1'>Edit</a>", "<a href='?delete=".$row['id']."' class='btn btn-sm btn-brand' onclick='return confirm(\"Delete?\")'>Delete</a>", "</td>", "</tr>"; } } else { echo "<tr><td colspan='".(column_exists($conn,'n_achievers','status')?9:8)."' class='text-muted text-center py-4'>No achievers found</td></tr>"; } ?> </tbody> </table> </div> </div> </div> <!-- Modal: All Achievers (Grid) --> <div class="modal fade" id="allAchieversModal" tabindex="-1" aria-hidden="true"> <div class="modal-dialog modal-xl modal-dialog-scrollable"> <div class="modal-content" style="border:0;border-radius:16px;"> <div class="modal-header" style="border:0;"> <h5 class="modal-title">π All Non-Academic Achievers</h5> <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body pt-0"> <div class="row"> <?php $res2 = $conn->query("SELECT * FROM n_achievers ORDER BY id DESC"); if ($res2) { while ($r = $res2->fetch_assoc()) { $img = $r['photo'] ? "../uploads/non_academic/".htmlspecialchars($r['photo']) : "https://via.placeholder.com/500?text=No+Image"; echo "<div class='col-md-3 col-sm-6 mb-4'>", "<div class='card grid'>", "<img src='".$img."' class='card-img-top'>", "<div class='card-body text-center'>", "<h6 class='mb-1'>".htmlspecialchars($r['name'])."</h6>", "<div class='help-text mb-1'>".htmlspecialchars($r['activity'])." β’ ".htmlspecialchars($r['achievement'])."</div>", "<div class='small'>Session: <strong>".htmlspecialchars($r['session_year'])."</strong></div>", ($r['org'] ? "<div class='help-text mt-1'>".htmlspecialchars($r['org'])."</div>" : ""), (column_exists($conn,'n_achievers','status') ? "<div class='help-text mt-1 text-capitalize'>Status: ".htmlspecialchars($r['status'])."</div>" : ""), "</div>", "</div>", "</div>"; } } ?> </div> </div> </div> </div> </div> <?php include 'includes/footer.php'; ?>
Upload File
Create Folder