dashboard\primary\error("Failed to unban license!"), 'success' => dashboard\primary\success("Successfully unbanned license!"), default => dashboard\primary\error("Unhandled Error! Contact us if you need help") }; } if (isset($_POST['genkeys'])) { if (empty(trim($_POST['mask']))) { dashboard\primary\error("You must specify a key mask."); } else { $key = misc\license\createLicense($_POST['amount'], $_POST['mask'], $_POST['duration'], $_POST['level'], $_POST['note'], $_POST['user'], $_POST['expiry']); switch ($key) { case 'max_keys': dashboard\primary\error("You can only generate 100 licenses at a time"); break; case 'tester_limit': dashboard\primary\error("Tester plan only allows for 10 licenses, please upgrade!"); break; case 'dupe_custom_key': dashboard\primary\error("Can't do custom key with amount greater than one"); break; default: $mask = misc\etc\sanitize($_POST['mask']); $amount = intval($_POST['amount']); $level = misc\etc\sanitize($_POST['level']); $note = misc\etc\sanitize($_POST['note']); $user = misc\etc\sanitize($_POST['user']); $duration = misc\etc\sanitize($_POST['duration']); $expiry = misc\etc\sanitize($_POST['expiry']); misc\mysql\query("UPDATE `apps` SET `format` = ?,`amount` = ?,`lvl` = ?,`note` = ?,`user` = ?,`duration` = ?,`unit` = ? WHERE `secret` = ?", [$mask, $amount, $level, $note, $user, $duration, $expiry, $_SESSION['app']]); $_SESSION['keys_array'] = $key; dashboard\primary\success("License(s) Created And Displayed Above!"); break; } } } if (isset($_POST["action"]) && isset($_POST["selected"])) { $selected = json_decode($_POST['selected'], true); if ($_POST["action"] == "delete") { if ($_SESSION['role'] == "tester") { dashboard\primary\error("Free tester accounts can't delete keys, upgrade your account to delete keys!"); echo ""; return; } foreach ($selected as $value) { $resp = misc\license\deleteSingular($value, false, $_SESSION['app']); match ($resp) { 'failure' => dashboard\primary\error("Failed to delete license!"), 'success' => dashboard\primary\success("Successfully deleted license!"), default => dashboard\primary\error("Unhandled Error! Contact us if you need help") }; } } else if ($_POST["action"] == "banKeyMulti") { foreach ($selected as $value) { $resp = misc\license\ban($value, "You selected to ban multiple keys", 0); match ($resp) { 'failure' => dashboard\primary\error("Failed to ban keys!"), 'success' => dashboard\primary\success("Successfully banned keys!"), default => dashboard\primary\error("Unhandled Error! Contact us if you need help") }; } } else { dashboard\primary\error("Invalid action"); } } if (isset($_POST['editkey'])) { $key = misc\etc\sanitize($_POST['editkey']); $query = misc\mysql\query("SELECT * FROM `keys` WHERE `key` = ? AND `app` = ?",[$key, $_SESSION['app']]); if ($query->num_rows < 1) { dashboard\primary\error("Key not Found!"); echo ""; return; } $row = mysqli_fetch_array($query->result); ?>

Licenses

Licenses allow your users to register on your application.


"; } echo "
$keys

"; echo ""; unset($_SESSION['keys_array']); } ?>
Select Key User Creation Date Generated By Duration Note Used On Used By Status Actions

Dropdown actions in RED do not show a confirmation! Dropdown actions in BLUE will show a confirmation!

"; return; } $resp = misc\license\deleteAll(); match ($resp) { 'failure' => dashboard\primary\error("Didn't find any keys!"), 'success' => dashboard\primary\success("Deleted All Keys!"), default => dashboard\primary\error("Unhandled Error! Contact us if you need help") }; } if (isset($_POST['addtime'])) { $resp = misc\license\addTime($_POST['time'], $_POST['expiry']); match ($resp) { 'failure' => dashboard\primary\error("Failed to add time!"), 'success' => dashboard\primary\success("Added time to unused licenses!"), default => dashboard\primary\error("Unhandled Error! Contact us if you need help") }; } if (isset($_POST['deleteallunused'])) { if ($_SESSION['role'] == "tester") { dashboard\primary\error("Free tester accounts can't delete keys, upgrade your account to delete keys!"); echo ""; return; } $resp = misc\license\deleteAllUnused(); match ($resp) { 'failure' => dashboard\primary\error("Didn't find any unused keys!"), 'success' => dashboard\primary\success("Deleted all unused keys!"), default => dashboard\primary\error("Unhandled Error! Contact us if you need help") }; } if (isset($_POST['deleteallused'])) { if ($_SESSION['role'] == "tester") { dashboard\primary\error("Free tester accounts can't delete keys, upgrade your account to delete keys!"); echo ""; return; } $resp = misc\license\deleteAllUsed(); match ($resp) { 'failure' => dashboard\primary\error("Didn't find any used keys!"), 'success' => dashboard\primary\success("Deleted all used keys!"), default => dashboard\primary\error("Unhandled Error! Contact us if you need help") }; } if (isset($_POST['savekey'])) { $key = misc\etc\sanitize($_POST['savekey']); $level = misc\etc\sanitize($_POST['level']); $duration = misc\etc\sanitize($_POST['duration']); $note = misc\etc\sanitize($_POST['editNote']); if (!empty($duration)) { $expiry = misc\etc\sanitize($_POST['expiry']); $duration = $duration * $expiry; misc\mysql\query("UPDATE `keys` SET `expires` = ? WHERE `key` = ? AND `app` = ?",[$duration, $key, $_SESSION['app']]); } misc\mysql\query("UPDATE `keys` SET `note` = ?, `level` = ? WHERE `key` = ? AND `app` = ?",[$note, $level, $key, $_SESSION['app']]); misc\cache\purge('KeyAuthKey:' . $_SESSION['app'] . ':' . $key); misc\cache\purge('KeyAuthKeys:' . $_SESSION['app']); dashboard\primary\success("Successfully Updated Settings!"); } if (isset($_POST['importkeysFile'])) { if ($_FILES['file_input']['error'] == UPLOAD_ERR_OK) { $fileContent = file_get_contents($_FILES['file_input']['tmp_name']); $jsonArray = json_decode($fileContent, true); if ($jsonArray === null) { dashboard\primary\error("Invalid JSON format!"); echo ""; return; } if (!isset($jsonArray['keys'])) { dashboard\primary\error("Missing 'keys' array in JSON!"); echo ""; return; } if (!isset($jsonArray['tokens'])) { dashboard\primary\error("Missing 'tokens' array in JSON!"); echo ""; return; } foreach ($jsonArray['keys'] as $keyData) { $key_format = $keyData['key']; $user_format = $keyData['user']; $note_format = $keyData['note']; $expiry_format = $keyData['expiry']; $status_format = $keyData['status']; $level_format = $keyData['level']; $genby_format = $keyData['genby']; $gendate_format = $keyData['gendate']; $usedon_format = $keyData['usedon']; $banned_format = $keyData['banned']; /*if (!isset($key_format) || $key_format == '' || !isset($level_format) || $level_format == '' || !isset($expiry_format) || $expiry_format == '') { dashboard\primary\error("Invalid Format!"); echo ""; return; }*/ misc\mysql\query("INSERT INTO `keys` (`key`, `user`, `note`, `expires`, `status`, `level`, `genby`, `gendate`, `usedon`, `app`, `banned`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", [$key_format, $note_format, $expiry_format, $status_format, $level_format, $genby_format, $gendate_format, $usedon_format, $_SESSION['app'], $bannned_format]);; } foreach ($jsonArray['tokens'] as $tokenData){ $token = $tokenData['token']; $assigned = $tokenData['assigned']; $banned = $tokenData['banned']; $reason = $tokenData['reason']; $hash = $tokenData['hash']; $type = $tokenData['type']; $status = $tokenData['status']; misc\mysql\query("INSERT INTO `tokens` (`token`, `assigned`, `banned`, `reason`, `hash`, `type`, `status`, `app`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", [$token, $assigned, $banned, $reason, $hash, $type, $status, $_SESSION['app']]); } dashboard\primary\success("Successfully imported licenses!"); } else { dashboard\primary\error("File upload failed!"); echo ""; return; } } if (isset($_POST['deletekey'])) { if ($_SESSION['role'] == "tester") { dashboard\primary\error("Free tester accounts can't delete keys, upgrade your account to delete keys!"); echo ""; return; } $userToo = ($_POST['delUserToo'] == "on") ? 1 : 0; $resp = misc\license\deleteSingular($_POST['deletekey'], $userToo); match ($resp) { 'failure' => dashboard\primary\error("Failed to delete license!"), 'success' => dashboard\primary\success("Successfully deleted license!"), default => dashboard\primary\error("Unhandled Error! Contact us if you need help") }; } if (isset($_POST['dlkeys'])) { echo ""; // get all rows, put in text file, download text file, delete text file. } if (isset($_POST['bankey'])) { $userToo = ($_POST['banUserToo'] == "on") ? 1 : 0; $resp = misc\license\ban($_POST['bankey'], $_POST['reason'], $userToo); match ($resp) { 'failure' => dashboard\primary\error("Failed to ban license!"), 'success' => dashboard\primary\success("Successfully banned license!"), default => dashboard\primary\error("Unhandled Error! Contact us if you need help") }; }