62 lines
1.5 KiB
HTML

<div id="panels">
<div id="left_panel">
Zde budou uživatelé.
</div>
<div id="right_panel">
<button onclick="remove_user()" id="remove_btn">Odstranit Uživatele</button>
</div>
</div>
<script>
var right_panel_buffer = null;
var username = null;
$(document).ready(function()
{
$("#remove_btn").hide();
});
$.ajax
({
url: "./res/forum/api/list_users.php",
success: function(result)
{
let users = "";
for (let i in result.users)
{
users += "<div class=\"output\">" + result.users[i] + "</div>";
}
$("#left_panel").html(users);
}
});
$("#left_panel").on("click", ".output", function(event)
{
$("#remove_btn").show();
if (right_panel_buffer == null) right_panel_buffer = document.getElementById("right_panel").innerHTML;
username = event.target.innerHTML;
$.ajax
({
url: "./res/forum/api/user_info.php?username=" + event.target.innerHTML,
success: function(result)
{
$("#right_panel").html(result + right_panel_buffer);
}
});
});
function remove_user()
{
$.ajax
({
url: "./res/forum/api/remove_user.php?username=" + username,
success: function(result)
{
//location.reload();
show("admin");
}
});
}
</script>