function showKbanInfo(button) { let id = $(button).attr('id-data'); let diva = '#diva-' + id; $(diva + '-tr').slideToggle(); if ($(diva).attr('is_slided') == 0) { $(diva).attr('is_slided', 1); $(diva).slideDown(); $(diva).css('display', 'flex'); } else { $(diva).attr('is_slided', 0); $(diva).slideUp(); } } function getCsrfToken() { if (window.CSRF_TOKEN) { return window.CSRF_TOKEN; } const meta = document.querySelector('meta[name="csrf-token"]'); return meta ? meta.getAttribute('content') : ''; } function GoTop() { if (document.documentElement.scrollTop > 450 || document.body.scrollTop > 450) { document.body.scrollTop = 200; document.documentElement.scrollTop = 200; } } function ConfirmUnban(id, name, steamid) { let reason = prompt('Please type the reason why you would Kunban ' + name + '[' + steamid + ']'); let confirmMessage = 'Are you sure you want to Kunban ' + name + '[' + steamid + ']'; let confirmHandler = confirm(confirmMessage); if (confirmHandler == true) { UnBanByID(encodeURIComponent(id), encodeURIComponent(reason)); } } function UnBanByID(id, reason) { var xmlResponse1 = new XMLHttpRequest(); xmlResponse1.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { $('#diva-' + id).html(this.responseText); let trDiva = document.getElementById('diva-tr-' + id); trDiva.className = "row-expired"; let oldHtml = $('#length-' + id).html(); let newHtml = (oldHtml + ' (Removed)'); $('#length-' + id).html(newHtml); } }; xmlResponse1.open("POST", "functions_url.php", true); xmlResponse1.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlResponse1.send( "oldid=" + encodeURIComponent(id) + "&reason=" + encodeURIComponent(reason) + "&csrf_token=" + encodeURIComponent(getCsrfToken()) ); var xmlResponse2 = new XMLHttpRequest(); xmlResponse2.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { // Process xmlResponse2.responseText here } }; xmlResponse2.open("GET", "functions_url.php?id=" + encodeURIComponent(id), true); xmlResponse2.send(); } function ViewPlayerHistory(steamid, method) { let url = "index.php?all=true&s=" + encodeURIComponent(steamid) + "&m=" + encodeURIComponent(method); window.location.replace(url); } function RebanFromID(id) { let url = "manage.php?reban&oldid=" + encodeURIComponent(id); window.location.replace(url); } function EditFromID(id) { let url = "manage.php?edit&oldid=" + encodeURIComponent(id); window.location.replace(url); } function addNewKban(playerName, playerSteamID, length, reason) { var xmlResponse = new XMLHttpRequest(); xmlResponse.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { $('.error').html(xmlResponse.responseText); } }; xmlResponse.open("POST", "functions_url.php", true); xmlResponse.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlResponse.send( "add=1" + "&playerName=" + encodeURIComponent(playerName) + "&playerSteamID=" + encodeURIComponent(playerSteamID) + "&length=" + encodeURIComponent(length) + "&reason=" + encodeURIComponent(reason) + "&csrf_token=" + encodeURIComponent(getCsrfToken()) ); } function EditKban(id, playerName, playerSteamID, length, reason) { var xmlResponse1 = new XMLHttpRequest(); xmlResponse1.onreadystatechange = function() { if (this.readyState == 4) { if (this.status == 200) { $('.error').html(xmlResponse1.responseText); } else { $('.error').html("
Request failed (HTTP " + this.status + "). " + xmlResponse1.responseText + "
"); } } }; xmlResponse1.open("POST", "functions_url.php", true); xmlResponse1.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlResponse1.send( "edit=1" + "&id=" + encodeURIComponent(id) + "&playerName=" + encodeURIComponent(playerName) + "&playerSteamID=" + encodeURIComponent(playerSteamID) + "&length=" + encodeURIComponent(length) + "&reason=" + encodeURIComponent(reason) + "&csrf_token=" + encodeURIComponent(getCsrfToken()) ); } function RemoveKbanFromDBCheck(id) { let confirmMessage = "Are you sure you want to delete this kban from DB?"; let confirmHandler = confirm(confirmMessage); if (confirmHandler == true) { RemoveKbanFromDB(id); } } function RemoveKbanFromDB(id) { var xmlResponse1 = new XMLHttpRequest(); xmlResponse1.onreadystatechange = function() { if (this.readyState !== 4) { return; } if (this.status !== 200) { alert('Delete request failed (HTTP ' + this.status + ').'); return; } const response = (xmlResponse1.responseText || '').trim(); if (!response) { alert('Delete request returned an empty response.'); return; } // Keep backwards compatibility with PHP handlers returning . const scriptMatch = response.match(/