[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: adminssion-letter.php
<?php // Show all errors for debugging (remove in production) // ini_set('display_errors', 1); // ini_set('display_startup_errors', 1); // error_reporting(E_ALL); require("fpdf/fpdf.php"); include("../functions.php"); // Include QR Code library require_once("phpqrcode/qrlib.php"); $myidex = $_SESSION['index_no78897498']; // Fetch student data $indexx = mysqli_query($new,"SELECT * FROM enrol_generic WHERE indexNo = '$myidex'"); $fetchsch = mysqli_fetch_array($indexx); $school_code = $fetchsch['s_code']; $student_name = $fetchsch['stud_name']; $stu_status = $fetchsch['status']; $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']; $stype = $logocon['school_type']; $indexx1 = mysqli_query($new,"SELECT * FROM enrol_details WHERE index_no = '$myidex' and s_code = '$school_code'"); $fetchschh = mysqli_fetch_array($indexx1); $photo = $fetchschh['photo']; $enrol_code = $fetchschh['enrol_code']; $schoolID = $fetchschh['schoolID']; $indexx11 = mysqli_query($new,"SELECT * FROM admission_info WHERE s_code = '$school_code'"); $fetchschhh = mysqli_fetch_array($indexx11); $ACADEMIC = $fetchschhh['academic_year']; $re_opening_date = $fetchschhh['re_opening_date']; $studentD = mysqli_query($new,"SELECT * FROM enrol_details,class WHERE enrol_details.index_no = '$myidex' 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 = '$myidex'"); $hname = mysqli_fetch_array($getHow); $house_name = $hname['house_name']; $schoolID = $hname['schoolID']; // =================== PDF CREATION =================== $pdf = new FPDF(); $pdf->AddPage(); $logoPath = empty($logoo) ? "myprofile.png" : "../admin/$logoo"; $profilePicturePath = empty($photo) ? "myprofile.png" : "../admin/$photo"; // 1️⃣ CREATE CENTERED, ROTATED, SEMI-TRANSPARENT WATERMARK if (file_exists($logoPath)) { $ext = strtolower(pathinfo($logoPath, PATHINFO_EXTENSION)); $src = null; if ($ext === 'png') $src = imagecreatefrompng($logoPath); elseif (in_array($ext, ['jpeg','jpg'])) $src = imagecreatefromjpeg($logoPath); elseif ($ext === 'gif') $src = imagecreatefromgif($logoPath); if ($src) { $width = imagesx($src); $height = imagesy($src); $targetWidth = 1000; $targetHeight = intval(($targetWidth / $width) * $height); $resized = imagecreatetruecolor($targetWidth, $targetHeight); imagecopyresampled($resized, $src, 0, 0, 0, 0, $targetWidth, $targetHeight, $width, $height); $rotated = imagerotate($resized, 45, imagecolorallocatealpha($resized, 255, 255, 255, 127)); $output = imagecreatetruecolor(imagesx($rotated), imagesy($rotated)); $white = imagecolorallocate($output, 255, 255, 255); imagefill($output, 0, 0, $white); imagecopymerge($output, $rotated, 0, 0, 0, 0, imagesx($rotated), imagesy($rotated), 27); $tempLogo = tempnam(sys_get_temp_dir(), 'wm_').".png"; imagepng($output, $tempLogo); imagedestroy($src); imagedestroy($resized); imagedestroy($rotated); imagedestroy($output); $pageWidth = 210; $pageHeight = 297; $wmWidth = 140; $wmX = ($pageWidth - $wmWidth) / 2; $wmY = ($pageHeight - ($wmWidth * 0.7)) / 2; $pdf->Image($tempLogo, $wmX, $wmY, $wmWidth); unlink($tempLogo); } } // HEADER $pdf->Image($profilePicturePath, 10, 10, 30); $pdf->Image($logoPath, 170, 10, 30); $pdf->SetFont('Arial', 'B', 14); $pdf->Cell(0, 8, utf8_decode(html_entity_decode($school_name)), 0, 1, 'C'); $pdf->SetFont('Arial', '', 12); $pdf->Cell(0, 5, "$school_location", 0, 1, 'C'); $pdf->Ln(3); $pdf->SetFont('Arial', '', 10); $pdf->Cell(0, 5,"$head_title", 0, 1, 'C'); $pdf->Cell(0, 5, "PHONE: $phone_num", 0, 1, 'C'); $pdf->Cell(0, 5, "EMAIL: $school_email", 0, 1, 'C'); $pdf->Ln(5); $pdf->SetFont('Arial', '', 12); if($stype == 'GES'){ $pdf->Cell(0, 5, '(GHANA EDUCATION SERVICE)', 0, 1, 'C'); } else { $pdf->Cell(0, 5, '(TECHNICAL AND VOCATIONAL EDUCATION AND TRAINING)', 0, 1, 'C'); } $pdf->Ln(10); // BODY CONTENT $pdf->Cell(0, 8, 'Dear Student,', 0, 1); $pdf->SetFont('Arial', 'B', 12); $pdf->MultiCell(0, 8, 'OFFER OF ADMISSION INTO - '.$ACADEMIC.' ACADEMIC YEAR', 0, 'C'); $pdf->SetFont('Arial', '', 11); $pdf->MultiCell(0, 7, "ENROLMENT CODE: ".$enrol_code. "\nNAME OF CANDIDATE: ".$student_name. "\nRESIDENCE STATUS: ".$stu_status. "\nPROGRAMME OFFERED: ".$programme." [".$c_name."]". "\nHOUSE: ".$house_name. "\nSTUDENT ID: ".$schoolID, 0, 'L'); $pdf->Ln(3); if($stype == 'GES'){ $pdf->MultiCell(0, 7, "I am pleased to inform you that you have been offered a place at ".$school_name." to pursue a 3-year Pre-Tertiary programme leading to the West Africa Senior School Certificate Examination.", 0, 'L'); $pdf->Ln(3); } else { $pdf->MultiCell(0, 7, "I am pleased to inform you that you have been offered a place at ".$school_name." to pursue a 3-year Pre-Tertiary programme leading to the award of CERTIFICATE II by Commission for Technical and Vocational Education and Training (CTVET)", 0, 'L'); $pdf->Ln(3); } // $pdf->MultiCell(0, 7, "I am pleased to inform you that you have been offered a place at ".$school_name." to pursue a 3-year Pre-Tertiary programme leading to the West Africa Senior School Certificate Examination.", 0, 'L'); // $pdf->Ln(3); $pdf->MultiCell(0, 6, "1. The reporting date for all first-year students is on ".$re_opening_date ." \n 2. You will be required to adhere religiously to all school rules and regulations as a student.\n 3. All students of the school are considered to be on probation throughout their stay in the school and could be withdrawn/dismissed at any time for gross misconduct.\n 4. On the reporting day, you are to submit a printed copy of this Admission Letter to the Senior Housemaster/Housemistress for registration and other admission formalities.\n 5. All students are expected to have active Health Insurance cards and this would be inspected by the Housemaster/Housemistress.\n 6. We congratulate you on your admission and look forward to welcoming you to the ".$school_name.".", 0, 'L'); $pdf->Ln(5); // ADD BORDER LINE $pdf->SetDrawColor(0, 0, 0); $pdf->Line(10, $pdf->GetY(), 200, $pdf->GetY()); $pdf->Ln(8); // SINCERELY & QR CODE $pdf->SetFont('Arial', '', 11); $pdf->Cell(0, 8, 'Sincerely,', 0, 1, 'L'); // ✅ Step 1: Generate simple clean text $qrContent = "Admission Verification\n" . "School: $school_name\n" . "Student: $student_name\n" . "Enrolment: $enrol_code\n" . "Programme: $programme"; // ✅ Step 2: Generate QR code (force PNG, no compression issues) $qrTempFile = sys_get_temp_dir() . "/qr_" . uniqid() . ".png"; QRcode::png($qrContent, $qrTempFile, QR_ECLEVEL_L, 6); // Increase size from 4 ➝ 6 // ✅ Step 3: Add QR code to PDF $pdf->Image($qrTempFile, 160, $pdf->GetY() - 15, 40); // Make it slightly larger unlink($qrTempFile); $pdf->Ln(10); $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(0, 5, "$school_head", 0, 1); $pdf->Output('I', 'Admission_Letter.pdf'); ?>
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.99 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