num_rows < 1) { dashboard\primary\error("Application not found!"); } else { $row = mysqli_fetch_array($query->result); $banned = $row["banned"]; if ($banned) { dashboard\primary\error("Application is banned!"); } else { $_SESSION['app'] = $row["secret"]; $_SESSION['name'] = $row["name"]; $_SESSION['sellerkey'] = $row["sellerkey"]; echo ''; // needed to refresh nav sidebar dashboard\primary\success("Successfully Selected the App!"); } } } if (isset($_POST['create_app'])) { $appname = misc\etc\sanitize($_POST['appname']); if ($appname == "") { dashboard\primary\error("Input a valid name"); echo ''; return; } $query = misc\mysql\query("SELECT 1 FROM `apps` WHERE name = ? AND owner = ?", [$appname, $_SESSION['username']]); if ($query->num_rows > 0) { dashboard\primary\error("You already own application with this name!"); echo ''; return; } $owner = $_SESSION['username']; if ($role == "tester") { $num_rows = misc\mysql\query("SELECT * FROM `apps` WHERE `owner` = ? AND `ownerid` = ?", [$_SESSION['username'], $_SESSION['ownerid']])->num_rows; if ($num_rows > 0) { dashboard\primary\error("Tester plan only supports one application!"); echo ''; return; } } if ($role == "Manager") { dashboard\primary\error("Manager Accounts Are Not Allowed To Create Applications"); echo ''; return; } $clientsecret = hash('sha256', misc\etc\generateRandomString()); $algos = array( 'ripemd128', 'md5', 'md4', 'tiger128,4', 'haval128,3', 'haval128,4', 'haval128,5' ); $sellerkey = hash($algos[array_rand($algos)], misc\etc\generateRandomString()); misc\mysql\query("INSERT INTO `subscriptions` (`name`, `level`, `app`) VALUES ('default', '1', ?)", [$clientsecret]); $query = misc\mysql\query("INSERT INTO `apps` (`owner`, `name`, `secret`, `ownerid`, `enabled`, `hwidcheck`, `sellerkey`) VALUES (?, ?, ?, ?, '1', '1', ?)", [$_SESSION['username'], $appname, $clientsecret, $_SESSION['ownerid'], $sellerkey]); if ($query->affected_rows != 0) { dashboard\primary\success("Successfully Created App!"); $_SESSION['app'] = $clientsecret; $_SESSION['name'] = $appname; $_SESSION['sellerkey'] = $sellerkey; } else { dashboard\primary\error("Failed to create application!"); } } if (isset($_POST['rename_app'])) { $appname = misc\etc\sanitize($_POST['appname']); if ($appname == "") { dashboard\primary\error("Input a valid name"); echo ''; return; } if ($role == "Manager") { dashboard\primary\error("Manager Accounts Aren't Allowed To Rename Applications"); echo ''; return; } $query = misc\mysql\query("SELECT 1 FROM `apps` WHERE `owner` = ? AND `name` = ?", [$_SESSION['username'], $appname]); if ($query->num_rows > 0) { dashboard\primary\error("You already have an application with this name!"); echo ''; return; } misc\mysql\query("UPDATE `accounts` SET `app` = ? WHERE `app` = ? AND `owner` = ?", [$appname, $_SESSION['name'], $_SESSION['username']]); $query = misc\mysql\query("UPDATE `apps` SET `name` = ? WHERE `secret` = ? AND `owner` = ?", [$appname, $_SESSION['app'], $_SESSION['username']]); if ($query->affected_rows != 0) { $oldName = $_SESSION['name']; $_SESSION['name'] = $appname; dashboard\primary\success("Successfully Renamed App!"); misc\cache\purge('KeyAuthApp:' . $oldName . ':' . $_SESSION['ownerid']); if ($_SESSION['role'] == "seller") { $query = misc\mysql\query("SELECT `customDomain`, `sellerkey`, `customDomainAPI` FROM `apps` WHERE `owner` = ? AND `name` = ?", [$_SESSION['username'], $appname]); $row = mysqli_fetch_array($query->result); misc\cache\purge('KeyAuthAppPanel:' . $row['customDomain']); misc\cache\purge('KeyAuthAppSeller:' . $row['sellerkey']); } } else { dashboard\primary\error("Application Renamed Failed!"); } } if (isset($_POST['pauseapp'])) { if ($role == "Manager") { dashboard\primary\error("Manager accounts aren't allowed to pause applications"); echo ''; return; } misc\cache\purgePattern('KeyAuthSubs:' . $_SESSION["app"]); misc\app\pause(); dashboard\primary\success("Paused application and any active subscriptions!"); } if (isset($_POST['unpauseapp'])) { if ($role == "Manager") { dashboard\primary\error("Manager accounts aren't allowed to unpause applications"); echo ''; return; } misc\cache\purgePattern('KeyAuthSubs:' . $_SESSION["app"]); misc\app\unpause(); dashboard\primary\success("Unpaused application and any paused subscriptions!"); } if (isset($_POST['refreshapp'])) { if ($role == "Manager") { dashboard\primary\error("Manager Accounts Aren't Allowed To Refresh Applications"); echo ''; return; } $gen = misc\etc\generateRandomString(); $new_secret = hash('sha256', $gen); $query = misc\mysql\query("UPDATE `apps` SET `secret` = ? WHERE `secret` = ? AND `owner` = ?", [$new_secret, $_SESSION['app'], $_SESSION['username']]); if ($query->affected_rows != 0) { misc\mysql\query("UPDATE `bans` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `buttons` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `chatmsgs` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `chatmutes` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `chats` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `files` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `keys` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `logs` SET `logapp` = ? WHERE `logapp` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `sessions` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `subs` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `subscriptions` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `users` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `uservars` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `vars` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `webhooks` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); misc\mysql\query("UPDATE `tokens` SET `app` = ? WHERE `app` = ?", [$new_secret, $_SESSION['app']]); $_SESSION['app'] = $new_secret; misc\cache\purge('KeyAuthApp:' . $_SESSION['name'] . ':' . $_SESSION['ownerid']); if ($_SESSION['role'] == "seller" || $_SESSION['role'] == "developer") { $query = misc\mysql\query("SELECT `sellerkey`,`customDomainAPI` FROM `apps` WHERE `owner` = ? AND `name` = ?", [$_SESSION['username'], $_SESSION['name']]); $row = mysqli_fetch_array($query->result); misc\cache\purge('KeyAuthAppSeller:' . $row['sellerkey']); misc\cache\purge('KeyAuthApp:' . $row['customDomainAPI']); } dashboard\primary\success("Successfully Refreshed App!"); } else { dashboard\primary\error("Application Refresh Failed!"); } } if (isset($_POST['deleteapp'])) { if ($role == "Manager") { dashboard\primary\error("Manager Accounts Aren't Allowed To Delete Applications"); echo ''; return; } if ($_POST['confirmappname'] !== "Confirm Deletion"){ dashboard\primary\error("Failed!"); echo ''; return; } $app = $_SESSION['app']; $query = misc\mysql\query("DELETE FROM `apps` WHERE `secret` = ?", [$app]); if ($query->affected_rows != 0) { misc\mysql\query("DELETE FROM `bans` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `buttons` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `chatmsgs` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `chatmutes` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `chats` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `files` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `keys` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `logs` WHERE `logapp` = ?", [$app]); misc\mysql\query("DELETE FROM `sessions` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `subs` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `subscriptions` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `users` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `uservars` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `vars` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `webhooks` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `auditLog` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `sellerLogs` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `whitelist` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `tokens` WHERE `app` = ?", [$app]); misc\mysql\query("DELETE FROM `accounts` WHERE `app` = ? AND `owner` = ?", [$_SESSION['name'], $_SESSION['username']]); misc\cache\purge('KeyAuthApp:' . $_SESSION['name'] . ':' . $_SESSION['ownerid']); if ($_SESSION['role'] == "seller" || $_SESSION['role'] == "developer") { $query = misc\mysql\query("SELECT `sellerkey`,`customDomainAPI` FROM `apps` WHERE `owner` = ? AND `name` = ?", [$_SESSION['username'], $_SESSION['name']]); $row = mysqli_fetch_array($query->result); misc\cache\purge('KeyAuthAppSeller:' . $row['sellerkey']); misc\cache\purge('KeyAuthApp:' . $row['customDomainAPI']); } $_SESSION['app'] = NULL; dashboard\primary\success("Successfully deleted App!"); $query = misc\mysql\query("SELECT * FROM `apps` WHERE `owner` = ? AND `ownerid` = ?", [$_SESSION['username'], $_SESSION['ownerid']]); // select all apps where owner is current user if ($query->num_rows == 1) // if the user only owns one app, select that app, otherwise select no app { $row = mysqli_fetch_array($query->result); $_SESSION['name'] = $row["name"]; $_SESSION['app'] = $row["secret"]; } else { $_SESSION['name'] = NULL; } } else { dashboard\primary\error("Application Deletion Failed!"); } } if (isset($_SESSION["app"])) { $appsecret = $_SESSION["app"]; $query = misc\mysql\query("SELECT * FROM `apps` WHERE `secret` = ?", [$appsecret]); $row = mysqli_fetch_array($query->result); $appname = $row["name"]; $secret = $row["secret"]; $version = $row["ver"]; $ownerid = $row["ownerid"]; $paused = $row["paused"]; } if (isset($_POST["closeAlert"])) { $query = misc\mysql\query("UPDATE `accounts` SET `alert` = ? WHERE `username` = ?", [NULL, $_SESSION["username"]]); if ($query->affected_rows != 0) { dashboard\primary\success("Successfully closed staff alert."); $alertMsg = NULL; } else { dashboard\primary\error("This alert can not be closed. Please contact staff."); } } ?>
This is where it all begins. Learn More.
Application Credentials
Simply replace the placeholder code in the example with these
public static api KeyAuthApp = new api(
name: "= $appname; ?>", // App name - VaultCord.com FREE Discord backup bot for members & your entire server saved from terms and nukes!
ownerid: "= $ownerid; ?>", // Account ID
version: "= $version; ?>" // Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs
//path: @"Your_Path_Here" // (OPTIONAL) see tutorial here https://www.youtube.com/watch?v=I9rxt821gMk&t=1s
);
std::string name = skCrypt("= $appname; ?>").decrypt(); // App name - VaultCord.com FREE Discord backup bot for members & your entire server saved from terms and nukes!
std::string ownerid = skCrypt("= $ownerid; ?>").decrypt(); // Account ID
std::string secret = skCrypt("= $secret; ?>").decrypt(); // Application secret (not used in latest C++ example)
std::string version = skCrypt("= $version; ?>").decrypt(); // Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs
std::string url = skCrypt("https://keyauth.win/api/1.3/").decrypt(); // change if using KeyAuth custom domains feature
std::string path = skCrypt("").decrypt(); // (OPTIONAL) see tutorial here https://www.youtube.com/watch?v=I9rxt821gMk&t=1s
keyauthapp = api(
name = "= $appname; ?>", # App name - VaultCord.com FREE Discord backup bot for members & your entire server saved from terms and nukes!
ownerid = "= $ownerid; ?>", # Account ID
version = "= $version; ?>", # Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs
hash_to_check = getchecksum()
)
$name = "= $appname; ?>"; // App name - VaultCord.com FREE Discord backup bot for members & your entire server saved from terms and nukes! $ownerid = "= $ownerid; ?>"; // Account ID
const KeyAuthApp = new KeyAuth(
"= $appname; ?>", // App name - VaultCord.com FREE Discord backup bot for members & your entire server saved from terms and nukes!
"= $ownerid; ?>", // Account ID
"= $secret; ?>", // Encryption key, keep hidden and and protect this string in your code!
"= $version; ?>", // Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs
);
private static String ownerid = "= $ownerid; ?>", // Account ID private static String appname = "= $appname; ?>", // App name - VaultCord.com FREE Discord backup bot for members & your entire server saved from terms and nukes! private static String version = "= $version; ?>" // Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs
Private Shared name As String = "= $appname; ?>" ' App name - VaultCord.com FREE Discord backup bot for members & your entire server saved from terms and nukes! Private Shared ownerid As String = "= $ownerid; ?>" ' Account ID Private Shared secret As String = "= $secret; ?>" ' Encryption key, keep hidden and and protect this string in your code! Private Shared version As String = "= $version; ?>" ' Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs
let mut keyauthapp = keyauth::v1_2::KeyauthApi::new(
"= $appname; ?>", // App name - VaultCord.com FREE Discord backup bot for members & your entire server saved from terms and nukes!
"= $ownerid; ?>", // Account ID
"= $secret; ?>", // Encryption key, keep hidden and and protect this string in your code!
"= $version; ?>", // Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs
"https://keyauth.win/api/1.2/", // This is the API URL, change this to your custom domain if you have it enabled
);
KeyAuthApp.Api(
"= $appname; ?>", // App name - VaultCord.com FREE Discord backup bot for members & your entire server saved from terms and nukes!
"= $ownerid; ?>", // Account ID
"= $secret; ?>", // Encryption key, keep hidden and and protect this string in your code!
"= $version; ?>", // Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs
"", // Token Path (PUT NULL OR LEAVE BLANK IF YOU DO NOT WANT TO USE THE TOKEN VALIDATION SYSTEM! MUST DISABLE VIA APP SETTINGS)
)
local name = "= $appname; ?>"; -- App name - VaultCord.com FREE Discord backup bot for members & your entire server saved from terms and nukes! local ownerid = "= $ownerid; ?>"; -- Account ID local version = "= $version; ?>"; -- Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs
KeyAuth.new.Api(
"= $appname; ?>", # App name - VaultCord.com FREE Discord backup bot for members & your entire server saved from terms and nukes!
"= $ownerid; ?>", # Account ID
"= $secret; ?>", # Encryption key, keep hidden and and protect this string in your code!
"= $version; ?>" # Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs
)
KeyAuth::Api(
"= $appname; ?>", # App name - VaultCord.com FREE Discord backup bot for members & your entire server saved from terms and nukes!
"= $ownerid; ?>", # Account ID
"= $secret; ?>", # Encryption key, keep hidden and and protect this string in your code!
"= $version; ?>" # Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs
);
| Application Name | Status | Action |
|---|---|---|
| = $appName ?> | = $paused == 1 ? 'Paused' : 'Active'; ?> |