### CSRF Token Setup Source: https://status.advinservers.com/ Initializes CSRF token handling for AJAX requests upon document ready. It retrieves the CSRF token from a meta tag and sets it in the AJAX request headers. ```javascript jQuery(document).ready(function() { csrf_token(); }); function csrf_token() { const csrfToken = document.querySelector('meta[name="csrf-token"]').content; $.ajaxSetup({ headers: { 'X-CSRF-Token': csrfToken } }); } ``` -------------------------------- ### Firewall Rule for SSH Source: https://docs.advinservers.com/information/ddosprotection Example of creating a firewall rule to allow SSH traffic on TCP port 22. This ensures that SSH connections are permitted through the DDoS protection. ```configuration Protocol: TCP Preset: SSH (TCP) Min Port: 22 Max Port: Blank ``` -------------------------------- ### Firewall Rule for Minecraft Java Port Range Source: https://docs.advinservers.com/information/ddosprotection Example of creating a firewall rule to allow traffic for Minecraft Java servers across a range of TCP ports (25565 to 25575). ```configuration Protocol: TCP Preset: Minecraft Java (TCP) Min Port: 25565 Max Port: 25575 ``` -------------------------------- ### Diagnose Network Issues with mtr (Linux/macOS) Source: https://docs.advinservers.com/troubleshooting/network On Linux or macOS, install and run the 'mtr' command-line tool to diagnose network issues. Replace '' with your server's IP address and submit the output to support. ```bash # Install mtr (example for Debian/Ubuntu) sudo apt update && sudo apt install mtr # Or install mtr using Homebrew on macOS # brew install mtr # Run mtr to your server mtr ``` -------------------------------- ### Diagnose Packet Loss with WinMTR (Windows) Source: https://docs.advinservers.com/troubleshooting/network Use WinMTR on Windows to measure latency and identify packet loss to your server. Input your server's IP address into the 'Host:' field and click 'Start' to generate a traceroute report for diagnosis. ```shell Host: Start ``` -------------------------------- ### Check CPU Temperatures on Dedicated Servers Source: https://docs.advinservers.com/troubleshooting/hardware On dedicated servers or bare metal machines, CPU steal is not applicable. A first step for performance issues on such hardware is to install and use 'lm-sensors' to check CPU temperatures, as overheating can cause performance degradation. ```shell sudo apt-get install lm-sensors sudo sensors-detect sensors ``` -------------------------------- ### Submit Refund Ticket Details Source: https://docs.advinservers.com/policies/refund Example format for submitting a refund request to the 'Refund Support' department. This structured format includes the service hostname and invoice number, which are crucial for processing refunds to the original payment method. ```APIDOC H1 - ip-170-205-30-171.my-advin.com Invoice #3891239 ``` -------------------------------- ### Initialize Site Configuration Source: https://vps.advinservers.com/ Sets global site configuration variables, including version information. This is typically used for application-level settings and tracking. ```javascript window.SiteConfiguration = {"version":"4.2.2-rc.2"}; ``` -------------------------------- ### Location Fail Log Initialization and Loading Source: https://status.advinservers.com/ Handles the initialization and loading of location failure logs. It first loads 'add_svv.php' into '#generalrun', then loads 'auth.php' with specific parameters ('m': 94, 't', 'u') to display the failure data. ```javascript function load_loc_fails_ini(t,u) { $('#generalrun').load('add_svv.php', {'m': 12}, function(){ $('#generalrun').load('auth.php', {"m": 94 , 't': t , 'u': u}); }); } function load_loc_fails(t,u) { $('#generalrun').load('auth.php', {"m": 94 , 't': t , 'u': u}); } ``` -------------------------------- ### Initialize Plausible Analytics Source: https://vps.advinservers.com/ Configures and initializes the Plausible analytics tracking script. It ensures the plausible function is available and sends initial metadata, including the site version. ```javascript window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) } plausible('meta', { props: { version: '4.2.2-rc.2', }, }) ``` -------------------------------- ### JavaScript UI Initialization via AJAX Source: https://status.advinservers.com/ Initializes the SLA calculation UI by loading data from an authentication endpoint. It sends specific parameters ('m' and 't') to the 'auth.php' script to fetch necessary initial data for the UI. ```javascript function slacalc_ini() { $('#generalrun').load("auth.php", {"m": 198 , "t": "97525e6716210298f102e32e1d8e3349"}); } ``` -------------------------------- ### JavaScript Search and Sorting Initialization Source: https://status.advinservers.com/ Initializes a search input field and associated sorting controls within a web page. It dynamically creates HTML for a search bar with buttons for SLA calculation, sorting options, search submission, and clearing the search. Dependencies include jQuery and Bootstrap tooltips. ```javascript function init_search() { $('.searchcol').html('
\ \ \ \ \ \ \ \ \ \ \ \ \
'); $("[data-toggle=\"tooltip\"]").tooltip({html:true}); $("[data-toggle-second=\"tooltip\"]").tooltip({html:true}); } ``` -------------------------------- ### Datatable Initialization and AJAX Reload Source: https://status.advinservers.com/ Initializes and manages a DataTables instance for product listings. It configures AJAX parameters, pagination, and ordering, and provides a method to reload the table data with new parameters like date and mobile view status. ```javascript var EcommerceProducts = function () { var handleProducts = function(initialDate) { var grid = new Datatable(); grid.setAjaxParam('RUID', "97525e6716210298f102e32e1d8e3349"); grid.setAjaxParam('date', initialDate); grid.setAjaxParam('mob', mob); grid.init({ src: $("#datatable_products"), onSuccess: function (grid) { $('.pagination-panel').show(); }, onError: function (grid) { }, loadingMessage: 'Loading...', dataTable: { "bPaginate": false, "lengthMenu": [ [16,32,64,128,256], [16,32,64,128,256] ], "pageLength": 200, "ajax": { "url": "db_report-bulk.php" }, "order": [ [0, "asc"] ] } }); } var reloadData = function(newDate) { var dataTable = $("#datatable_products").DataTable(); dataTable.ajax.url("db_report-bulk.php"); dataTable.ajax.params().RUID = "97525e6716210298f102e32e1d8e3349"; dataTable.ajax.params().date = newDate; dataTable.ajax.params().mob = mob; dataTable.ajax.reload(); }; return { init: function (date) { handleProducts(date); }, reload: function(newDate) { reloadData(newDate); } }; }(); jQuery(document).ready(function() { Metronic.init(); Layout.init(); htoolz.init(); EcommerceProducts.init("2025-07-24"); ComponentsDropdowns.init(); $("[data-toggle='tooltip']").tooltip(); $('#selectrblsform').show(); $('#reppass').focus(); var blockview_tbl = $('#blockview_tbl').D ``` -------------------------------- ### Test Network Throughput with Speedtest CLI Source: https://docs.advinservers.com/troubleshooting/network Utilize the Speedtest CLI application to test download and upload speeds from your VPS. Ensure the test targets a server local to your VPS for accurate results. Review and submit the output if speeds are not as expected. ```bash speedtest ``` -------------------------------- ### JavaScript Date Range Calculation and UI Update Source: https://status.advinservers.com/ Manages date range selection based on predefined types (last 7 days, last 30 days, this month, etc.). It calculates start and end dates, formats them, and updates specific input fields in the UI. It also triggers a calculation function after updating the dates. ```javascript function slacalc_range(type) { const now = new Date(); let start, end = new Date(now); switch (type) { case 'last7days': start = new Date(now); start.setDate(start.getDate() - 7); break; case 'last30days': start = new Date(now); start.setDate(start.getDate() - 30); break; case 'thismonth': start = new Date(now.getFullYear(), now.getMonth(), 1); break; case 'lastmonth': start = new Date(now.getFullYear(), now.getMonth() - 1, 1); end = new Date(now.getFullYear(), now.getMonth(), 1); // first day of current month break; case 'yeartodate': start = new Date(now.getFullYear(), 0, 1); break; case 'lastyear': start = new Date(now.getFullYear() - 1, 0, 1); end = new Date(now.getFullYear(), 0, 1); // first day of current year break; default: console.warn('Invalid date range type'); return; } const formatDate = (d) => { const yyyy = d.getFullYear(); const mm = String(d.getMonth() + 1).padStart(2, '0'); const dd = String(d.getDate()).padStart(2, '0'); const hh = String(d.getHours()).padStart(2, '0'); const min = String(d.getMinutes()).padStart(2, '0'); return `${yyyy}-${mm}-${dd} ${hh}:${min}`; }; $('#slacalc_start').val(formatDate(start)); $('#slacalc_end').val(formatDate(end)); slacalc_do(); } ``` -------------------------------- ### Check CPU Model and TDP in VM Source: https://docs.advinservers.com/information/hardware This snippet demonstrates how to query the virtual machine's CPU information, specifically the model name and any associated TDP (Thermal Design Power) limitations, using standard Linux command-line tools. ```shell root@demo-vm:~# grep -m1 "model name" /proc/cpuinfo model name : AMD Ryzen 9 9950X (65W) 16-Core Processor ``` -------------------------------- ### JavaScript SLA Calculation Execution and Validation Source: https://status.advinservers.com/ Executes the SLA calculation process. It first validates that the start and end time input fields are visible and not empty, displaying error messages and styling invalid inputs if they are. Upon successful validation, it disables the calculation button, updates its text, and then loads the calculation results from 'auth.php' using AJAX. ```javascript function slacalc_do() { if($("#slacalc_start").is(":visible") && ($("#slacalc_start").val() == "")) { toastr['error']('Please enter a valid start time.', ''); $("#slacalc_start").addClass('input-sm-red-border'); return false; } if($("#slacalc_end").is(":visible") && ($("#slacalc_end").val() == "")) { toastr['error']('Please enter a valid end time.', ''); $("#slacalc_end").addClass('input-sm-red-border'); return false; } $('#slacalc_btn').attr('disabled', true).text('Please wait...'); $('#generalrun').load("auth.php", { "m": 199 , "t": "97525e6716210298f102e32e1d8e3349" , "slacalc_start": $('#slacalc_start').val() , "slacalc_end": $('#slacalc_end').val() , "slacalc_timezone": $('#slacalc_timezone').val() }, function() { $('#slacalc_btn').attr('disabled', false).text('Calculate'); }); } ``` -------------------------------- ### Reinitialize Data by Date and RUID Source: https://status.advinservers.com/ Loads data for reinitialization from 'bulk_rep_reinit.php', passing a specific date and RUID. ```javascript function reinit(date, ruid) { $('#generalrun').load("bulk_rep_reinit.php", {"date": date, "RUID": ruid}); } ``` -------------------------------- ### JavaScript Initialization and Configuration Source: https://clients.advinservers.com/ Initializes global JavaScript variables, configures reCAPTCHA settings, and sets up Google Analytics tracking. Includes variables for CSRF tokens, locale, and UI text. ```javascript var csrfToken = '1ca752c10c54177120d61d0a85910274af50a0b0', markdownGuide = 'Markdown Guide', locale = 'en', saved = 'saved', saving = 'autosaving', whmcsBaseUrl = ""; var recaptcha = {"requiredText":"Required","apiObject":"hcaptcha","siteKey":"48e0238e-fac4-4046-ad16-6bda0e44299a","libUrl":"https:\/\/js.hcaptcha.com\/1\/api.js?onload=recaptchaLoadCallback&render=explicit"}; window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-S8LR0BXH8F', { 'cookie_domain': 'clients.advinservers.com' }); ``` -------------------------------- ### AJAX Loading for General Run Data Source: https://status.advinservers.com/ Loads data into the '#generalrun' element from 'auth.php' using an AJAX POST request. It passes specific parameters 'm' and 't', and also adds a 'label-danger-light' class to an element identified by '#listed_' + t. ```javascript function loadblmonresponse(t) { $('#generalrun').load("auth.php", {"m": 85 , "t": t}); $('#listed_'+t).addClass('label-danger-light'); } ``` -------------------------------- ### Password Verification Load Source: https://status.advinservers.com/ Loads content from 'verifypass.php' to verify a password. It sends the RUID and the entered password value to the server for processing. ```javascript function verifypass() { $('#generalrun').load("verifypass.php", {"RUID": '97525e6716210298f102e32e1d8e3349', "pass": $('#reppass').val()}); } ``` -------------------------------- ### Monitor CPU Steal with 'top' Command Source: https://docs.advinservers.com/troubleshooting/hardware The 'top' command displays real-time system process information, including CPU steal percentage. CPU steal indicates the percentage of CPU time a virtual server is waiting for from the hypervisor, useful for diagnosing performance issues on virtual machines. High values (regularly >10%) may indicate a need for support. ```shell top ``` -------------------------------- ### Clipboard Integration and Success/Error Handling Source: https://status.advinservers.com/ Initializes a Clipboard.js instance to handle copying elements with the class 'clip'. It includes event listeners for success and error callbacks, providing user feedback via toastr notifications on success. ```javascript var clipboard = new Clipboard('.clip'); clipboard.on('success', function(e) { toastr['success']('Copied', '', { showDuration: '1000', timeOut: '1000' }); }); clipboard.on('error', function(e) { //console.log(e); }); ``` -------------------------------- ### Benchmark Disk Performance with yabs.sh Source: https://docs.advinservers.com/troubleshooting/hardware The 'yabs.sh' script is a third-party tool used to benchmark disk performance, specifically testing read/write speeds for various block sizes. It helps verify if disk speeds meet expected enterprise NVMe SSD performance levels (e.g., >1 GB/s for 1m, >100 MB/s for 4k). Use this script at your own risk. ```shell curl -sL yabs.sh | bash -s -- -i -g -n ``` -------------------------------- ### JavaScript Twitter Widget Loading Source: https://status.advinservers.com/ A function designed to load or prepare a Twitter widget. It checks if the Twitter widget element is ready and potentially executes further logic, though the specific action upon readiness is not fully defined in the provided snippet. ```javascript function load_twitter() { $('#twitter-widget-0').ready(function() { if(!$('#twitter-wi ``` -------------------------------- ### Search Functionality Source: https://status.advinservers.com/ Loads data from 'add_svv.php' with a search query. It uses a specific mode ('m': 2) and passes the search term from an input field. ```javascript function do_search() { $('#generalrun').load("add_svv.php", {"m": 2, "sBULKz": $('#searchthis').val()}); } ``` -------------------------------- ### Google Sign-In Integration Handler Source: https://clients.advinservers.com/ Handles the callback from Google Sign-In, processing the credential response. It prepares data for the WHMCS authentication provider to finalize the login or account linking process, including error handling and redirection. ```javascript function onSignIn(credentialResponse) { WHMCS.authn.provider.preLinkInit(); var failIfExists = 0; if ("login" === "register" || "login" === "connect" ) { failIfExists = 1; } var context = { htmlTarget: "login", targetLogin: "login", targetRegister: "register", redirectUrl: "%2Fclientarea.php" }; var config = { url: "/auth/provider/google_signin/finalize", method: "POST", dataType: "json", data: { id_token: credentialResponse.credential, fail_if_exists: failIfExists, token: "1ca752c10c54177120d61d0a85910274af50a0b0", cartCheckout: 0 } }; var provider = { "name": "Google", "icon": "\"googleIcon\" " }; var providerDone = function () { }; var providerError = function () { }; WHMCS.authn.provider.signIn(config, context, provider, providerDone, providerError); } ``` -------------------------------- ### Cloudflare Challenge Platform Script Injection Source: https://vps.advinservers.com/ This script handles the dynamic injection of Cloudflare's challenge-platform JavaScript. It's designed to execute after the DOM is ready, ensuring security checks or client-side challenges are properly managed. ```javascript (function(){ function c() { var b = a.contentDocument || a.contentWindow.document; if (b) { var d = b.createElement('script'); d.innerHTML = "window.__CF$cv$params={r:'96446fb2c8ffd6cc',t:'MTc1MzM3MDc5MS4wMDAwMDA='};var a=document.createElement('script');a.nonce='';a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);"; b.getElementsByTagName('head')[0].appendChild(d); } } if (document.body) { var a = document.createElement('iframe'); a.height = 1; a.width = 1; a.style.position = 'absolute'; a.style.top = 0; a.style.left = 0; a.style.border = 'none'; a.style.visibility = 'hidden'; document.body.appendChild(a); if ('loading' !== document.readyState) c(); else if (window.addEventListener) document.addEventListener('DOMContentLoaded', c); else { var e = document.onreadystatechange || function() {}; document.onreadystatechange = function(b) { e(b); 'loading' !== document.readyState && (document.onreadystatechange = e, c()); }; } } })(); ``` -------------------------------- ### RBL Filter Initialization and Change Handler Source: https://status.advinservers.com/ Initializes a Select2 dropdown for filtering based on RBLs and handles the change event to load data from 'add_svv.php' with the selected RBL values. ```javascript $('#selectedrbls').select2({ placeholder: "Filter based on RBLs", allowClear: true }); $('#selectedrbls').change( function() { $('#generalrun').load("add_svv.php", {"m": 11, "selectedrbls": $('#selectedrbls').val()}); }); ``` -------------------------------- ### Category Maximization and Cookie Storage Source: https://status.advinservers.com/ Shows a category section, sets a cookie to remember the shown state, and updates UI elements (icons, table columns) to reflect the maximized view. It also conditionally loads buttons. ```javascript function cat_max(s, t) { $('.' + s).parent().parent().show(); if (t > 0) { $.removeCookie('CatHide_' + s, { path: '/' }); $.cookie('CatShow_' + s, '1', { expires: 3650, path: '/' }); } $('#CatI_' + s).removeClass('fa-caret-right').addClass('fa-caret-down'); $('#CatH_' + s + ' th:eq(1)').hide(); $('#CatH_' + s + ' th:eq(2)').show(); $('#CatH_' + s + ' th:eq(3)').show(); $('#CatH_' + s + ' th:eq(4)').show(); $('#CatH_' + s + ' th:eq(5)').show(); $('#CatH_' + s + ' th:eq(6)').show(); $('#CatH_' + s + ' th:eq(7)').show(); $('#CatH_' + s + ' th:eq(8)').show(); $('#CatH_' + s + ' th:eq(9)').show(); $('#CatH_' + s + ' th:eq(10)').show(); $('#CatH_' + s).css('height', '0'); if ((!$('.repbtn:eq(3)').is(":visible")) || ((!$('.repbtn:eq(6)').is(":visible")) && ($('.secondcol:visible').length > 20))) { $('.dbbtns').load('bulk_rep_buttons.php', {'date': '2025-07-24', 'RUID': '97525e6716210298f102e32e1d8e3349', 'ori': 'x'}); } } ``` -------------------------------- ### JavaScript UI Expansion for More Details Source: https://status.advinservers.com/ Handles the expansion of additional details within the SLA calculation interface. It makes elements with the class 'slacalc_more' visible and removes the button that triggers this expansion. ```javascript function slacalc_more_expand() { $('.slacalc_more').show(); $('#slacalc_more_btn_div').remove(); } ``` -------------------------------- ### URL Hash Based View Control Source: https://status.advinservers.com/ Parses the URL hash to check for a 'block-view' parameter. If found and valid, it calls the `block_view` function (implementation not provided in snippet) to adjust the UI based on the specified block. ```javascript function check_urlhash() { var urlhash = window.location.hash; if (urlhash && urlhash.includes("#")) { var hashContent = urlhash.substring(1); var params = new URLSearchParams(hashContent.replace(/&/g, "&")); if (params.has("block-view")) { var value = params.get("block-view"); if (value && /^(1[6-9]|2[0-9]|3[0-2])$/.test(value)) { block_view(value); } } } } ``` -------------------------------- ### Toggle Category View Source: https://status.advinservers.com/ Switches between minimized and maximized views for a category section by calling either `cat_min` or `cat_max` based on the current state of the category icon. ```javascript function cat_switch(s) { if ($('#CatI_' + s).hasClass('fa-caret-down')) { cat_min(s, 1); } else { cat_max(s, 1); } } ``` -------------------------------- ### Global JavaScript Error Handler Source: https://clients.advinservers.com/ Assigns a global error handler function to `window.onerror`. This function is designed to capture and display errors related to authentication providers, potentially showing user-friendly messages. ```javascript window.onerror = function(e){ WHMCS.authn.provider.displayError(); }; ``` -------------------------------- ### JavaScript UI View Toggling Source: https://status.advinservers.com/ Manages the display of different UI views (Block View and Normal View) by manipulating DOM elements and handling button clicks. It includes functions to show/hide specific content areas and update button states and captions based on the current view. Dependencies include jQuery. ```javascript function block_view(t) { $(".blkview1-btn").prop('disabled', true).html(' Please Wait.. '); $('#generalrun').load("auth.php", {"m": 143 , "t": t , "u": "97525e6716210298f102e32e1d8e3349"}); } function search_this_block(s) { $('#searchthis').val(s).focus(); $('.filter-submit').trigger('click'); $('#blockview_portlet_body').hide(); $('#uptimebody').show(); show_normal_view(); } $("#blkview0-btn").click(function() { show_normal_view(); block_view(0); }); function show_block_view() { $('#uptimebody').hide(); $('#blockview_portlet_body').show(); $('.blkview1-btn').prop('disabled', false).html(' Block View '); $('#blkview0').show(); $('.caption').html(' Block View (view documentation)'); } function show_normal_view() { $('#blockview_portlet_body').hide(); $('#uptimebody').show(); if($(window).width() <= 480) { $('.blkview1-btn').prop('disabled', false).html(' '); } else { $('.blkview1-btn').prop('disabled', false).html(' Block View '); } $('#blkview0').hide(); $('#addmonbutton').show(); $('#refresh-span').show(); $('#bookmark-span').show(); $('#filter-span').show(); $('#actions-span').show(); $('.caption').html(' Blacklist Monitors (view documentation)'); history.replaceState(null, null, window.location.pathname); } ```