File manager - Edit - /var/www/order.cmtc.ac.th/admin/clear_log.php
Back
<?php session_start(); include('../config/db.php'); // ตรวจสอบสิทธิ์เข้าใช้งาน if (!isset($_SESSION['admin'])) { header("Location: index.php"); exit; } $log_file = '../includes/auto_clear_log.txt'; $log_data = ''; if (file_exists($log_file)) { $log_data = file_get_contents($log_file); $log_lines = array_reverse(explode("\n", trim($log_data))); // แสดงจากรายการล่าสุดก่อน } else { $log_lines = []; } ?> <!DOCTYPE html> <html lang="th"> <head> <meta charset="UTF-8"> <title>🧾 รายการเคลียร์สินค้าอัตโนมัติ</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;600&display=swap" rel="stylesheet"> <style> body { font-family: 'Kanit', sans-serif; background: #f9f9f9; } .container { max-width: 900px; margin-top: 50px; } .card { border-radius: 12px; box-shadow: 0 3px 10px rgba(0,0,0,0.1); } pre { background: #f1f3f5; border-radius: 10px; padding: 15px; font-size: 0.9rem; } .btn-refresh { background: linear-gradient(45deg, #007bff, #00a6ff); color: white; border: none; } .btn-refresh:hover { opacity: 0.9; } </style> </head> <body> <div class="container"> <div class="card p-4"> <h3 class="mb-3 text-center">🧾 รายการคืนสินค้าอัตโนมัติ (Auto Clear Reserved)</h3> <div class="d-flex justify-content-between align-items-center mb-3"> <a href="orders.php" class="btn btn-secondary">⬅️ กลับหน้า Orders</a> <a href="clear_log.php" class="btn btn-refresh">🔄 รีเฟรชข้อมูล</a> </div> <?php if(empty($log_lines)): ?> <div class="alert alert-warning text-center">ยังไม่มีข้อมูล Log การคืนสินค้า</div> <?php else: ?> <pre> <?php $display_count = 50; // จำนวนบรรทัดล่าสุดที่ต้องการแสดง $lines_to_show = array_slice($log_lines, 0, $display_count); foreach ($lines_to_show as $line) { echo htmlspecialchars($line) . "\n"; } ?> </pre> <p class="text-muted text-end small"> แสดงเพียง <?=count($lines_to_show)?> รายการล่าสุด </p> <?php endif; ?> </div> </div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.4 |
proxy
|
phpinfo
|
Settings