+ + +
+ += $_SESSION["username"]; ?>
- -= $_SESSION["username"]; ?>
- - - " . strtoupper($role) . " PLAN"; - ?> - - '', - 'developer' => '', - 'seller' => '', - 'Reseller' => '', - 'Manager' => '', - 'default' => '' - }; - echo $display; - - if ($role === 'developer' || $role === 'seller') { - echo ''; - } - ?> -diff --git a/app/layout/toolbars/_toolbar-1.php b/app/layout/toolbars/_toolbar-1.php new file mode 100644 index 0000000..651d46b --- /dev/null +++ b/app/layout/toolbars/_toolbar-1.php @@ -0,0 +1,11 @@ + + \ No newline at end of file diff --git a/app/layout/topbar.php b/app/layout/topbar.php deleted file mode 100644 index 978bce8..0000000 --- a/app/layout/topbar.php +++ /dev/null @@ -1,133 +0,0 @@ - - - diff --git a/app/layout/topbar/_base.php b/app/layout/topbar/_base.php new file mode 100644 index 0000000..a3ff659 --- /dev/null +++ b/app/layout/topbar/_base.php @@ -0,0 +1,49 @@ + + + \ No newline at end of file diff --git a/app/layout/topbar/partials/_user-menu.php b/app/layout/topbar/partials/_user-menu.php new file mode 100644 index 0000000..4d8b78a --- /dev/null +++ b/app/layout/topbar/partials/_user-menu.php @@ -0,0 +1,43 @@ + + + \ No newline at end of file diff --git a/app/license-download.php b/app/license-download.php new file mode 100644 index 0000000..bfa32b3 --- /dev/null +++ b/app/license-download.php @@ -0,0 +1,48 @@ +result)) + + + + $stringData .= "" . $row['key'] . "\n"; + + + +$stringData = preg_replace( + + '~[\r\n]+~', + + "\r\n", + + trim($stringData) + +); + + + +header('Content-Description: File Transfer'); +header('Content-Type: application/octet-stream'); +header('Content-Disposition: attachment; filename="KeyAuthKeys.txt"'); +header('Expires: 0'); +header('Cache-Control: must-revalidate'); +header('Pragma: public'); +header('Content-Length: ' . strlen($stringData)); + + +die($stringData); \ No newline at end of file diff --git a/app/license-fetch.php b/app/license-fetch.php index 89793b6..83c8801 100644 --- a/app/license-fetch.php +++ b/app/license-fetch.php @@ -1,131 +1,90 @@ getMessage()); + error_log("\n--------------------------------------------------------------\n"); + error_log($exception); + error_log("\nRequest data:"); + error_log(print_r($_POST, true)); + error_log("\n--------------------------------------------------------------"); + http_response_code(500); + die("Error: " . $exception->getMessage()); }); if (session_status() === PHP_SESSION_NONE) { - session_start(); + session_start(); } if ($_SESSION['role'] == "Reseller") { - die("Resellers can't access this."); + die("Resellers can't access this."); } if (!isset($_SESSION['app'])) { - dashboard\primary\error("Application not selected"); - die("Application not selected."); + die("Application not selected."); } if (isset($_POST['draw'])) { - // credits to https://makitweb.com/datatables-ajax-pagination-with-search-and-sort-php/ - - $draw = intval($_POST['draw']); - $row = intval($_POST['start']); - $rowperpage = intval($_POST['length']); // Rows display per page - $columnIndex = misc\etc\sanitize($_POST['order'][0]['column']); // Column index - $columnName = misc\etc\sanitize($_POST['columns'][$columnIndex]['data']); // Column name - $columnSortOrder = misc\etc\sanitize($_POST['order'][0]['dir']); // asc or desc - $searchValue = misc\etc\sanitize($_POST['search']['value']); // Search value - - // whitelist certain column names and sort orders to prevent SQL injection - if (!in_array($columnName, array("key", "gendate", "genby", "expires", "note", "usedon", "usedby", "status"))) { - die("Column name is not whitelisted."); - } - - if (!in_array($columnSortOrder, array("desc", "asc"))) { - die("Column sort order is not whitelisted."); - } - - if (!is_null($searchValue)) { - $query = misc\mysql\query("select * from `keys` WHERE (`key` like ? or `note` like ? or `genby` like ? or `usedby` like ? ) and app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]); - } - else { - $query = misc\mysql\query("select * from `keys` WHERE app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, [$_SESSION['app']]); - } - - $data = array(); - - while ($row = mysqli_fetch_assoc($query->result)) { - - ## If only one or two keys exists then we will use custom margin to fix the bugging menu - $banBtns = ""; - if ($row['status'] == "Banned") { - $banBtns = ''; - } else { - $banBtns = ''; - } - - $MarginManager = ""; - if ($query->num_rows < 2) { - $MarginManager = "margin-bottom: 20px;"; - } else { - $MarginManager = "margin-bottom: 0px;"; - } - - $data[] = array( - "key" => $row['key'], - "gendate" => '', - "genby" => $row['genby'], - "expires" => timeconversion($row["expires"]), - "note" => $row['note'] ?? 'N/A', - "usedon" => (!is_null($row["usedon"])) ? '' : 'N/A', - "usedby" => ($row["usedby"] == $row['key']) ? 'Same as key' : $row["usedby"] ?? 'N/A', - "status" => '' . $row['status'] . '', - - "actions" => ' - - ', - ); - } - - ## Response - $response = array( - "draw" => intval($draw), - "aaData" => $data - ); - - die(json_encode($response)); + // credits to https://makitweb.com/datatables-ajax-pagination-with-search-and-sort-php/ + + $draw = intval($_POST['draw']); + $row = intval($_POST['start']); + $rowperpage = intval($_POST['length']); // Rows display per page + $columnIndex = misc\etc\sanitize($_POST['order'][0]['column']); // Column index + $columnName = misc\etc\sanitize($_POST['columns'][$columnIndex]['data']); // Column name + $columnSortOrder = misc\etc\sanitize($_POST['order'][0]['dir']); // asc or desc + $searchValue = misc\etc\sanitize($_POST['search']['value']); // Search value + + // whitelist certain column names and sort orders to prevent SQL injection + if (!in_array($columnName, array("key", "gendate", "genby", "expires", "note", "usedon", "usedby", "status"))) { + die("Column name is not whitelisted."); + } + + if (!in_array($columnSortOrder, array("desc", "asc"))) { + die("Column sort order is not whitelisted."); + } + + ## Fetch records + $query = misc\mysql\query("select * from `keys` WHERE 1 and (`key` like ? or `note` like ? or `genby` like ? or `usedby` like ? ) and app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]); + $data = array(); + + while ($row = mysqli_fetch_assoc($query->result)) { + + ## If only one or two keys exists then we will use custom margin to fix the bugging menu + $banBtns = ""; + if ($row['status'] == "Banned") { + $banBtns = ''; + } else { + $banBtns = 'Ban'; + } + + $MarginManager = ""; + if ($totalRecordwithFilter < 2) { + $MarginManager = "margin-bottom: 20px;"; + } else { + $MarginManager = "margin-bottom: 0px;"; + } + + $data[] = array( + "key" => $row['key'], + "gendate" => '', + "genby" => $row['genby'], + "expires" => ($row["expires"] / 86400) . ' Day(s)', + "note" => $row['note'] ?? 'N/A', + "usedon" => (!is_null($row["usedon"])) ? '' : 'N/A', + "usedby" => ($row["usedby"] == $row['key']) ? 'Same as key' : $row["usedby"] ?? 'N/A', + "status" => '', + "actions" => '', + ); + } + + ## Response + $response = array( + "draw" => intval($draw), + "aaData" => $data + ); + + die(json_encode($response)); } die("Request not from datatables, aborted."); diff --git a/app/log-fetch.php b/app/log-fetch.php index f89fc05..2e88524 100644 --- a/app/log-fetch.php +++ b/app/log-fetch.php @@ -2,74 +2,68 @@ include '../includes/misc/autoload.phtml'; set_exception_handler(function ($exception) { - error_log("\n--------------------------------------------------------------\n"); - error_log($exception); - error_log("\nRequest data:"); - error_log(print_r($_POST, true)); - error_log("\n--------------------------------------------------------------"); - http_response_code(500); - die("Error: " . $exception->getMessage()); + error_log("\n--------------------------------------------------------------\n"); + error_log($exception); + error_log("\nRequest data:"); + error_log(print_r($_POST, true)); + error_log("\n--------------------------------------------------------------"); + http_response_code(500); + die("Error: " . $exception->getMessage()); }); if (session_status() === PHP_SESSION_NONE) { - session_start(); + session_start(); } if ($_SESSION['role'] == "Reseller") { - die("Resellers can't access this."); + die("Resellers can't access this."); } if (!isset($_SESSION['app'])) { - dashboard\primary\error("Application not selected"); - die("Application not selected."); + die("Application not selected."); } if (isset($_POST['draw'])) { - // credits to https://makitweb.com/datatables-ajax-pagination-with-search-and-sort-php/ + // credits to https://makitweb.com/datatables-ajax-pagination-with-search-and-sort-php/ - $draw = intval($_POST['draw']); - $row = intval($_POST['start']); - $rowperpage = intval($_POST['length']); // Rows display per page - $columnIndex = misc\etc\sanitize($_POST['order'][0]['column']); // Column index - $columnName = misc\etc\sanitize($_POST['columns'][$columnIndex]['data']); // Column name - $columnSortOrder = misc\etc\sanitize($_POST['order'][0]['dir']); // asc or desc - $searchValue = misc\etc\sanitize($_POST['search']['value']); // Search value + $draw = intval($_POST['draw']); + $row = intval($_POST['start']); + $rowperpage = intval($_POST['length']); // Rows display per page + $columnIndex = misc\etc\sanitize($_POST['order'][0]['column']); // Column index + $columnName = misc\etc\sanitize($_POST['columns'][$columnIndex]['data']); // Column name + $columnSortOrder = misc\etc\sanitize($_POST['order'][0]['dir']); // asc or desc + $searchValue = misc\etc\sanitize($_POST['search']['value']); // Search value - // whitelist certain column names and sort orders to prevent SQL injection - if (!in_array($columnName, array("logdate", "logdata", "credential", "pcuser"))) { - die("Column name is not whitelisted."); - } + // whitelist certain column names and sort orders to prevent SQL injection + if (!in_array($columnName, array("logdate", "logdata", "credential", "pcuser"))) { + die("Column name is not whitelisted."); + } - if (!in_array($columnSortOrder, array("desc", "asc"))) { - die("Column sort order is not whitelisted."); - } + if (!in_array($columnSortOrder, array("desc", "asc"))) { + die("Column sort order is not whitelisted."); + } - if (!is_null($searchValue)) { - $query = misc\mysql\query("select * from `logs` WHERE (`logdata` like ? or `credential` like ? or `pcuser` like ? ) and logapp = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]); - } - else { - $query = misc\mysql\query("select * from `logs` WHERE logapp = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, [$_SESSION['app']]); - } - - $data = array(); + ## Fetch records + $query = misc\mysql\query("select * from `logs` WHERE 1 and (`logdata` like ? or `credential` like ? or `pcuser` like ? ) and logapp = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]); + $data = array(); - while ($row = mysqli_fetch_assoc($query->result)) { - $data[] = array( - "logdate" => '', - "logdata" => $row['logdata'], - "credential" => $row['credential'] ?? 'N/A', - "pcuser" => $row['pcuser'] ?? 'N/A', - ); - } + while ($row = mysqli_fetch_assoc($query->result)) { + $data[] = array( + "logdate" => '', + "logdata" => $row['logdata'], + "credential" => $row['credential'] ?? 'N/A', + "pcuser" => $row['pcuser'] ?? 'N/A', + ); + } - ## Response - $response = array( - "draw" => intval($draw), - "aaData" => $data - ); + ## Response + $response = array( + "draw" => intval($draw), + "aaData" => $data + ); - die(json_encode($response)); + die(json_encode($response)); } die("Request not from datatables, aborted."); diff --git a/app/pages/account-logs.php b/app/pages/account-logs.php index 2f9dde5..7f11168 100644 --- a/app/pages/account-logs.php +++ b/app/pages/account-logs.php @@ -1,53 +1,45 @@ - -
Account Logs
-View the event history of your account.
-| Date | -IP | -User-Agent | -|||
|---|---|---|---|---|---|
| - - | +
| Date | +IP Address | +User Agent | += $row["ip"]; ?> | -= $row["useragent"]; ?> | - - - -
|---|
+
+
+
+
+