Gestionnaire de fichiers - Editer - /home/kridsana/webapp.cm.in.th/663012801/u66301280015/Checking/index.php
Arrière
<!DOCTYPE html> <html> <head> <title>Student Folder Checker</title> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=K2D:wght@400;500;600&display=swap" rel="stylesheet"> <style> body { font-family: 'K2D', sans-serif; margin: 20px; background-color: #f0f2f5; } .container { max-width: 1000px; margin: 0 auto; background-color: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } h1 { color: #333; text-align: center; font-weight: 600; } table { width: 100%; border-collapse: collapse; margin-top: 20px; } th, td { border: 1px solid #ddd; padding: 12px; text-align: center; } th { background-color: #2c3e50; color: white; font-weight: 500; } tr:hover { filter: brightness(95%); } a { color: #0066cc; text-decoration: none; } a:hover { text-decoration: underline; } .check { background-color: #64ff64; color: #ffffff; font-weight: 500; } .cross { background-color: #ff7d7d; color: #ffffff; font-weight: 500; } .loading { color: #666; font-style: italic; background-color: #f8f9fa; } .status { text-align: center; margin: 10px 0 20px 0; padding: 10px; background-color: #f8f9fa; border-radius: 4px; font-weight: 500; } tr:nth-child(even) td:first-child { background-color: #f8f9fa; } </style> </head> <body> <div class="container"> <h1>ระบบตรวจสอบการส่งงาน</h1> <div id="status" class="status">กำลังตรวจสอบ</div> <table id="folderTable"> <thead> <tr> <th>รหัสนักศึกษา</th> <th>P001</th> <th>P002</th> <th>P003</th> <th>Final</th> </tr> </thead> <tbody id="tableBody"> </tbody> </table> </div> <script> async function checkFolderExists(studentId) { const url = `https://webapp.cm.in.th/663012801/${studentId}/`; try { const response = await fetch(url, { method: 'HEAD', mode: 'cors', cache: 'no-cache' }); return response.ok; } catch (error) { console.error(`Error checking ${studentId}:`, error); return false; } } async function checkSubFolder(studentId, folder) { const variants = [ folder, folder.toLowerCase(), folder.toUpperCase() ]; for (const variant of variants) { const url = `https://webapp.cm.in.th/663012801/${studentId}/${variant}/`; try { const response = await fetch(url, { method: 'HEAD', mode: 'cors', cache: 'no-cache' }); if (response.ok) { return true; } } catch (error) { console.error(`Error checking ${studentId}/${variant}:`, error); } } return false; } async function updateTable() { const tableBody = document.getElementById('tableBody'); const statusDiv = document.getElementById('status'); const folders = ['P001', 'P002', 'P003', 'Final']; let existingFolders = 0; let checkedFolders = 0; for (let i = 2; i <= 31; i++) { const studentId = `u66301280${i.toString().padStart(3, '0')}`; const exists = await checkFolderExists(studentId); if (!exists) continue; existingFolders++; const row = document.createElement('tr'); const idCell = document.createElement('td'); const link = document.createElement('a'); link.href = `https://webapp.cm.in.th/663012801/${studentId}`; link.target = '_blank'; link.textContent = studentId; idCell.appendChild(link); row.appendChild(idCell); for (const folder of folders) { const cell = document.createElement('td'); cell.textContent = '⋯'; cell.className = 'loading'; row.appendChild(cell); checkSubFolder(studentId, folder).then(exists => { cell.textContent = exists ? '✓' : '✗'; cell.className = exists ? 'check' : 'cross'; checkedFolders++; const totalToCheck = existingFolders * folders.length; const progress = Math.round((checkedFolders/totalToCheck) * 100); statusDiv.textContent = `กำลังตรวจสอบ ${progress}%`; if (checkedFolders === totalToCheck) { statusDiv.textContent = 'ตรวจสอบเสร็จสิ้น'; } }); } tableBody.appendChild(row); } if (existingFolders === 0) { statusDiv.textContent = 'ไม่พบโฟลเดอร์ที่ต้องการตรวจสอบ'; } } document.addEventListener('DOMContentLoaded', updateTable); </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Génération de la page: 0.22 |
proxy
|
phpinfo
|
Réglages