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 :  /Inetpub/www/work/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Inetpub/www/work/print_report.php
<?php 
require_once 'config.php';
require_once 'functions.php';

// ตรวจสอบการ Login
if(!isset($_SESSION['u_id'])){ header("Location: index.php"); exit(); }

$current_user_id = $_SESSION['u_id'];
$is_admin = ($_SESSION['type'] == 'admin');

// 1. ป้องกันการแก้ไข GET ID ใน URL
$att_id = isset($_GET['id']) ? $_GET['id'] : null;

// ตรวจสอบว่าเป็นตัวเลขเท่านั้น
if ($att_id !== null && !is_numeric($att_id)) {
    die("Access Denied: Invalid ID Format");
}

// ดึงข้อมูลการเข้างาน และตรวจสอบสิทธิ์ (ถ้าไม่ใช่ Admin ต้องดูได้เฉพาะของตัวเอง)
$where_clause = "";
if ($att_id) {
    $where_clause = " AND a.att_id = " . (int)$att_id;
}

$sql = "SELECT a.*, u.fullname, u.position, u.signature, g.g_name 
        FROM attendance a
        JOIN users u ON a.u_id = u.u_id
        LEFT JOIN groups g ON u.g_id = g.g_id
        WHERE 1=1 $where_clause";

// ถ้าไม่ใช่ Admin ให้กรองดูได้เฉพาะข้อมูลตัวเองเท่านั้น เพื่อความปลอดภัย [cite: 2025-07-09]
if (!$is_admin) {
    $sql .= " AND a.u_id = '$current_user_id'";
}

$res = mysqli_query($conn, $sql);
$data_list = [];
while($row = mysqli_fetch_assoc($res)){ $data_list[] = $row; }

if (empty($data_list)) { die("ไม่พบข้อมูลที่ต้องการพิมพ์ หรือคุณไม่มีสิทธิ์เข้าถึงข้อมูลนี้"); }

// ใช้ข้อมูลจากแถวแรกมาแสดงหัวกระดาษ
$user_info = $data_list[0];
?>
<!DOCTYPE html>
<html lang="th">
<head>
    <meta charset="UTF-8">
    <title>รายงานการปฏิบัติงาน - <?php echo $user_info['fullname']; ?></title>
    <link href="https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;600&display=swap" rel="stylesheet">
    <style>
        body { font-family: 'Sarabun', sans-serif; font-size: 16px; color: #000; margin: 0; padding: 40px; }
        .header { text-align: center; margin-bottom: 30px; line-height: 1.8; }
        .title { font-size: 20px; font-weight: bold; }
        
        table { width: 100%; border-collapse: collapse; margin-top: 20px; }
        table, th, td { border: 1px solid #333; }
        th { background-color: #f2f2f2; padding: 12px; text-align: center; }
        td { padding: 10px; vertical-align: top; }
        
        .signature-container {
            margin-top: 50px;
            float: right;
            width: 350px;
            text-align: center;
        }
        .signature-img {
            max-height: 80px;
            display: block;
            margin: 0 auto -15px auto; /* ดึงภาพลงมาทับเส้นบรรทัดเล็กน้อยเพื่อความสมจริง */
        }
        .sign-line { margin-bottom: 10px; }
        
        @media print {
            .no-print { display: none; }
            body { padding: 0; }
        }
    </style>
</head>
<body onload="window.print()">

    <div class="no-print" style="margin-bottom: 20px; text-align: right;">
        <button onclick="window.print()" style="padding: 10px 20px; cursor: pointer;">พิมพ์รายงานนี้ (Print)</button>
        <button onclick="window.close()" style="padding: 10px 20px; cursor: pointer;">ปิดหน้าต่าง</button>
    </div>

    <div class="header">
        <div class="title">แบบบันทึกการปฏิบัติงานรายวัน</div>
        <div><strong>ชื่อ-นามสกุล:</strong> <?php echo $user_info['fullname']; ?> &nbsp;&nbsp; <strong>กลุ่มงาน:</strong> <?php echo $user_info['g_name']; ?></div>
    </div>

    <table>
        <thead>
            <tr>
                <th width="15%">วันที่</th>
                <th width="12%">เวลาเข้า</th>
                <th width="12%">เวลากลับ</th>
                <th>รายละเอียดภารกิจการปฏิบัติงาน</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach($data_list as $row): ?>
            <tr>
                <td align="center"><?php echo DateThai($row['att_date']); ?></td>
                <td align="center"><?php echo $row['time_in']; ?></td>
                <td align="center"><?php echo ($row['time_out'] == "00:00:00" ? "-" : $row['time_out']); ?></td>
                <td class="work-content-cell"><?php echo $row['work_detail']; ?></td>
            </tr>
            <?php endforeach; ?>
        </tbody>
    </table>

    <div class="signature-container">
        <div class="sign-wrapper">
            <?php if(!empty($user_info['signature'])): ?>
                <img src="uploads/<?php echo $user_info['signature']; ?>" class="signature-img">
            <?php else: ?>
                <div style="height: 65px;"></div>
            <?php endif; ?>
            
            <div class="sign-line">ลงชื่อ..........................................................</div>
            <div>( <?php echo $user_info['fullname']; ?> )</div>
            <div>ตำแหน่ง <?php echo $user_info['position']; ?></div>
        </div>
    </div>

</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit