File manager - Edit - /home/webapp68.cm.in.th/u68319090026/final/news/login.html
Back
<!DOCTYPE html> <html lang="th"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>ระบบเข้าสู่ระบบ</title> <link href="https://fonts.googleapis.com/css2?family=Sarabun&display=swap" rel="stylesheet" /> <style> body { font-family: 'Sarabun', sans-serif; max-width: 400px; margin: 60px auto; background: #f0f4f8; padding: 20px; border-radius: 8px; box-shadow: 0 0 15px rgba(0,0,0,0.1); } h2 { text-align: center; margin-bottom: 20px; } input { width: 100%; padding: 10px; margin: 10px 0; box-sizing: border-box; border-radius: 4px; border: 1px solid #ccc; } button { width: 100%; padding: 10px; background-color: #3366cc; color: white; border: none; border-radius: 4px; font-size: 16px; cursor: pointer; margin-top: 10px; } button:hover { background-color: #254a99; } .tab-nav { text-align: center; margin-bottom: 20px; } .tab-nav button { display: inline-block; padding: 10px 20px; margin: 0 5px; font-weight: 600; border: none; background: #ddd; border-radius: 4px 4px 0 0; cursor: pointer; } .tab-nav button.active { background: #3366cc; color: white; } .switch-link { text-align: center; margin-top: 12px; } .switch-link a { color: #3366cc; cursor: pointer; text-decoration: none; font-weight: 600; } .switch-link a:hover { text-decoration: underline; } </style> </head> <body> <div class="tab-nav"> <button id="adminTab" class="active">Admin</button> <button id="studentTab">นักเรียน</button> </div> <div id="adminForm"> <h2>เข้าสู่ระบบ แอดมิน</h2> <input type="text" id="admin-username" placeholder="ชื่อผู้ใช้" required /> <input type="password" id="admin-password" placeholder="รหัสผ่าน" required /> <button onclick="loginAs('admin')">เข้าสู่ระบบ</button> <div class="switch-link">หรือเป็น <a onclick="showStudentForm()">นักเรียน</a></div> </div> <div id="studentForm" style="display:none;"> <h2>เข้าสู่ระบบ นักเรียน</h2> <input type="text" id="student-username" placeholder="รหัสนักเรียน" required /> <input type="password" id="student-password" placeholder="รหัสผ่าน" required /> <button onclick="loginAs('student')">เข้าสู่ระบบ</button> <div class="switch-link">หรือเป็น <a onclick="showAdminForm()">แอดมิน</a></div> </div> <script> // สลับฟอร์ม const adminTab = document.getElementById('adminTab'); const studentTab = document.getElementById('studentTab'); const adminForm = document.getElementById('adminForm'); const studentForm = document.getElementById('studentForm'); adminTab.onclick = () => showAdminForm(); studentTab.onclick = () => showStudentForm(); function showAdminForm() { adminForm.style.display = 'block'; studentForm.style.display = 'none'; adminTab.classList.add('active'); studentTab.classList.remove('active'); } function showStudentForm() { studentForm.style.display = 'block'; adminForm.style.display = 'none'; studentTab.classList.add('active'); adminTab.classList.remove('active'); } // ข้อมูลล็อกอิน (Hardcoded) const adminUsers = [ { username: 'admin', password: 'admin123' }, { username: 'admin2', password: 'adminpass2' } ]; const studentUsers = [ { username: 'stu001', password: '1234' }, { username: 'stu002', password: 'abcd' } ]; function loginAs(role) { if (role === 'admin') { const username = document.getElementById('admin-username').value.trim(); const password = document.getElementById('admin-password').value.trim(); const found = adminUsers.find(u => u.username === username && u.password === password); if (found) { localStorage.setItem('isAdminLoggedIn', 'true'); localStorage.setItem('currentUserRole', 'admin'); window.location.href = 'dashboard.html'; // ✅ เปลี่ยนเป็น admin_dashboard.html } else { alert('ชื่อผู้ใช้หรือรหัสผ่านแอดมินไม่ถูกต้อง'); } } else if (role === 'student') { const username = document.getElementById('student-username').value.trim(); const password = document.getElementById('student-password').value.trim(); const found = studentUsers.find(u => u.username === username && u.password === password); if (found) { localStorage.setItem('isStudentLoggedIn', 'true'); localStorage.setItem('currentUserRole', 'student'); localStorage.setItem('currentStudentUsername', username); window.location.href = 'student_dashboard.html'; // ✅ เปลี่ยนเป็น student_dashboard.html } else { alert('รหัสนักเรียนหรือรหัสผ่านไม่ถูกต้อง'); } } } </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.68 |
proxy
|
phpinfo
|
Settings