| Server IP : 172.67.187.206 / Your IP : 172.71.28.156 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Inetpub/www/training/user/ |
Upload File : |
<?php
function thainumDigit($num){
return str_replace(array( '0' , '1' , '2' , '3' , '4' , '5' , '6' ,'7' , '8' , '9' ),
array( "o" , "๑" , "๒" , "๓" , "๔" , "๕" , "๖" , "๗" , "๘" , "๙" ),
$num);
};
include '../db.php';
include('../pdf1.84/fpdf.php');
// เริ่ม session ถ้ายังไม่ได้เริ่ม
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
// รับค่า id ที่ถูกเข้ารหัสมาจาก URL และทำการถอดรหัส
$encoded_id = $_REQUEST['id'];
$id = base64_decode($encoded_id);
// รับค่าชื่อจาก session
$nm = $_SESSION['nm'];
// ตรวจสอบว่ามีชื่อหรือไม่
if (empty($nm)) {
echo "ไม่พบข้อมูลชื่อผู้ใช้";
exit;
}
// สร้างเลขที่เกียรติบัตร (เป็นตัวอย่าง - คุณอาจจะใช้ logic อื่น)
$cert_id = date('Y') . sprintf('%04d', $id);
$pdf = new FPDF('L', 'mm', 'A4');
$pdf->SetAutoPageBreak(false);
$pdf->AddPage();
$pdf->AddFont('sarabun','','THSarabun.php');
$pdf->AddFont('sarabunb','','THSarabunB.php');
$pdf->Image('img/hero68.png', 0, 0, 297, 210);
$pdf->SetXY(49, 44.5);
$pdf->SetFont('sarabunb', '', 48);
$pdf->SetTextColor(26, 35, 126);
$pdf->Cell(200, 84, iconv('utf-8', 'cp874', $nm), 0, 1, 'C');
$pdf->SetXY(200, 13);
$pdf->SetFont('sarabun', '', 18);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(65, 40, iconv('utf-8', 'cp874', 'เลขที่ สพม.รบ. ' . thainumDigit($cert_id) . '/๒๕๖๘'), 0, 1, 'R');
$pdf->Output();
?>