File manager - Edit - /home/webapp68.cm.in.th/u68319090024/final/news/manage_users.html
Back
<!DOCTYPE html> <html lang="th"> <head> <meta charset="UTF-8"> <title>จัดการผู้ใช้งาน</title> <style> body { font-family: Arial; margin:20px; background:#f4f4f4; } h1 { text-align:center; color:#333; } table { width:60%; margin:20px auto; border-collapse: collapse; background:#fff; } th, td { padding:10px; border:1px solid #ccc; text-align:center; } th { background:#007BFF; color:#fff; } button { padding:5px 10px; border:none; border-radius:5px; cursor:pointer; margin:2px; } .add { background:#28a745; color:#fff; } .edit { background:#ffc107; color:#fff; } .delete { background:#dc3545; color:#fff; } a { display:block; text-align:center; margin-top:20px; text-decoration:none; color:#007BFF; } </style> </head> <body> <h1>จัดการผู้ใช้งาน</h1> <button class="add" onclick="addUser()">เพิ่มผู้ใช้งาน</button> <table id="userTable"> <tr><th>ID</th><th>Username</th><th>Role</th><th>Actions</th></tr> </table> <a href="index.html">กลับไป Dashboard</a> <script> let users = window.opener.dataStore.users; function renderUsers(){ let table = document.getElementById("userTable"); table.innerHTML = '<tr><th>ID</th><th>Username</th><th>Role</th><th>Actions</th></tr>'; users.forEach((u,i)=>{ let row = table.insertRow(); row.insertCell(0).innerText = i+1; row.insertCell(1).innerText = u.username; row.insertCell(2).innerText = u.role; row.insertCell(3).innerHTML = `<button class="edit" onclick="editUser(${i})">แก้ไข</button> <button class="delete" onclick="deleteUser(${i})">ลบ</button>`; }); } function addUser(){ let username = prompt("Username:"); if(!username) return; let role = prompt("Role (Admin/Editor):"); if(!role) role="Editor"; users.push({username, role}); renderUsers(); } function editUser(index){ let username = prompt("แก้ไข Username:", users[index].username); if(username) users[index].username = username; let role = prompt("แก้ไข Role:", users[index].role); if(role) users[index].role = role; renderUsers(); } function deleteUser(index){ if(confirm("คุณต้องการลบผู้ใช้งานนี้หรือไม่?")){ users.splice(index,1); renderUsers(); } } renderUsers(); </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.44 |
proxy
|
phpinfo
|
Settings