Licenses allow your users to register on your application.
";
}
echo "
";
echo "
";
unset($_SESSION['keys_array']);
}
?>
result);
$format = $row['format'];
$amt = $row['amount'];
$lvl = $row['lvl'];
$note = $row['note'];
$user = $row['user'];
$dur = $row['duration'];
$unit = $row['unit'];
?>
Add Time To Unused Licenses
Info
Notice! This will not delete users (prevent
them from logging in). Go to https://keyauth.cc/app/?page=users for that.
Are you sure you want to delete
all of your keys? This can not be undone.
Info
Notice! This will not delete users (prevent
them from logging in). Go to https://keyauth.cc/app/?page=users for that.
Are you sure you want to delete
all of your used keys? This can not be undone.
Info
Notice! This will not delete users (prevent
them from logging in). Go to https://keyauth.cc/app/?page=users for that.
Are you sure you want to delete
all of your unused keys? This can not be undone.
Info
Notice! This will not delete the user
(prevent them from logging in) unless you check Delete User Too
Are you sure you want to delete
this key? This can not be undone.
Info
Notice! This will not ban the user
(prevent them from logging in) unless you check Ban User Too
Are you sure you want to ban this
license?
| 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")
};
}