X7ROOT File Manager
Current Path:
/home/u126090504/domains/shreeganeshacademy.in/public_html/admin
home
/
u126090504
/
domains
/
shreeganeshacademy.in
/
public_html
/
admin
/
📁
..
📄
achievers.php
(13.81 KB)
📄
admissions.php
(5.67 KB)
📄
banners.php
(7.18 KB)
📄
change_password.php
(3.54 KB)
📄
contacts.php
(3.83 KB)
📄
dashboard.php
(9.86 KB)
📄
downloads.php
(4.91 KB)
📄
export_franchise.php
(930 B)
📄
faculty.php
(13.27 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
(2.28 KB)
📄
manage_media.php
(3.02 KB)
📄
manage_photos.php
(5.66 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)
📄
reset_password.php
(2.27 KB)
📄
secure_session.php
(1000 B)
📄
settings.php
(5.21 KB)
📄
submit-grievance.php
(4.97 KB)
📄
testimonials.php
(10.25 KB)
📄
update_status.php
(1.29 KB)
📄
upi_settings.php
(1.52 KB)
Editing: governing-body-manage.php
<?php // governing-body-manage.php (mysqli version, white theme, no "View" link) // ----- enable only while debugging ----- // ini_set('display_errors', 1); // error_reporting(E_ALL); include __DIR__ . '/secure_session.php'; // your session hardening (may already start session) include __DIR__ . '/includes/auth.php'; // your admin auth guard require_once __DIR__ . '/../config.php'; // MUST define $conn (mysqli) include __DIR__ . '/includes/header.php'; // your admin header (optional) // Make sure session is active (in case secure_session.php didn’t start it) if (session_status() !== PHP_SESSION_ACTIVE) { session_start(); } // CSRF token if (empty($_SESSION['csrf'])) { $_SESSION['csrf'] = bin2hex(random_bytes(32)); } $csrf = $_SESSION['csrf']; function e($v){ return htmlspecialchars((string)$v, ENT_QUOTES, 'UTF-8'); } function trim_text($t,$n=120){ if (function_exists('mb_strlen')) { return mb_strlen($t,'UTF-8')>$n ? mb_substr($t,0,$n,'UTF-8').'…' : $t; } return strlen($t)>$n ? substr($t,0,$n).'…' : $t; } $errors = []; $notice = null; // Ensure $conn (mysqli) is available if (!isset($conn) || !($conn instanceof mysqli)) { echo "<pre style='background:#fee;border-left:4px solid #f00;padding:10px'>Config error: \$conn (mysqli) not available. Check ../config.php</pre>"; exit; } // Create / Update if ($_SERVER['REQUEST_METHOD']==='POST') { if (!hash_equals($_SESSION['csrf'] ?? '', $_POST['csrf'] ?? '')) { $errors[] = 'Invalid CSRF.'; } else { $id = isset($_POST['id']) ? (int)$_POST['id'] : 0; $name = trim($_POST['name'] ?? ''); $designation = trim($_POST['designation'] ?? ''); $role = trim($_POST['role_responsibility'] ?? ''); $sort = (int)($_POST['sort_order'] ?? 0); $status = ($_POST['status'] ?? 'active') === 'inactive' ? 'inactive' : 'active'; if ($name==='') $errors[] = 'Name is required.'; if ($designation==='') $errors[] = 'Designation is required.'; if ($role==='') $errors[] = 'Role/Responsibility is required.'; if (!$errors) { if ($id > 0) { $stmt = $conn->prepare( "UPDATE governing_body_members SET name=?, designation=?, role_responsibility=?, sort_order=?, status=? WHERE id=?" ); $stmt->bind_param("sssisi", $name, $designation, $role, $sort, $status, $id); $stmt->execute(); $stmt->close(); $notice = 'Updated successfully.'; } else { $stmt = $conn->prepare( "INSERT INTO governing_body_members (name, designation, role_responsibility, sort_order, status) VALUES (?,?,?,?,?)" ); $stmt->bind_param("sssis", $name, $designation, $role, $sort, $status); $stmt->execute(); $stmt->close(); $notice = 'Added successfully.'; } } } } // Delete if (($_GET['action'] ?? '') === 'delete' && isset($_GET['id'])) { if (!hash_equals($_SESSION['csrf'] ?? '', $_GET['csrf'] ?? '')) { $errors[] = 'Invalid CSRF.'; } else { $id = (int)$_GET['id']; $stmt = $conn->prepare("DELETE FROM governing_body_members WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $stmt->close(); $notice = 'Deleted successfully.'; } } // Load list $list = []; $res = $conn->query("SELECT * FROM governing_body_members ORDER BY sort_order ASC, name ASC"); if ($res) { while($row = $res->fetch_assoc()) { $list[] = $row; } $res->close(); } // Load item for edit $edit = null; if (($_GET['action'] ?? '') === 'edit' && isset($_GET['id'])) { $id = (int)$_GET['id']; $stmt = $conn->prepare("SELECT * FROM governing_body_members WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); $edit = $result->fetch_assoc(); $stmt->close(); } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Manage Governing Body</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial, sans-serif; margin: 24px; background: #ffffff; /* White background */ color: #222; /* Dark text */ } a { color: #2563eb; text-decoration: none; } a:hover { text-decoration: underline; } .wrap { max-width: 1100px; margin: 0 auto; } .grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; } .card { background: #f8f9fa; border: 1px solid #dcdcdc; border-radius: 12px; padding: 18px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); } .card h3 { margin-top: 0; color: #222; } input, textarea, select { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid #ccc; background: #fff; color: #111; } label { font-size: 13px; font-weight: 500; color: #444; } table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; } th, td { padding: 12px; border-bottom: 1px solid #e2e2e2; vertical-align: top; text-align: left; } th { background: #f1f3f5; font-weight: 600; } tr:hover { background: #f5f5f5; } .row-actions a { margin-right: 10px; color: #2563eb; font-weight: 500; } .btn { display: inline-block; padding: 10px 14px; border-radius: 8px; border: 0; background: #2563eb; color: #fff; cursor: pointer; transition: 0.3s; } .btn:hover { background: #1d4ed8; } .btn.secondary { background: #6b7280; } .btn.secondary:hover { background: #4b5563; } .notice { background: #e0f2fe; border-left: 4px solid #0ea5e9; color: #0c4a6e; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; } .error { background: #fee2e2; border-left: 4px solid #ef4444; color: #7f1d1d; } @media (max-width: 980px) { .grid { grid-template-columns: 1fr; } } </style> </head> <body> <div class="wrap"> <h2>Governing Body — Admin</h2> <?php if($notice): ?><div class="notice"><?= e($notice) ?></div><?php endif; ?> <?php if($errors): ?><div class="notice error"><?= e(implode(' ', $errors)) ?></div><?php endif; ?> <div class="grid"> <!-- Left: Form --> <div class="card"> <h3><?= $edit ? 'Edit Member' : 'Add Member' ?></h3> <form method="post"> <input type="hidden" name="csrf" value="<?= e($csrf) ?>"> <input type="hidden" name="id" value="<?= $edit ? (int)$edit['id'] : 0 ?>"> <label>Name</label> <input name="name" required value="<?= e($edit['name'] ?? '') ?>"> <label style="margin-top:10px">Designation</label> <input name="designation" required value="<?= e($edit['designation'] ?? '') ?>"> <label style="margin-top:10px">Role / Responsibility</label> <textarea name="role_responsibility" rows="5" required><?= e($edit['role_responsibility'] ?? '') ?></textarea> <div style="display:flex;gap:12px;margin-top:10px"> <div style="flex:1"> <label>Sort Order</label> <input type="number" name="sort_order" value="<?= e($edit['sort_order'] ?? 0) ?>"> </div> <div style="flex:1"> <label>Status</label> <select name="status"> <option value="active" <?= (($edit['status'] ?? 'active')==='active')?'selected':'' ?>>Active</option> <option value="inactive" <?= (($edit['status'] ?? '')==='inactive')?'selected':'' ?>>Inactive</option> </select> </div> </div> <div style="margin-top:14px"> <button class="btn" type="submit"><?= $edit ? 'Update' : 'Add' ?></button> <?php if($edit): ?> <a class="btn secondary" href="governing-body-manage.php">Cancel</a> <?php endif; ?> </div> </form> </div> <!-- Right: Table --> <div class="card"> <h3>Members</h3> <table> <thead> <tr> <th style="width:8%">#</th> <th style="width:26%">Name</th> <th style="width:20%">Designation</th> <th>Role</th> <th style="width:16%">Actions</th> </tr> </thead> <tbody> <?php if(empty($list)): ?> <tr><td colspan="5" style="color:#777">No records found.</td></tr> <?php else: foreach($list as $r): ?> <tr> <td><?= (int)$r['sort_order'] ?></td> <td><?= e($r['name']) ?></td> <td><em><?= e($r['designation']) ?></em></td> <td><?= e(trim_text($r['role_responsibility'],120)) ?></td> <td class="row-actions"> <a href="?action=edit&id=<?= (int)$r['id'] ?>">Edit</a> <a href="?action=delete&id=<?= (int)$r['id'] ?>&csrf=<?= e($csrf) ?>" onclick="return confirm('Delete this member?')">Delete</a> <!-- View link removed as requested --> </td> </tr> <?php endforeach; endif; ?> </tbody> </table> </div> </div> </div> </body> </html> <?php include __DIR__ . '/includes/footer.php'; ?>
Upload File
Create Folder