[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: manage-house-allocation.php
<?php error_reporting(0); include("../functions.php"); if(!isset($_SESSION['dbmail_Xw211qAAsq4'])){ header("location:../auth-login"); } else { $s_code = $_SESSION['s_code_Xw2119904']; $uname = $_SESSION['name_Xw2119904']; $stmt = $con->prepare("SELECT * FROM schools WHERE user_name = ? AND school_code = ?"); $stmt->execute(array($uname, $s_code)); $userstatus = $stmt->fetchAll(); // Initialize $namee to prevent potential errors $namee = null; foreach ($userstatus as $sta) { $namee = $sta['user_name']; $userid = $sta['id']; $school_name = $sta['school_name']; } $stmt = $con->prepare("Select * from schools where school_code = ?"); $stmt->execute(array($s_code)); $row = $stmt->fetch(); $logo = $row['logo']; if(empty($logo)){ header("Location:complete-process"); } else { $message = ""; if(isset($_POST['find'])){ $className = test_input($_POST['className']); } if (isset($_POST['assignHome'])) { $classIDs = $_POST['house_id']; // Get the selected class IDs from the form $indexNumbers = $_POST['indexNo']; // Get the index numbers from the hidden input fields // Loop through the selected class IDs and corresponding index numbers foreach ($classIDs as $key => $classID) { if (!empty($classID)) { $indexNo = $indexNumbers[$key]; // Get the corresponding index number $updateQuery = mysqli_query($new,"UPDATE enrol_details SET house_id = '$classID' WHERE index_no = '$indexNo'"); } } echo "<script> document.addEventListener('DOMContentLoaded', function() { Swal.fire({ title: 'Success!', text: 'House assign Successfully', icon: 'success', confirmButtonText: 'OK' }); }); </script>"; } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Admission setup | Admission setup </title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta content="eliosof" name="author" /> <!-- App favicon --> <!-- <link rel="shortcut icon" href="assets/images/favicon.ico"> --> <!-- preloader css --> <link rel="stylesheet" href="assets/css/preloader.min.css" type="text/css" /> <!-- Bootstrap Css --> <link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" /> <!-- Icons Css --> <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" /> <!-- App Css--> <link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" /> <link href="assets/libs/sweetalert2/sweetalert2.min.css" rel="stylesheet" type="text/css" /> </head> <body> <!-- <body data-layout="horizontal"> --> <!-- Begin page --> <div id="layout-wrapper"> <?php include("includes/header.php");?> <?php include("includes/sidebar.php");?> <div class="main-content"> <div class="page-content"> <div class="container-fluid"> <!-- start page title --> <div class="row"> <div class="col-12"> <div class="page-title-box d-sm-flex align-items-center justify-content-between"> <h4 class="mb-sm-0 font-size-18">MANAGE HOUSE ALLOCATION</h4> <div class="page-title-right"> <ol class="breadcrumb m-0"> <li class="breadcrumb-item"><a href="javascript: void(0);">Home</a></li> <li class="breadcrumb-item active">MANAGE HOUSE ALLOCATION</li> </ol> </div> </div> </div> </div> <!-- end page title --> <div class="row"> <div class="col-lg-4"> <div class="card bg-primary border-primary text-white-50"> <div class="card-body"> <h5 class="mb-3 text-white" style="text-transform: uppercase;">Total registered student</h5> <h3 style="color:#fff"><?php $select_css = mysqli_query($new,"SELECT count(id) as total FROM enrol_details WHERE s_code = '$s_code'"); if(mysqli_num_rows($select_css) < 1){ echo $totalenrolled = 0; } else { $howmany = mysqli_fetch_array($select_css); echo $totalenrolled = $howmany['total']; } ?></h3> </div> </div> </div><!-- end col --> <div class="col-lg-4"> <div class="card bg-success border-success text-white-50"> <div class="card-body"> <h5 class="mb-3 text-white">TOTAL BOARDING STUDENTS </h5> <h3 style="color:#fff"><?php $select_css = mysqli_query($new,"SELECT count(id) as total FROM enrol_details,enrol_generic WHERE enrol_details.index_no = enrol_generic.indexNo and enrol_details.s_code = '$s_code' and enrol_generic.status = 'BOARDING'"); if(mysqli_num_rows($select_css) < 1){ echo $boarder = 0; } else { $howmany = mysqli_fetch_array($select_css); echo $boarder = $howmany['total']; } ?></h3> </div> </div> </div><!-- end col --> <div class="col-lg-4"> <div class="card bg-danger border-info text-white-50"> <div class="card-body"> <h5 class="mb-3 text-white">TOTAL DAY STUDENTS</h5> <h3 style="color:#fff"><?php $select_css = mysqli_query($new,"SELECT count(id) as total FROM enrol_details,enrol_generic WHERE enrol_details.index_no = enrol_generic.indexNo and enrol_details.s_code = '$s_code' and enrol_generic.status = 'DAY'"); if(mysqli_num_rows($select_css) < 1){ echo $boarder = 0; } else { $howmany = mysqli_fetch_array($select_css); echo $boarder = $howmany['total']; } ?></h3> </div> </div> </div><!-- end col --> </div> <br /><br /> <h2>Assign student to house</h2> <form method="POST"> <div class="row"> <div class="col-6"> <select class="form-control" name="className" required> <option value="">Select programme</option> <?php $getprogramme = mysqli_query($new,"SELECT * FROM programme WHERE s_code = '$s_code'"); while($fetchrow = mysqli_fetch_array($getprogramme)){ ?> <option value="<?php echo $fetchrow['program_name'];?>"><?php echo $fetchrow['program_name'];?> </option> <?php }?> </select> </div> <div class="col-4"> <button type="submit" name="find" class="btn btn-primary">Load</button> </div> </div> </form> <br /><br /> <br /><br /> <div class="col-xl-12"> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered mb-0 borded"> <thead> <tr> <th>#</th> <th>Student </th> <th>Student ID</th> <th>Gender</th> <th>Status</th> <td>House</td> </tr> </thead> <form method="POST"> <?php $cnt = 1; // Ensure that the query fetches `indexNo` correctly $does = mysqli_query($new, "SELECT enrol_generic.indexNo, enrol_generic.stud_name, enrol_details.schoolID,enrol_generic.gender, enrol_generic.status FROM enrol_generic JOIN enrol_details ON enrol_generic.indexNo = enrol_details.index_no WHERE enrol_generic.s_code = '$s_code' and enrol_generic.programme = '$className'"); // Debugging: Check if the query executed correctly if (!$does) { die("Query failed: " . mysqli_error($new)); } while ($getInfo = mysqli_fetch_array($does)) { ?> <tr> <th><?php echo $cnt++; ?></th> <td><?php echo $getInfo['stud_name']; ?></td> <td><?php echo $getInfo['schoolID']; ?></td> <td><?php echo $getInfo['gender']; ?></td> <td><?php echo $getInfo['status']; ?></td> <td> <select class="form-control" name="house_id[]"> <option value="">--SELECT HOUSE--</option> <?php $home = mysqli_query($new, "SELECT * FROM house WHERE school_code = '$s_code'"); // Debugging: Check if the query executed correctly if (!$home) { die("Query failed: " . mysqli_error($new)); } while ($gethouse = mysqli_fetch_array($home)) { ?> <option value="<?php echo $gethouse['hid']; ?>"><?php echo $gethouse['house_name']; ?></option> <?php } ?> </select> <!-- Add a hidden field to store the index number --> <input type="hidden" name="indexNo[]" value="<?php echo $getInfo['indexNo']; ?>"> </td> </tr> <?php } ?> </tbody> </table> <br /><br /> <?php if($namee != "Admin"){?> <?php $permission_name = 'manage_house_location '; if (has_permission($userid, $permission_name,'can_create', $new)) { echo '<button type="submit" name="assignHome" class="btn btn-success">Submit</button> '; } else { echo '<button type="button" class="btn btn-primary waves-effect waves-light">No access</button>'; } ?> <?php } else {?> <button type="submit" name="assignHome" class="btn btn-success">Submit</button> <?php }?> </form> </div> </div> <!-- end card --> </div> </div> </div> <div class="modal fade bs-example-modal-lgset" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="myLargeModalLabel">Edit School Details</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <!-- Centering the form and limiting its width --> <div class="container"> <div class="row justify-content-center"> <div class="col-md-8 col-lg-8"> <!-- Adjust the column size as needed --> <form method="POST"> <?php echo csrf_token_tag(); ?> <div class="mb-4"> <label for="exampleInputEmail1" class="form-label">Search Student by (Name, IndexNo, Boarding Status)</label> <input type="text" class="form-control" name="school_head" value="<?php echo $head;?>"> </div> <button type="submit" name="submit" class="btn btn-primary">Search</button> </form> </div> </div> </div> </div> </div> </div> </div> </div> <!-- End Page-content --> <?php include("includes/footer.php");?> </div> <!-- end main content--> </div> <!-- END layout-wrapper --> <!-- Right Sidebar --> <div class="right-bar"> <div data-simplebar class="h-100"> <div class="rightbar-title d-flex align-items-center p-3"> <h5 class="m-0 me-2">Theme Customizer</h5> <a href="javascript:void(0);" class="right-bar-toggle ms-auto"> <i class="mdi mdi-close noti-icon"></i> </a> </div> <!-- Settings --> <hr class="m-0" /> <div class="p-4"> <h6 class="mb-3">Layout</h6> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout" id="layout-vertical" value="vertical"> <label class="form-check-label" for="layout-vertical">Vertical</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout" id="layout-horizontal" value="horizontal"> <label class="form-check-label" for="layout-horizontal">Horizontal</label> </div> <h6 class="mt-4 mb-3 pt-2">Layout Mode</h6> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout-mode" id="layout-mode-light" value="light"> <label class="form-check-label" for="layout-mode-light">Light</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout-mode" id="layout-mode-dark" value="dark"> <label class="form-check-label" for="layout-mode-dark">Dark</label> </div> <h6 class="mt-4 mb-3 pt-2">Layout Width</h6> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout-width" id="layout-width-fuild" value="fuild" onchange="document.body.setAttribute('data-layout-size', 'fluid')"> <label class="form-check-label" for="layout-width-fuild">Fluid</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout-width" id="layout-width-boxed" value="boxed" onchange="document.body.setAttribute('data-layout-size', 'boxed')"> <label class="form-check-label" for="layout-width-boxed">Boxed</label> </div> <h6 class="mt-4 mb-3 pt-2">Layout Position</h6> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout-position" id="layout-position-fixed" value="fixed" onchange="document.body.setAttribute('data-layout-scrollable', 'false')"> <label class="form-check-label" for="layout-position-fixed">Fixed</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout-position" id="layout-position-scrollable" value="scrollable" onchange="document.body.setAttribute('data-layout-scrollable', 'true')"> <label class="form-check-label" for="layout-position-scrollable">Scrollable</label> </div> <h6 class="mt-4 mb-3 pt-2">Topbar Color</h6> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="topbar-color" id="topbar-color-light" value="light" onchange="document.body.setAttribute('data-topbar', 'light')"> <label class="form-check-label" for="topbar-color-light">Light</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="topbar-color" id="topbar-color-dark" value="dark" onchange="document.body.setAttribute('data-topbar', 'dark')"> <label class="form-check-label" for="topbar-color-dark">Dark</label> </div> <h6 class="mt-4 mb-3 pt-2 sidebar-setting">Sidebar Size</h6> <div class="form-check sidebar-setting"> <input class="form-check-input" type="radio" name="sidebar-size" id="sidebar-size-default" value="default" onchange="document.body.setAttribute('data-sidebar-size', 'lg')"> <label class="form-check-label" for="sidebar-size-default">Default</label> </div> <div class="form-check sidebar-setting"> <input class="form-check-input" type="radio" name="sidebar-size" id="sidebar-size-compact" value="compact" onchange="document.body.setAttribute('data-sidebar-size', 'md')"> <label class="form-check-label" for="sidebar-size-compact">Compact</label> </div> <div class="form-check sidebar-setting"> <input class="form-check-input" type="radio" name="sidebar-size" id="sidebar-size-small" value="small" onchange="document.body.setAttribute('data-sidebar-size', 'sm')"> <label class="form-check-label" for="sidebar-size-small">Small (Icon View)</label> </div> <h6 class="mt-4 mb-3 pt-2 sidebar-setting">Sidebar Color</h6> <div class="form-check sidebar-setting"> <input class="form-check-input" type="radio" name="sidebar-color" id="sidebar-color-light" value="light" onchange="document.body.setAttribute('data-sidebar', 'light')"> <label class="form-check-label" for="sidebar-color-light">Light</label> </div> <div class="form-check sidebar-setting"> <input class="form-check-input" type="radio" name="sidebar-color" id="sidebar-color-dark" value="dark" onchange="document.body.setAttribute('data-sidebar', 'dark')"> <label class="form-check-label" for="sidebar-color-dark">Dark</label> </div> <div class="form-check sidebar-setting"> <input class="form-check-input" type="radio" name="sidebar-color" id="sidebar-color-brand" value="brand" onchange="document.body.setAttribute('data-sidebar', 'brand')"> <label class="form-check-label" for="sidebar-color-brand">Brand</label> </div> <h6 class="mt-4 mb-3 pt-2">Direction</h6> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout-direction" id="layout-direction-ltr" value="ltr"> <label class="form-check-label" for="layout-direction-ltr">LTR</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout-direction" id="layout-direction-rtl" value="rtl"> <label class="form-check-label" for="layout-direction-rtl">RTL</label> </div> </div> </div> <!-- end slimscroll-menu--> </div> <!-- /Right-bar --> <!-- Right bar overlay--> <div class="rightbar-overlay"></div> <!-- JAVASCRIPT --> <script src="assets/libs/jquery/jquery.min.js"></script> <script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script> <script src="assets/libs/metismenu/metisMenu.min.js"></script> <script src="assets/libs/simplebar/simplebar.min.js"></script> <script src="assets/libs/node-waves/waves.min.js"></script> <script src="assets/libs/feather-icons/feather.min.js"></script> <!-- pace js --> <script src="assets/libs/pace-js/pace.min.js"></script> <script src="assets/libs/sweetalert2/sweetalert2.min.js"></script> <script src="assets/js/app.js"></script> </body> </html> <?php } }?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.73 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002