X7ROOT File Manager
Current Path:
/home/u126090504/domains/oca.org.in/public_html/admin
home
/
u126090504
/
domains
/
oca.org.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.73 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: franchise.php
<?php include 'includes/auth.php'; require_once '../config.php'; include 'includes/header.php'; $allowedTypes = ['jpg','jpeg','png']; $maxSize = 5 * 1024 * 1024; // 5MB $success = $error = ""; // CSRF Token if (empty($_SESSION['csrf'])) { $_SESSION['csrf'] = bin2hex(random_bytes(32)); } // Add or Update Franchise if (isset($_POST['save_franchise'])) { $id = isset($_POST['id']) ? intval($_POST['id']) : 0; $name = trim($_POST['name']); $address = trim($_POST['address']); $center = trim($_POST['center']); $mob = trim($_POST['mob']); if ($name && $address && $center && $mob) { if ($id > 0) { $stmt = $conn->prepare("UPDATE franchise SET name=?, address=?, center=?, mob=? WHERE id=?"); $stmt->bind_param("ssssi", $name, $address, $center, $mob, $id); $stmt->execute(); $success = "✅ Franchise updated successfully."; } else { $stmt = $conn->prepare("INSERT INTO franchise (name, address, center, mob) VALUES (?,?,?,?)"); $stmt->bind_param("ssss", $name, $address, $center, $mob); $stmt->execute(); $success = "✅ Franchise added successfully."; } } else { $error = "⚠️ All fields are required."; } } // Delete Franchise if (isset($_GET['delete'])) { $id = intval($_GET['delete']); $stmt = $conn->prepare("DELETE FROM franchise WHERE id=?"); $stmt->bind_param("i", $id); $stmt->execute(); $success = "⚠️ Franchise deleted."; } // Edit Franchise $editData = null; if (isset($_GET['edit'])) { $id = intval($_GET['edit']); $stmt = $conn->prepare("SELECT * FROM franchise WHERE id=? LIMIT 1"); $stmt->bind_param("i", $id); $stmt->execute(); $res = $stmt->get_result(); $editData = $res->fetch_assoc(); } ?> <div class="container mt-4"> <h3 class="mb-4 text-center">🏢 Manage Franchise Centers</h3> <?php if ($success): ?> <div class="alert alert-success"><?php echo $success; ?></div> <?php endif; ?> <?php if ($error): ?> <div class="alert alert-danger"><?php echo $error; ?></div> <?php endif; ?> <!-- Franchise Form --> <div class="card mb-4 shadow"> <div class="card-header bg-primary text-white"> <?php echo $editData ? "✏️ Edit Franchise" : "➕ Add New Franchise"; ?> </div> <div class="card-body"> <form method="POST"> <?php if ($editData): ?> <input type="hidden" name="id" value="<?php echo $editData['id']; ?>"> <?php endif; ?> <div class="form-group"> <label>Institute Name</label> <input type="text" name="name" class="form-control" required value="<?php echo $editData['name'] ?? ''; ?>"> </div> <div class="form-group"> <label>Address</label> <textarea name="address" class="form-control" rows="2" required><?php echo $editData['address'] ?? ''; ?></textarea> </div> <div class="form-group"> <label>Center Manager</label> <input type="text" name="center" class="form-control" required value="<?php echo $editData['center'] ?? ''; ?>"> </div> <div class="form-group"> <label>Phone</label> <input type="text" name="mob" class="form-control" required value="<?php echo $editData['mob'] ?? ''; ?>"> </div> <button type="submit" name="save_franchise" class="btn btn-success"> <?php echo $editData ? "💾 Update Franchise" : "➕ Add Franchise"; ?> </button> <?php if ($editData): ?> <a href="franchise.php" class="btn btn-secondary">Cancel</a> <?php endif; ?> </form> </div> </div> <!-- Export + View Button --> <div class="mb-3"> <a href="export_franchise.php" class="btn btn-success">📥 Export to CSV</a> <button class="btn btn-info" data-toggle="modal" data-target="#franchiseModal">📋 View All Franchises</button> </div> <!-- Modal --> <div class="modal fade" id="franchiseModal" tabindex="-1" aria-labelledby="franchiseModalLabel" aria-hidden="true"> <div class="modal-dialog modal-xl"> <div class="modal-content"> <div class="modal-header bg-dark text-white"> <h5 class="modal-title" id="franchiseModalLabel">Franchise Centers</h5> <button type="button" class="close text-white" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <table id="franchiseTable" class="table table-bordered table-hover"> <thead class="thead-dark"> <tr> <th>ID</th> <th>Institute Name</th> <th>Address</th> <th>Center Manager</th> <th>Phone</th> <th>Action</th> </tr> </thead> <tbody> <?php $res = $conn->query("SELECT * FROM franchise ORDER BY id DESC"); if ($res->num_rows > 0) { while ($row = $res->fetch_assoc()) { echo "<tr> <td>".$row['id']."</td> <td>".htmlspecialchars($row['name'])."</td> <td>".nl2br(htmlspecialchars($row['address']))."</td> <td><span class='badge badge-primary'>".htmlspecialchars($row['center'])."</span></td> <td><span class='badge badge-danger'>".htmlspecialchars($row['mob'])."</span></td> <td> <a href='?edit=".$row['id']."' class='btn btn-sm btn-info'>Edit</a> <a href='?delete=".$row['id']."' class='btn btn-sm btn-danger' onclick='return confirm(\"Delete this franchise?\")'>Delete</a> </td> </tr>"; } } else { echo "<tr><td colspan='6'>No franchise centers found</td></tr>"; } ?> </tbody> </table> </div> </div> </div> </div> </div> <!-- DataTables --> <link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap4.min.css"> <script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap4.min.js"></script> <script> $(document).ready(function(){ $('#franchiseTable').DataTable({ "pageLength": 5 }); }); </script> <?php include 'includes/footer.php'; ?>
Upload File
Create Folder