datein hinzufügen

This commit is contained in:
tbS
2025-08-02 22:24:03 +02:00
commit 938d485253
129 changed files with 37532 additions and 0 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

8
.idea/keyauth.iml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/keyauth.iml" filepath="$PROJECT_DIR$/.idea/keyauth.iml" />
</modules>
</component>
</project>

22
.idea/php.xml generated Normal file
View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.0">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

BIN
Favicon-Logo-306x310.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,196 @@
<?php
/*
* Copyright (C) 2022 Lukas Buchs
* license https://github.com/lbuchs/WebAuthn/blob/master/LICENSE MIT
*
* Server test script for WebAuthn library. Saves new registrations in session.
*
* JAVASCRIPT | SERVER
* ------------------------------------------------------------
*
* REGISTRATION
*
* window.fetch -----------------> getCreateArgs
* |
* navigator.credentials.create <-------------'
* |
* '-------------------------> processCreate
* |
* alert ok or fail <----------------'
*
* ------------------------------------------------------------
*
* VALIDATION
*
* window.fetch ------------------> getGetArgs
* |
* navigator.credentials.get <----------------'
* |
* '-------------------------> processGet
* |
* alert ok or fail <----------------'
*
* ------------------------------------------------------------
*/
include '../../includes/misc/autoload.phtml';
require_once '../../vendor/lbuchs/webauthn/src/WebAuthn.php';
try {
// read get argument and post body
$fn = filter_input(INPUT_GET, 'fn');
if(empty($fn)) {
die("Can't access directly");
}
$post = trim(file_get_contents('php://input'));
$userId = bin2hex(openssl_random_pseudo_bytes(10));
if ($post) {
$post = json_decode($post);
}
session_start();
if($_SESSION['discordLogin']) {
throw new Exception('You can\'t use security keys when you sign-in with different website! Use security keys on that website instead, Discord supports security keys');
}
// Formats
$formats = array();
$formats[] = 'none';
$rpId = $_SERVER['HTTP_HOST'];
// cross-platform: true, if type internal is not allowed
// false, if only internal is allowed
// null, if internal and cross-platform is allowed
$crossPlatformAttachment = null;
// new Instance of the server library.
// make sure that $rpId is the domain name.
$WebAuthn = new lbuchs\WebAuthn\WebAuthn('KeyAuth', $rpId, $formats);
// ------------------------------------
// request for create arguments
// ------------------------------------
if ($fn === 'getCreateArgs') {
$createArgs = $WebAuthn->getCreateArgs($userId, $_SESSION['username'], "", 20, 0, "discouraged", $crossPlatformAttachment);
header('Content-Type: application/json');
print(json_encode($createArgs));
// save challange to session. you have to deliver it to processGet later.
$_SESSION['challenge'] = $WebAuthn->getChallenge();
// ------------------------------------
// request for get arguments
// ------------------------------------
} else if ($fn === 'getGetArgs') {
$ids = array();
// load registrations from session stored there by processCreate.
$query = misc\mysql\query("SELECT * FROM `securityKeys` WHERE `username` = ?", [$_SESSION['pendingUsername']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)) {
$ids[] = base64_decode($row["credentialId"]);
}
}
if (count($ids) === 0) {
throw new Exception('No security key registrations found for this user!');
}
$getArgs = $WebAuthn->getGetArgs($ids, 20, 1, 1, 1, 1, 0);
header('Content-Type: application/json');
print(json_encode($getArgs));
// save challange to session. you have to deliver it to processGet later.
$_SESSION['challenge'] = $WebAuthn->getChallenge();
// ------------------------------------
// process create
// ------------------------------------
} else if ($fn === 'processCreate') {
$clientDataJSON = base64_decode($post->clientDataJSON);
$attestationObject = base64_decode($post->attestationObject);
$challenge = $_SESSION['challenge'];
// processCreate returns data to be stored for future logins.
$data = $WebAuthn->processCreate($clientDataJSON, $attestationObject, $challenge, 0, false, false);
unset($_SESSION['challenge']); // disgard challenge array from session file, no longer needed
$name = misc\etc\sanitize($_GET['name']);
misc\mysql\query("INSERT INTO `securityKeys` (`username`, `name`, `credentialId`, `credentialPublicKey`) VALUES (?, ?, ?, ?)", [$_SESSION['username'], $name, base64_encode($data->credentialId), $data->credentialPublicKey]);
misc\mysql\query("UPDATE `accounts` SET `securityKey` = 1 WHERE `username` = ?", [$_SESSION['username']]);
$return = new stdClass();
$return->success = true;
$return->msg = 'registration success.';
header('Content-Type: application/json');
print(json_encode($return));
// ------------------------------------
// proccess get
// ------------------------------------
} else if ($fn === 'processGet') {
$clientDataJSON = base64_decode($post->clientDataJSON);
$authenticatorData = base64_decode($post->authenticatorData);
$signature = base64_decode($post->signature);
$userHandle = base64_decode($post->userHandle);
$id = base64_decode($post->id);
$challenge = $_SESSION['challenge'];
$credentialPublicKey = null;
// looking up correspondending public key of the credential id
// you should also validate that only ids of the given user name
// are taken for the login.
$query = misc\mysql\query("SELECT * FROM `securityKeys` WHERE `username` = ?", [$_SESSION['pendingUsername']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)) {
if(base64_decode($row["credentialId"]) === $id) {
$credentialPublicKey = $row["credentialPublicKey"];
break;
}
}
}
if ($credentialPublicKey === null) {
throw new Exception('This security key wasn\'t found!');
}
// process the get request. throws WebAuthnException if it fails
$WebAuthn->processGet($clientDataJSON, $authenticatorData, $signature, $credentialPublicKey, $challenge, null, 0);
unset($_SESSION['challenge']); // disgard challenge array from session file, no longer needed
$_SESSION['username'] = $_SESSION['pendingUsername'];
unset($_SESSION['pendingUsername']);
$return = new stdClass();
$return->success = true;
header('Content-Type: application/json');
print(json_encode($return));
}
} catch (Throwable $ex) {
$return = new stdClass();
$return->success = false;
$return->msg = $ex->getMessage();
header('Content-Type: application/json');
print(json_encode($return));
}

1283
api/1.0/index.php Normal file

File diff suppressed because it is too large Load Diff

1268
api/1.1/index.php Normal file

File diff suppressed because it is too large Load Diff

2071
api/1.2/index.php Normal file

File diff suppressed because it is too large Load Diff

191
api/dashboard/webauthn.php Normal file
View File

@@ -0,0 +1,191 @@
<?php
/*
* Copyright (C) 2022 Lukas Buchs
* license https://github.com/lbuchs/WebAuthn/blob/master/LICENSE MIT
*
* Server test script for WebAuthn library. Saves new registrations in session.
*
* JAVASCRIPT | SERVER
* ------------------------------------------------------------
*
* REGISTRATION
*
* window.fetch -----------------> getCreateArgs
* |
* navigator.credentials.create <-------------'
* |
* '-------------------------> processCreate
* |
* alert ok or fail <----------------'
*
* ------------------------------------------------------------
*
* VALIDATION
*
* window.fetch ------------------> getGetArgs
* |
* navigator.credentials.get <----------------'
* |
* '-------------------------> processGet
* |
* alert ok or fail <----------------'
*
* ------------------------------------------------------------
*/
include '../../includes/misc/autoload.phtml';
require_once '../../vendor/lbuchs/webauthn/src/WebAuthn.php';
try {
// read get argument and post body
$fn = filter_input(INPUT_GET, 'fn');
if(empty($fn)) {
die("Can't access directly");
}
$post = trim(file_get_contents('php://input'));
$userId = bin2hex(openssl_random_pseudo_bytes(10));
if ($post) {
$post = json_decode($post);
}
session_start();
// Formats
$formats = array();
$formats[] = 'none';
$rpId = $_SERVER['HTTP_HOST'];
// cross-platform: true, if type internal is not allowed
// false, if only internal is allowed
// null, if internal and cross-platform is allowed
$crossPlatformAttachment = null;
// new Instance of the server library.
// make sure that $rpId is the domain name.
$WebAuthn = new lbuchs\WebAuthn\WebAuthn('KeyAuth', $rpId, $formats);
// ------------------------------------
// request for create arguments
// ------------------------------------
if ($fn === 'getCreateArgs') {
$createArgs = $WebAuthn->getCreateArgs($userId, $_SESSION['username'], "", 20, 0, "discouraged", $crossPlatformAttachment);
header('Content-Type: application/json');
print(json_encode($createArgs));
// save challange to session. you have to deliver it to processGet later.
$_SESSION['challenge'] = $WebAuthn->getChallenge();
// ------------------------------------
// request for get arguments
// ------------------------------------
} else if ($fn === 'getGetArgs') {
$ids = array();
// load registrations from session stored there by processCreate.
$query = misc\mysql\query("SELECT * FROM `securityKeys` WHERE `username` = ?", [$_SESSION['pendingUsername']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)) {
$ids[] = base64_decode($row["credentialId"]);
}
}
if (count($ids) === 0) {
throw new Exception('No security key registrations found for this user!');
}
$getArgs = $WebAuthn->getGetArgs($ids, 20, 1, 1, 1, 1, 0);
header('Content-Type: application/json');
print(json_encode($getArgs));
// save challange to session. you have to deliver it to processGet later.
$_SESSION['challenge'] = $WebAuthn->getChallenge();
// ------------------------------------
// process create
// ------------------------------------
} else if ($fn === 'processCreate') {
$clientDataJSON = base64_decode($post->clientDataJSON);
$attestationObject = base64_decode($post->attestationObject);
$challenge = $_SESSION['challenge'];
// processCreate returns data to be stored for future logins.
$data = $WebAuthn->processCreate($clientDataJSON, $attestationObject, $challenge, 0, false, false);
unset($_SESSION['challenge']); // disgard challenge array from session file, no longer needed
$name = misc\etc\sanitize($_GET['name']);
misc\mysql\query("INSERT INTO `securityKeys` (`username`, `name`, `credentialId`, `credentialPublicKey`) VALUES (?, ?, ?, ?)", [$_SESSION['username'], $name, base64_encode($data->credentialId), $data->credentialPublicKey]);
misc\mysql\query("UPDATE `accounts` SET `securityKey` = 1 WHERE `username` = ?", [$_SESSION['username']]);
$return = new stdClass();
$return->success = true;
$return->msg = 'registration success.';
header('Content-Type: application/json');
print(json_encode($return));
// ------------------------------------
// proccess get
// ------------------------------------
} else if ($fn === 'processGet') {
$clientDataJSON = base64_decode($post->clientDataJSON);
$authenticatorData = base64_decode($post->authenticatorData);
$signature = base64_decode($post->signature);
$userHandle = base64_decode($post->userHandle);
$id = base64_decode($post->id);
$challenge = $_SESSION['challenge'];
$credentialPublicKey = null;
// looking up correspondending public key of the credential id
// you should also validate that only ids of the given user name
// are taken for the login.
$query = misc\mysql\query("SELECT * FROM `securityKeys` WHERE `username` = ?", [$_SESSION['pendingUsername']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)) {
if(base64_decode($row["credentialId"]) === $id) {
$credentialPublicKey = $row["credentialPublicKey"];
break;
}
}
}
if ($credentialPublicKey === null) {
throw new Exception('This security key wasn\'t found!');
}
// process the get request. throws WebAuthnException if it fails
$WebAuthn->processGet($clientDataJSON, $authenticatorData, $signature, $credentialPublicKey, $challenge, null, 0);
unset($_SESSION['challenge']); // disgard challenge array from session file, no longer needed
$_SESSION['username'] = $_SESSION['pendingUsername'];
unset($_SESSION['pendingUsername']);
$return = new stdClass();
$return->success = true;
header('Content-Type: application/json');
print(json_encode($return));
}
} catch (Throwable $ex) {
$return = new stdClass();
$return->success = false;
$return->msg = $ex->getMessage();
header('Content-Type: application/json');
print(json_encode($return));
}

3
api/index.php Normal file
View File

@@ -0,0 +1,3 @@
<?php
header("Location: https://keyauth.cc/docs");
exit();

304
api/reseller/index.php Normal file
View File

@@ -0,0 +1,304 @@
<?php
if (!isset($_SERVER["HTTP_X_SELLIX_SIGNATURE"]) && !isset($_SERVER["HTTP_X_SHOPPY_SIGNATURE"]) && !isset($_SERVER["HTTP_SIGNATURE"]))
{
require '../../includes/dashboard/autoload.phtml';
die("Request isn't coming from SellApp, Sellix, or Shoppy.");
}
include '../../includes/misc/autoload.phtml';
require '../../includes/dashboard/autoload.phtml';
if (isset($_SERVER["HTTP_X_SELLIX_SIGNATURE"]))
{
$app = misc\etc\sanitize($_GET['app']);
$query = misc\mysql\query("SELECT * FROM `apps` WHERE `secret` = ?", [$app]);
if ($query->num_rows < 1)
{ // if no application was found with the supplied secret as the 'app' paramater
die("Failure: application not found");
}
$row = mysqli_fetch_array($query->result);
$name = $row["name"];
$secret = $row["sellixsecret"];
$dayproduct = $row["sellixdayproduct"];
$weekproduct = $row["sellixweekproduct"];
$monthproduct = $row["sellixmonthproduct"];
$lifetimeproduct = $row["sellixlifetimeproduct"];
$payload = file_get_contents('php://input');
$header_signature = misc\etc\sanitize($_SERVER["HTTP_X_SELLIX_SIGNATURE"]);
$signature = hash_hmac('sha512', $payload, $secret);
if (!hash_equals($signature, $header_signature))
{ // if the sellix webhook secret the request was sent from didn't match the one set in the database
die("Failure: authentication with sellix secret failed");
}
$json = json_decode($payload);
$data = $json->data;
$custom = $data->custom_fields; // getting custom fields, the hidden fields on KeyAuth sellix embed which provide sellix the KeyAuth username
$un = misc\etc\sanitize($custom->username);
$query = misc\mysql\query("SELECT `balance` FROM `accounts` WHERE `username` = ? AND `app` = ?", [$un, $name]);
if ($query->num_rows < 1)
{ // if reseller not found
die("Failure: No account with the supplied username under this application found");
}
// getting the balance of each key length for the specified reseller account
$row = mysqli_fetch_array($query->result);
$balance = $row["balance"];
$balance = explode("|", $balance);
$day = $balance[0];
$week = $balance[1];
$month = $balance[2];
$threemonth = $balance[3];
$sixmonth = $balance[4];
$lifetime = $balance[5];
$year = $balance[6];
$amount = misc\etc\sanitize($data->quantity); // find quantity of keys purchased
// then given the duration of keys they purchased, add to their balance
if(isset($_GET['expiry'])) {
$expiry = misc\etc\sanitize($_GET['expiry']);
$level = misc\etc\sanitize($_GET['level']);
$key = misc\license\createLicense($amount, "******-******-******-******-******-******", $expiry, $level, NULL, 86400, $app, $un);
$keys = NULL;
for ($i = 0; $i < count($key); $i++) {
$keys .= "" . $key[$i] . "\n";
}
$keys = preg_replace(
'~[\r\n]+~',
"\r\n",
trim($keys)
);
die($keys);
}
switch (misc\etc\sanitize($data->product_id))
{
case $dayproduct:
$day = $day + $amount;
break;
case $weekproduct:
$week = $week + $amount;
break;
case $monthproduct:
$month = $month + $amount;
break;
case $lifetimeproduct:
$lifetime = $lifetime + $amount;
break;
default:
die("You didn't set product id in app settings.");
}
$balance = $day . '|' . $week . '|' . $month . '|' . $threemonth . '|' . $sixmonth . '|' . $lifetime . '|' . $year;
// set balance
misc\mysql\query("UPDATE `accounts` SET `balance` = ? WHERE `username` = ?", [$balance, $un]);
die("Success: Reseller Balance Increased");
}
if (isset($_SERVER["HTTP_X_SHOPPY_SIGNATURE"]))
{
$app = misc\etc\sanitize($_GET['app']);
$query = misc\mysql\query("SELECT * FROM `apps` WHERE `secret` = ?", [$app]);
if ($query->num_rows < 1)
{ // if no application was found with the supplied secret as the 'app' paramater
die("Failure: application not found");
}
$row = mysqli_fetch_array($query->result);
$name = $row["name"];
$secret = $row["shoppysecret"];
$dayproduct = $row["shoppydayproduct"];
$weekproduct = $row["shoppyweekproduct"];
$monthproduct = $row["shoppymonthproduct"];
$lifetimeproduct = $row["shoppylifetimeproduct"];
$payload = file_get_contents('php://input');
$header_signature = misc\etc\sanitize($_SERVER["HTTP_X_SHOPPY_SIGNATURE"]);
$signature = hash_hmac('sha512', $payload, $secret);
if (!hash_equals($signature, $header_signature))
{
// if the shoppy webhook secret the request was sent from didn't match the one set in the database
die("Failure: authentication with shoppy secret failed");
}
$json = json_decode($payload);
$un = misc\etc\sanitize($json->data->order->custom_fields[0]->value);
$productid = misc\etc\sanitize($json->data->order->product_id);
$query = misc\mysql\query("SELECT `balance` FROM `accounts` WHERE `username` = ? AND `app` = ?", [$un, $name]);
if ($query->num_rows < 1)
{
// if reseller not found
die("Failure: No account with the supplied username under this application found");
}
// getting the balance of each key length for the specified reseller account
$row = mysqli_fetch_array($query->result);
$balance = $row["balance"];
$balance = explode("|", $balance);
$day = $balance[0];
$week = $balance[1];
$month = $balance[2];
$threemonth = $balance[3];
$sixmonth = $balance[4];
$lifetime = $balance[5];
$year = $balance[6];
$amount = misc\etc\sanitize($json->data->order->quantity); // find quantity of keys purchased
// then given the duration of keys they purchased, add to their balance
if(isset($_GET['expiry'])) {
$expiry = misc\etc\sanitize($_GET['expiry']);
$level = misc\etc\sanitize($_GET['level']);
$key = misc\license\createLicense($amount, "******-******-******-******-******-******", $expiry, $level, NULL, 86400, $app, $un);
$keys = NULL;
for ($i = 0; $i < count($key); $i++) {
$keys .= "" . $key[$i] . "\n";
}
$keys = preg_replace(
'~[\r\n]+~',
"\r\n",
trim($keys)
);
die($keys);
}
switch ($productid)
{
case $dayproduct:
$day = $day + $amount;
break;
case $weekproduct:
$week = $week + $amount;
break;
case $monthproduct:
$month = $month + $amount;
break;
case $lifetimeproduct:
$lifetime = $lifetime + $amount;
break;
default:
die("You didn't set product id in app settings.");
}
$balance = $day . '|' . $week . '|' . $month . '|' . $threemonth . '|' . $sixmonth . '|' . $lifetime . '|' . $year;
// set balance
misc\mysql\query("UPDATE `accounts` SET `balance` = ? WHERE `username` = ?", [$balance, $un]);
die("Success: Reseller Balance Increased");
}
if (isset($_SERVER["HTTP_SIGNATURE"]))
{
$app = misc\etc\sanitize($_GET['app']);
$query = misc\mysql\query("SELECT * FROM `apps` WHERE `secret` = ?", [$app]);
if ($query->num_rows < 1)
{
// if no application was found with the supplied secret as the 'app' paramater
die("Failure: application not found");
}
$row = mysqli_fetch_array($query->result);
$name = $row["name"];
$secret = $row["sellappsecret"];
$dayproduct = $row["sellappdayproduct"];
$weekproduct = $row["sellappweekproduct"];
$monthproduct = $row["sellappmonthproduct"];
$lifetimeproduct = $row["sellapplifetimeproduct"];
$payload = file_get_contents('php://input');
$header_signature = misc\etc\sanitize($_SERVER["HTTP_SIGNATURE"]);
$signature = hash_hmac('sha256', $payload, $secret);
if (!hash_equals($signature, $header_signature))
{
// if the SellApp webhook secret the request was sent from didn't match the one set in the database
die("Failure: authentication with SellApp secret failed");
}
$json = json_decode($payload);
$un = misc\etc\sanitize($json->additional_information[0]->value);
$product = misc\etc\sanitize($json->listing->slug);
$query = misc\mysql\query("SELECT `balance` FROM `accounts` WHERE `username` = ? AND `app` = ?", [$un, $name]);
if ($query->num_rows < 1)
{
// if reseller not found
die("Failure: No account with the supplied username under this application found");
}
// getting the balance of each key length for the specified reseller account
$row = mysqli_fetch_array($query->result);
$balance = $row["balance"];
$balance = explode("|", $balance);
$day = $balance[0];
$week = $balance[1];
$month = $balance[2];
$threemonth = $balance[3];
$sixmonth = $balance[4];
$lifetime = $balance[5];
$year = $balance[6];
$amount = misc\etc\sanitize($json->quantity); // find quantity of keys purchased
// then given the duration of keys they purchased, add to their balance
if(isset($_GET['expiry'])) {
$expiry = misc\etc\sanitize($_GET['expiry']);
$level = misc\etc\sanitize($_GET['level']);
$key = misc\license\createLicense($amount, "******-******-******-******-******-******", $expiry, $level, NULL, 86400, $app, $un);
$keys = NULL;
for ($i = 0; $i < count($key); $i++) {
$keys .= "" . $key[$i] . "\n";
}
$keys = preg_replace(
'~[\r\n]+~',
"\r\n",
trim($keys)
);
die($keys);
}
switch(true) {
case stristr($dayproduct, $product):
$day = $day + $amount;
break;
case stristr($weekproduct, $product):
$week = $week + $amount;
break;
case stristr($monthproduct, $product):
$month = $month + $amount;
break;
case stristr($lifetimeproduct, $product):
$lifetime = $lifetime + $amount;
break;
default:
die("You didn't set product URL in app settings.");
}
$balance = $day . '|' . $week . '|' . $month . '|' . $threemonth . '|' . $sixmonth . '|' . $lifetime . '|' . $year;
// set balance
misc\mysql\query("UPDATE `accounts` SET `balance` = ? WHERE `username` = ?", [$balance, $un]);
die("Success: Reseller Balance Increased");
}
?>

1717
api/seller/index.php Normal file

File diff suppressed because it is too large Load Diff

96
app/black-fetch.php Normal file
View File

@@ -0,0 +1,96 @@
<?php
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);
$errorMsg = str_replace($databaseUsername, "REDACTED", $exception->getMessage());
die("Error: " . $errorMsg);
});
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if ($_SESSION['role'] == "Reseller") {
die("Resellers can't access this.");
}
if (!isset($_SESSION['app'])) {
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']) +1; // 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("type"))) {
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 `bans` WHERE (`ip` like ? or `hwid` like ? or `type` like ? ) and app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
}
else {
$query = misc\mysql\query("select * from `bans` WHERE app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, [$_SESSION['app']]);
}
$data = array();
while ($row = mysqli_fetch_assoc($query->result)) {
$data[] = array(
"data" => '<span class="blur-sm hover:blur-none">' . ($row["hwid"] ?? $row["ip"]) . '</span>',
"type" => $row["type"],
"actions" =>
'<form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true" class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4" type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" style="margin-top:3px">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false" class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1" style="min-width:15rem">
<li>
<button name="deleteblack" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . ($row["hwid"] ?? $row["ip"]) . '">
Delete Blacklist
</button>
<input type="hidden" name="type" value="' . $row["type"] . '"></div>
</li>
</ul>
</div>
</td>
</tr>
</form>',
);
}
## Response
$response = array(
"draw" => intval($draw),
"aaData" => $data
);
die(json_encode($response));
}
die("Request not from datatables, aborted.");

343
app/download-types.php Normal file
View File

@@ -0,0 +1,343 @@
<?php
include '../includes/misc/autoload.phtml';
session_start();
if ($_SESSION['role'] == "Reseller") {
die("Resellers can't access this.");
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
switch ($_POST['type'] ?? $_GET['type']) {
case 'account':
$jsonarray = json_encode(
array(
"files" => array(),
"keys" => array(),
"subscriptions" => array(),
"tokens" => array(),
"users" => array(),
"uservars" => array(),
"vars" => array(),
"webhooks" => array()
)
);
$jsondata = json_decode($jsonarray);
$filesquery = misc\mysql\query("SELECT * FROM `files` WHERE `app` = ?", [$_SESSION['app']]);
while ($row = mysqli_fetch_array($filesquery->result)){
$filesjson = array(
"name" => $row["name"],
"id" => $row["id"],
"url" => $row["url"]
);
array_push($jsondata->files, $filesjson);
}
$keyquery = misc\mysql\query("SELECT * FROM `keys` WHERE `app` = ?", [$_SESSION['app']]);
while ($row = mysqli_fetch_array($keyquery->result)){
$keyjson = array(
"key" => $row["key"],
"note" => $row["note"],
"level" => $row["level"],
"genby" => $row["genby"],
"usedby" => $row["usedby"]
);
array_push($jsondata->keys, $keyjson);
}
$subscriptionsquery = misc\mysql\query("SELECT * FROM `subscriptions` WHERE `app` = ?", [$_SESSION['app']]);
while ($row = mysqli_fetch_array($subscriptionsquery->result)){
$subscriptionjson = array(
"name" => $row["name"],
"level" => $row["level"]
);
array_push($jsondata->subscriptions, $subscriptionjson);
}
$tokensquery = misc\mysql\query("SELECT * FROM `tokens` WHERE `app` = ?", [$_SESSION['app']]);
while ($row = mysqli_fetch_array($tokensquery->result)){
$tokenjson = array(
"token" => $row["token"],
"assigned" => $row["assigned"],
"hash" => $row["hash"],
"type" => $row["type"],
"status" => $row["status"]
);
array_push($jsondata->tokens, $tokenjson);
}
$usersquery = misc\mysql\query("SELECT * FROM `users` WHERE `app` = ?", [$_SESSION['app']]);
while ($row = mysqli_fetch_array($usersquery->result)){
$usersjson = array(
"username" => $row["username"],
"email" => $row["email"],
"password" => $row["password"],
"hwid" => $row["hwid"],
"owner" => $row["owner"],
"ip" => $row["ip"]
);
array_push($jsondata->users, $usersjson);
}
$uservarsquery = misc\mysql\query("SELECT * FROM `uservars` WHERE `app` = ?", [$_SESSION['app']]);
while ($row = mysqli_fetch_array($uservarsquery->result)){
$uservarsjson = array(
"name" => $row["name"],
"data" => $row["data"],
"user" => $row["user"]
);
array_push($jsondata->uservars, $uservarsjson);
}
$varsquery = misc\mysql\query("SELECT * FROM `vars` WHERE `app` = ?", [$_SESSION['app']]);
while ($row = mysqli_fetch_array($varsquery->result)){
$varsjson = array(
"varid" => $row["varid"],
"msg" => $row["msg"]
);
array_push($jsondata->vars, $varsjson);
}
$webhooksquery = misc\mysql\query("SELECT * FROM `webhooks` WHERE `app` = ?", [$_SESSION['app']]);
while ($row = mysqli_fetch_array($webhooksquery->result)){
$webhooksjson = array(
"webid" => $row["webid"],
"baselink" => $row["baselink"],
"useragent" => $row["useragent"]
);
array_push($jsondata->webhooks, $webhooksjson);
}
$newjson = json_encode($jsondata);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="KeyAuthAccExport.json"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . strlen($newjson));
die($newjson);
case 'users':
$jsonarray = json_encode(
array(
"users" => array(),
"subscription" => array(),
"tokens" => array()
)
);
$jsondata = json_decode($jsonarray);
$userquery = misc\mysql\query("SELECT * FROM `users` WHERE `app` = ?", [$_SESSION['app']]);
while ($row = mysqli_fetch_array($userquery->result)) {
$userjson = array(
"username" => $row["username"],
"email" => $row["email"],
"password" => $row["password"],
"hwid" => $row["hwid"],
"owner" => $row["owner"],
"createdate" => $row["createdate"],
"lastlogin" => $row["lastlogin"],
"banned" => $row["banned"],
"ip" => $row["ip"],
"cooldown" => $row["cooldown"]
);
array_push($jsondata->users, $userjson);
}
$subscriptionquery = misc\mysql\query("SELECT * FROM `subs` WHERE `app` = ? ", [$_SESSION['app']]);
while ($row = mysqli_fetch_array($subscriptionquery->result)) {
$subjson = array(
"user" => $row["user"],
"subscription" => $row["subscription"],
"expiry" => $row["expiry"],
"key" => $row["key"],
"paused" => $row["paused"]
);
array_push($jsondata->subscription, $subjson);
}
$tokensquery = misc\mysql\query("SELECT * FROM `tokens` WHERE `type` = ? AND `app` = ?", ["user", $_SESSION['app']]);
while ($row = mysqli_fetch_array($tokensquery->result)){
$tokenjson = array(
"token" => $row["token"],
"assigned" => $row["assigned"],
"banned" => $row["banned"],
"reason" => $row["reason"],
"hash" => $row["hash"],
"type" => $row["type"],
"status" => $row["status"]
);
array_push($jsondata->tokens, $tokenjson);
}
$newjson = json_encode($jsondata);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="KeyAuthUsers.json"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . strlen($newjson));
die($newjson);
case 'licenses':
$jsonarray = json_encode(
array(
"keys" => array(),
"tokens" => array()
)
);
$jsondata = json_decode($jsonarray);
$query = misc\mysql\query("SELECT * FROM `keys` WHERE `app` = ?",[$_SESSION['app']]);
// Create an array to hold the keys
$keysArray = array();
while ($row = mysqli_fetch_array($query->result)) {
// Add each key to the array
$keysArray[] = array(
"key" => $row['key'],
"note" => $row['note'],
"expiry" => $row['expires'], // Export keys is in SECONDS, because that works better than fractions of a day.
// so, tell people to convert seconds to hours or days..
"status" => $row['status'],
"level" => $row['level'],
"genby" => $row['genby'],
"gendate" => $row['gendate'],
"usedon" => $row['usedon'],
"banned" => $row['banned']
);
}
$tokensquery = misc\mysql\query("SELECT * FROM `tokens` WHERE `type` = ? AND `app` = ?", ["license", $_SESSION['app']]);
while ($row = mysqli_fetch_array($tokensquery->result)){
$tokenjson = array(
"token" => $row["token"],
"assigned" => $row["assigned"],
"banned" => $row["banned"],
"reason" => $row["reason"],
"hash" => $row["hash"],
"type" => $row["type"],
"status" => $row["status"]
);
array_push($jsondata->tokens, $tokenjson);
}
// Assign keys array to jsondata
$jsondata->keys = $keysArray;
// Convert the array to a JSON string
$jsonData = json_encode($jsondata);
header('Content-Description: File Transfer');
header('Content-Type: application/json'); // Set the content type to JSON
header('Content-Disposition: attachment; filename="KeyAuthKeys.json"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . strlen($jsonData));
echo $jsonData;
die($stringData);
case 'logs':
$jsonarray = json_encode(
array(
"logs" => array()
)
);
$jsondata = json_decode($jsonarray);
$userlogquery = misc\mysql\query("SELECT * FROM `logs` WHERE `logapp` = ?", [$_SESSION['app']]);
while ($row = mysqli_fetch_array($userlogquery->result)) {
$userlogjson = array(
"logdate" => $row["logdate"],
"logdata" => $row["logdata"],
"credential" => $row["credential"],
"pcuser" => $row["pcuser"]
);
array_push($jsondata->logs, $userlogjson);
}
$newjson = json_encode($jsondata);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="KeyAuthUserLogs.json"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . strlen($newjson));
die($newjson);
case 'auditLog':
$jsonarray = json_encode(
array(
"auditLog" => array()
)
);
$jsondata = json_decode($jsonarray);
$userquery = misc\mysql\query("SELECT * FROM `auditLog` WHERE `app` = ?", [$_SESSION['app']]);
while ($row = mysqli_fetch_array($userquery->result)) {
$userjson = array(
"id" => $row["id"],
"user" => $row["user"],
"event" => $row["event"],
"time" => $row["time"],
);
array_push($jsondata->auditLog, $userjson);
}
$newjson = json_encode($jsondata);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="KeyAuthAuditLogs.json"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . strlen($newjson));
die($newjson);
default:
echo 'Invalid Type or Type does not Exist';
}

208
app/index.php Normal file
View File

@@ -0,0 +1,208 @@
<?php
include '../includes/misc/autoload.phtml';
include '../includes/dashboard/autoload.phtml';
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
ob_start();
if (!isset($_SESSION['username'])) {
$_SESSION['oldUrl'] = $_SERVER['REQUEST_URI'];
header("Location: ../login/");
exit();
}
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);
global $databaseUsername;
$errorMsg = str_replace($databaseUsername, "REDACTED", $exception->getMessage());
\dashboard\primary\error($errorMsg);
});
$username = $_SESSION['username'];
$query = misc\mysql\query("SELECT * FROM `accounts` WHERE `username` = ?",[$username]);
$row = mysqli_fetch_array($query->result);
$banned = $row['banned'];
$lastreset = $row['lastreset'];
if (!is_null($banned) || $_SESSION['logindate'] < $lastreset || $query->num_rows < 1) {
echo "<meta http-equiv='Refresh' Content='0; url=../login/'>";
session_destroy();
exit();
}
$role = $row['role'];
$permissions = $row['permissions'];
$admin = $row['admin'];
$staff = $row['staff'];
$formBanned = $row['formBanned'];
$twofactor = $row['twofactor'];
$alertMsg = $row['alert'];
$secwords = $row['secWords'];
$_SESSION['role'] = $role;
$expires = $row['expires'];
if (in_array($role, array("developer", "seller"))) {
dashboard\primary\expireCheck($username, $expires);
}
if (!$_SESSION['app']) // no app selected yet
{
$query = misc\mysql\query("SELECT `secret`, `name`, `banned`, `sellerkey` 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, load that app (they can still change app after it's loaded)
{
$row = mysqli_fetch_array($query->result);
$_SESSION['name'] = $row["name"];
$_SESSION['app'] = $row["secret"];
$_SESSION['sellerkey'] = $row["sellerkey"];
}
}
?>
<!DOCTYPE html>
<html lang="en" class="bg-[#09090d] text-white overflow-x-hidden dark">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.keyauth.cc/v3/scripts/highlight.css">
<script src="https://cdn.keyauth.cc/v3/scripts/highlight.min.js"></script>
<script src="https://cdn.keyauth.cc/dashboard/unixtolocal.js"></script>
<link href="https://cdn.lineicons.com/4.0/lineicons.css" rel="stylesheet" />
<link rel="shortcut icon" type="image/jpg" href="https://cdn.keyauth.cc/front/assets/img/favicon.png">
<link href="https://cdn.keyauth.cc/v2/assets/plugins/custom/datatables/datatables.bundle.css" rel="stylesheet"
type="text/css" />
<meta name="apple-itunes-app" content="app-id=6503321465">
<title>KeyAuth - Open Source Auth</title>
<script>
if (window.history.replaceState) {
window.history.replaceState(null, null, window.location.href);
}
</script>
<link rel="stylesheet" href="https://cdn.keyauth.cc/v3/dist/dashboard.css">
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" />
<link rel="stylesheet" href="https://cdn.keyauth.cc/v3/dist/output.css">
<script src="https://cdn.keyauth.cc/v3/dist/flowbite.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<script src="https://cdn.keyauth.cc/v3/scripts/jquery.min.js"></script>
</head>
<body>
<div data-loader id="loader" class="bg-[#0f0f17]">
<div class="text-center grid h-screen place-items-center">
<div role="status" class="mt-96">
<svg aria-hidden="true" class="inline w-8 h-8 mr-2 text-[#09090d] animate-spin fill-blue-600"
viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="currentColor" />
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentFill" />
</svg>
</div>
<div class="block mt-32">
<span class="text-xs font-semibold text-gray-500">
Loading taking a while? <a href="?page=manage-apps" class="text-blue-500 hover:underline">Please
feel free to return.</a>
</span>
</div>
</div>
</div>
<?php include 'layout/master.php' ?>
<script src="https://cdn.keyauth.cc/v2/assets/plugins/global/plugins.bundle.js"></script>
<script src="https://cdn.keyauth.cc/v2/assets/js/scripts.bundle.js"></script>
<script src="https://cdn.keyauth.cc/dashboard/webauthn.js"></script>
<script src="https://cdn.keyauth.cc/dashboard/unixtolocal.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<link href="https://cdn.lineicons.com/4.0/lineicons.css" rel="stylesheet" />
<script src="https://cdn.keyauth.cc/v2/assets/plugins/custom/datatables/datatables.bundle.js"></script>
<script src="/scripts/datatables.js"></script>
<script src="https://cdn.keyauth.cc/v3/scripts/sidebar.js"></script>
<script src="https://cdn.keyauth.cc/v3/dist/dashboard.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Get the specific element you want to monitor for scrolling
let scrollableElement = document.querySelector('.relative.overflow-x-auto.shadow-md.sm\\:rounded-lg.pt-5');
console.log(scrollableElement);
// Function to check if the user is within 10 pixels of the bottom
function isCloseToBottom(el) {
return el.scrollHeight - el.scrollTop - el.clientHeight <= 200;
}
setTimeout(function(){
// Attach click event listeners to all "Actions" buttons
var actionButtons = scrollableElement.querySelectorAll('button[type="button"]');
actionButtons.forEach(function(button) {
button.addEventListener('click', function() {
// Check if the user is within 10 pixels of the bottom
if (isCloseToBottom(scrollableElement)) {
setTimeout(function(){
scrollableElement.scrollTo({
top: scrollableElement.scrollHeight,
behavior: 'smooth'
});
}, 100);
}
});
});
}, 1000);
});
</script>
<!--Checkbox feature-->
<script>
$(document).ready(function() {
setTimeout(function() {
$('input[type="checkbox"]').change(function() {
var selected = $('input[type="checkbox"]:checked').map(function() {
if (this.value !== 'on' && this.value !== 'off' && this.value.trim() !== '') {
return this.value;
}
}).get();
$('input[id="selected"]').val(JSON.stringify(selected));
var anyChecked = $('input[type="checkbox"]:checked').filter(function() {
return this.value !== 'on' && this.value !== 'off' && this.value.trim() !== '';
}).length > 0;
if(anyChecked) {
$('#dropdownselection').removeClass('hidden');
} else {
$('#dropdownselection').addClass('hidden');
}
});
}, 1000);
});
</script>
</body>
</html>

289
app/layout/aside.php Normal file
View File

@@ -0,0 +1,289 @@
<?php
$page = isset($_GET['page']) ? $_GET['page'] : "manage-apps";
?>
<style>
/* Hide vertical scrollbar for Webkit-based browsers (e.g., Chrome, Safari) */
*::-webkit-scrollbar {
display: none;
}
</style>
<aside id="sidebar"
class="flex hidden fixed top-0 left-0 z-20 flex-col flex-shrink-0 pt-16 w-64 h-full duration-200 lg:flex transition-width"
aria-label="Sidebar">
<div class="flex relative flex-col flex-1 pt-0 min-h-0 bg-[#0f0f17] border-r border-[#0f0f17]">
<div class="flex overflow-y-auto flex-col flex-1 pt-5 pb-4">
<div class="flex-1 px-3 space-y-1 bg-[#0f0f17] mt-8">
<?php require '../app/layout/profile.php';?>
<div class="mb-4 border-b border-[#0f0f17]">
<ul class="grid grid-cols-3 -mb-px text-sm font-medium text-center" id="myTab"
data-tabs-toggle="#myTabContent" role="tablist">
<?php if (isset($_SESSION["app"])){ ?>
<li class="mr-2" role="presentation">
<button class="inline-block p-4 rounded-t-lg hover:opacity-60" id="app-tab"
data-tabs-target="#app" type="button" role="tab" aria-controls="app" data-tbt="app"
aria-selected="false" data-popover-target="app-popover">App</button>
<?php dashboard\primary\popover("app-popover", "Application", "Find everything related to your application here"); ?>
</li>
<?php } ?>
<?php if ($role == "seller" && isset($_SESSION["app"])){ ?>
<li class="mr-2" role="presentation">
<button class="inline-block p-4 rounded-t-lg hover:opacity-60" id="seller-tab"
data-tabs-target="#seller" type="button" role="tab" data-tbt="seller"
aria-controls="seller" aria-selected="false"
data-popover-target="seller-popover">Seller</button>
<?php dashboard\primary\popover("seller-popover", "Seller", "Everything related to the Seller API can be found here."); ?>
</li>
<?php } ?>
<li class="mr-2" role="presentation">
<button class="inline-block p-4 rounded-t-lg hover:opacity-60" id="account-tab"
data-tabs-target="#account" type="button" role="tab" data-tbt="account"
aria-controls="account" aria-selected="false"
data-popover-target="account-popover">Account</button>
<?php dashboard\primary\popover("account-popover", "Account", "Find everything related to your Account here."); ?>
</li>
</ul>
</div>
<div id="myTabContent">
<div class="hidden p-4 rounded-lg" id="app" role="tabpanel" aria-labelledby="app-tab">
<ul class="space-y-2 font-medium">
<?php if (!($role == "Manager" && !($permissions & 1))){ ?>
<li>
<a href="?page=licenses"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-key"></i>
<span class="ml-3">Licenses</span>
</a>
</li>
<?php } ?>
<?php if (!($role == "Manager" && !($permissions & 2))){ ?>
<li>
<a href="?page=users"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-users"></i>
<span class="ml-3">Users</span>
</a>
</li>
<?php } ?>
<?php if (!($role == "Manager" && !($permissions & 2048))){ ?>
<li>
<a href="?page=tokens"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-tag"></i>
<span class="ml-3">Tokens</span>
</a>
</li>
<?php } ?>
<?php if (!($role == "Manager" && !($permissions & 4))){ ?>
<li>
<a href="?page=subscriptions"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-crown"></i>
<span class="ml-3">Subscriptions</span>
</a>
</li>
<?php } ?>
<?php if (!($role == "Manager" && !($permissions & 8))){ ?>
<li>
<a href="?page=chats"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-popup"></i>
<span class="ml-3">Chats</span>
</a>
</li>
<?php } ?>
<?php if (!($role == "Manager" && !($permissions & 16))){ ?>
<li>
<a href="?page=sessions"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-timer"></i>
<span class="ml-3">Sessions</span>
</a>
</li>
<?php } ?>
<?php if (!($role == "Manager" && !($permissions & 32))){ ?>
<li>
<a href="?page=webhooks"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-webhooks"></i>
<span class="ml-3">Webhooks</span>
</a>
</li>
<?php } ?>
<?php if (!($role == "Manager" && !($permissions & 64))){ ?>
<li>
<a href="?page=files"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-files"></i>
<span class="ml-3">Files</span>
</a>
</li>
<?php } ?>
<?php if (!($role == "Manager" && !($permissions & 128))){ ?>
<li>
<a href="?page=vars"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-code"></i>
<span class="ml-3">Variables</span>
</a>
</li>
<?php } ?>
<?php if (!($role == "Manager" && !($permissions & 256))){ ?>
<li>
<a href="?page=logs"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-archive"></i>
<span class="ml-3">Logs</span>
</a>
</li>
<?php } ?>
<?php if (!($role == "Manager" && !($permissions & 512))){ ?>
<li>
<a href="?page=blacklists"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-ban"></i>
<span class="ml-3">Blacklists</span>
</a>
</li>
<?php } ?>
<?php if (!($role == "Manager" && !($permissions & 4096))){ ?>
<li>
<a href="?page=whitelists"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-checkmark"></i>
<span class="ml-3">Whitelists</span>
</a>
</li>
<?php } ?>
<?php if (!($role == "Manager" && !($permissions & 1024))){ ?>
<li>
<a href="?page=app-settings"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-cog"></i>
<span class="ml-3">Settings</span>
</a>
</li>
<?php } ?>
<?php if ($role != "Manager"){ ?>
<li>
<a href="?page=audit-logs"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-archive"></i>
<span class="ml-3">Audit Logs</span>
</a>
</li>
<?php } ?>
</ul>
</div>
<div class="hidden p-4 rounded-lg " id="seller" role="tabpanel" aria-labelledby="seller-tab">
<ul class="space-y-2 font-medium">
<li>
<a href="?page=seller-settings"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-cog"></i>
<span class="ml-3">Settings</span>
</a>
</li>
<li>
<a href="?page=webloader"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-world"></i>
<span class="ml-3">Web Loader</span>
</a>
</li>
<li>
<a href="?page=seller-logs"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-archive"></i>
<span class="ml-3">Logs</span>
</a>
</li>
</ul>
</div>
<div class="hidden p-4 rounded-lg " id="account" role="tabpanel" aria-labelledby="account-tab">
<ul class="space-y-2 font-medium">
<?php
if (!$formBanned){ ?>
<li>
<a href="?page=forms"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-clipboard"></i>
<span class="ml-3">Forms</span>
</a>
</li>
<?php } ?>
<?php if ($role == "developer" || $role == "seller"){?>
<li>
<a href="?page=manage-accs"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-network"></i>
<span class="ml-3">Reseller | Manager</span>
</a>
</li>
<?php }
$ua = $_SERVER['HTTP_USER_AGENT'];
?>
<?php if ($role != "Manager" && $username != "demoseller" && !str_contains($ua, 'iPhone') && !str_contains($ua, 'Mac OS') && !str_contains($ua, 'Mobile')){ ?>
<li>
<a href="?page=upgrade"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-investment"></i>
<span class="ml-3">Upgrade</span>
</a>
</li>
<?php } ?>
<li>
<a href="?page=account-settings"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-cog"></i>
<span class="ml-3">Settings</span>
</a>
</li>
<?php if ($staff || $admin){ ?>
<li>
<a href="?page=staff-panel"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-star-half"></i>
<span class="ml-3">Staff Panel</span>
</a>
</li>
<?php } ?>
<?php if ($admin){ ?>
<li>
<a href="?page=admin-panel"
class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-sketch"></i>
<span class="ml-3">Admin Panel</span>
</a>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
</div>
</div>
</aside>

34
app/layout/breadcrumb.php Normal file
View File

@@ -0,0 +1,34 @@
<nav class="flex mb-5" aria-label="Breadcrumb">
<ol class="inline-flex items-center space-x-1 md:space-x-2">
<li class="inline-flex items-center">
<a href="?page=manage-apps"
class="inline-flex items-center text-sm font-medium text-gray-400 hover:text-white">
<svg class="w-3 h-3 mr-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor"
viewBox="0 0 20 20">
<path
d="m19.707 9.293-2-2-7-7a1 1 0 0 0-1.414 0l-7 7-2 2a1 1 0 0 0 1.414 1.414L2 10.414V18a2 2 0 0 0 2 2h3a1 1 0 0 0 1-1v-4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v4a1 1 0 0 0 1 1h3a2 2 0 0 0 2-2v-7.586l.293.293a1 1 0 0 0 1.414-1.414Z" />
</svg>
Manage Apps
</a>
</li>
<li>
<div class="flex items-center">
<i class="lni lni-angle-double-right mr-2"></i>
<label class="inline-flex items-center text-sm font-medium text-gray-400">Current App:
<?= $_SESSION['name']; ?> </label>
</div>
</li>
<?php
if (($expires - time() <= 7 * 24 * 60 * 60) && !in_array($role, ['Reseller', 'Manager'])) {
?>
<i class="lni lni-angle-double-right mr-2"></i>
<label class="inline-flex items-center text-sm font-medium text-red-600">
<?= ($role == "tester" ? "You don't have a subscription!" : "Your subscription expires soon!") ?>
<a href="https://<?= $_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME'] ?>/app/?page=upgrade" class="text-blue-600 hover:underline">
&nbsp;Upgrade Now.
</a>
</label>
<?php }
?>
</ol>
</nav>

20
app/layout/footer.php Normal file
View File

@@ -0,0 +1,20 @@
<footer class="bg-[#0f0f17] rounded-lg shadow m-4">
<div class="w-full mx-auto max-w-screen-xl p-4 md:flex md:items-center md:justify-between">
<span class="text-sm text-white-500 sm:text-center">Copyright © 2020 - <script>document.write(new Date().getFullYear())</script> KeyAuth LLC. All Rights Reserved.
</span>
<ul class="flex flex-wrap items-center mt-3 text-sm font-medium sm:mt-0">
<li>
<a href="https://github.com/KeyAuth/KeyAuth-Source-Code" target="_blank" class="mr-4 hover:underline md:mr-6 ">Source Code</a>
</li>
<li>
<a href="https://keyauth.cc/terms" target="_blank" class="mr-4 hover:underline md:mr-6">Terms and Conditions</a>
</li>
<li>
<a href="https://keyauth.cc/privacy" target="_blank" class="mr-4 hover:underline md:mr-6">Privacy</a>
</li>
<li>
<a href="https://chatting.page/gjqkqirygnfslvce2m5eycuo7tfxrhxl" target="_blank" class="hover:underline">Help</a>
</li>
</ul>
</div>
</footer>

47
app/layout/master.php Normal file
View File

@@ -0,0 +1,47 @@
<?php
$page = isset($_GET['page']) ? $_GET['page'] : "manage-apps";
require '../app/layout/topbar.php';
?>
<div class="flex overflow-hidden pt-16 bg-[#09090d]">
<?php
if ($_SESSION["role"] == 'Reseller'){
include '../app/layout/reselleraside.php';
} else{
include '../app/layout/aside.php';
}
?>
<div class="hidden fixed inset-0 z-10" id="sidebarBackdrop"></div>
<div id="main-content" class="overflow-y-auto relative w-full h-full lg:ml-64">
<main>
<?php
try {
if (str_contains($page, ".")) {
throw new ErrorException('');
}
else {
$filePath = __DIR__ . "/../pages/{$page}.php";
if (file_exists($filePath)) {
require $filePath;
}
else {
throw new ErrorException('');
}
}
} catch (ErrorException $ex) {
require '../404_error.html';
}
?>
</main>
<?php
require '../app/layout/footer.php';
?>
</div>
</div>

99
app/layout/profile.php Normal file
View File

@@ -0,0 +1,99 @@
<?php
$query = misc\mysql\query("SELECT * FROM `accounts` WHERE `username` = ?", [$_SESSION['username']]);
if ($query->num_rows > 0) {
while ($row_ = mysqli_fetch_array($query->result)) {
$acclogs = $row_['acclogs'];
$expiry = $row_["expires"];
$emailVerify = $row_["emailVerify"];
}
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['logout'])) {
session_destroy();
header('Location: /login');
exit;
}
}
?>
<div class="w-full max-w-sm border border-gray-700 rounded-lg shadow">
<div class="flex justify-end px-4 pt-2">
<button id="dropdownButton" data-dropdown-toggle="dropdown" class="inline-block text-gray-500 hover:opacity-60 focus:ring-0 p-1.5" type="button">
<span class="sr-only">Open dropdown</span>
<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 3">
<path d="M2 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm6.041 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM14 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Z" />
</svg>
</button>
<!-- Dropdown menu -->
<form method="post">
<div id="dropdown" class="z-10 hidden text-base list-none bg-[#09090d] rounded-lg shadow w-44">
<ul class="py-2" aria-labelledby="dropdownButton">
<li>
<a href="?page=account-settings" class="block px-4 py-2 text-sm text-white hover:bg-blue-700">Account Settings</a>
</li>
<li>
<a href="?page=account-logs" class="block px-4 py-2 text-sm text-white hover:bg-blue-700">Account Logs</a>
</li>
<li>
<a href="?page=logout" class="block px-4 py-2 text-sm text-white hover:bg-blue-700">Log Out</a>
</li>
</ul>
</div>
</form>
</div>
<div class="flex items-center px-4 pb-4 ml-6">
<img class="w-12 h-12 rounded-full mr-3" src="<?= $_SESSION["img"]; ?>" alt="profile image" />
<div class="ml-4 flex flex-col mr-4">
<?php if ($role == "seller") { ?>
<h5 class="mb-1 text-lg font-medium bg-blue-700 stars ml-5"><?= $_SESSION["username"]; ?></h5>
<?php } else { ?>
<h5 class="text-lg font-medium text-blue-700 ml-5"><?= $_SESSION["username"]; ?></h5>
<?php } ?>
<?php
$display = match ($role) {
'tester' => '<label class="text-sm text-gray-400"><b>Expires:</b> Never </label>',
'developer' => '<label class="text-sm text-gray-400"><b>Expires:</b> <span id="expiryLabel"></span> days</label>',
'seller' => '<label class="text-sm text-gray-400"><b>Expires:</b> <span id="expiryLabel"></span> days</label>',
'Reseller' => '<label class="text-sm text-gray-400"><b>Expires:</b> Owner Decides </label>',
'Manager' => '<label class="text-sm text-gray-400"><b>Expires:</b> Owner Decides </label>',
'default' => '<label class="text-sm text-gray-400"><b>Expires:</b> Never </label>'
};
echo $display;
if ($role === 'developer' || $role === 'seller') {
echo '<script>';
echo 'document.getElementById("expiryLabel").textContent = calculateDaysLeft(' . $expiry . ');';
echo 'function calculateDaysLeft(expiryTimestamp) {';
echo ' const currentDate = new Date();';
echo ' const expiryDate = new Date(expiryTimestamp * 1000);'; // Convert Unix timestamp to milliseconds
echo ' const differenceInTime = expiryDate - currentDate;';
echo ' const differenceInDays = Math.ceil(differenceInTime / (1000 * 60 * 60 * 24));';
echo ' return differenceInDays > 0 ? differenceInDays : "Expired";';
echo '}';
echo '</script>';
}
?>
</div>
</div>
<div class="px-4 pb-4">
<?php
$cssClasses = "text-center text-transparent bg-clip-text bg-gradient-to-r to-blue-600 from-sky-400 text-xs font-black px-1.5 py-0.5 rounded border mb-2";
if ($role == "seller") {
$cssClasses .= " border-blue-400";
} elseif ($role == "developer") {
$cssClasses .= " border-white-400";
}
echo "<p class=\"$cssClasses\">" . strtoupper($role) . " PLAN</p>";
?>
</div>
</div>
<br>

View File

@@ -0,0 +1,59 @@
<?php
$page = isset($_GET['page']) ? $_GET['page'] : "index";
?>
<aside id="sidebar"
class="flex hidden fixed top-0 left-0 z-20 flex-col flex-shrink-0 pt-16 w-64 h-full duration-200 lg:flex transition-width"
aria-label="Sidebar">
<div
class="flex relative flex-col flex-1 pt-0 min-h-0 bg-[#0f0f17] border-r border-[#0f0f17]">
<div class="flex overflow-y-auto flex-col flex-1 pt-5 pb-4">
<div class="flex-1 px-3 space-y-1 bg-[#0f0f17]">
<?php require '../app/layout/profile.php';?>
<div class="mb-4 border-b border-[#0f0f17]">
<ul class="flex flex-wrap -mb-px text-sm font-medium text-center" id="myTab" data-tabs-toggle="#myTabContent" role="tablist">
<li class="mr-2" role="presentation">
<button class="inline-block p-4 rounded-t-lg hover:opacity-60" id="app-tab" data-tabs-target="#app" type="button" role="tab" aria-controls="app" aria-selected="false" data-popover-target="app-popover">Reseller</button>
<div data-popover id="app-popover" role="tooltip" class="absolute z-10 invisible inline-block w-64 text-sm text-gray-500 transition-opacity duration-300 bg-[#09090d] rounded-lg shadow-sm opacity-0">
<div class="px-3 py-2 bg-[#09090d]/70 rounded-t-lg">
<h3 class="font-semibold text-white">Reseller</h3>
</div>
<div class="px-3 py-2">
<p>Find everything related to your reseller account here</p>
</div>
<div data-popper-arrow></div>
</div>
</li>
</ul>
</div>
<div id="myTabContent">
<div class="hidden p-4 rounded-lg" id="app" role="tabpanel" aria-labelledby="app-tab">
<ul class="space-y-2 font-medium">
<li>
<a href="?page=reseller-licenses" class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-key"></i>
<span class="ml-3">Licenses</span>
</a>
</li>
<li>
<a href="?page=reseller-users" class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-users"></i>
<span class="ml-3">Users</span>
</a>
</li>
<li>
<a href="?page=reseller-balance" class="flex items-center p-2 rounded-lg text-gray-300 hover:opacity-60 hover:bg-blue-700 group">
<i class="lni lni-tag"></i>
<span class="ml-3">Balance</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</aside>

106
app/layout/topbar.php Normal file
View File

@@ -0,0 +1,106 @@
<nav class="fixed z-30 w-full bg-[#0f0f17] border-[#09090d]">
<div class="py-3 px-3 lg:px-5 lg:pl-3">
<div class="flex justify-between items-center">
<div class="flex justify-start items-center">
<div
class="hidden p-2 text-white rounded cursor-pointer lg:inline hover:opacity-60 transition duration-200 -ml-8">
<div class="w-6 h-6">
</div>
</div>
<button type="button" id="toggleSidebarMobile" aria-expanded="true" aria-controls="sidebar"
class="p-2 mr-2 text-white rounded cursor-pointer lg:hidden hover:opacity-60 focus:ring-0">
<svg id="toggleSidebarMobileHamburger" class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h6a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
clip-rule="evenodd"></path>
</svg>
<svg id="toggleSidebarMobileClose" class="hidden w-6 h-6" fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clip-rule="evenodd"></path>
</svg>
</button>
<img src="/tbs.png" alt="tbS Icon"
style="max-width: 50px; height: auto;">
</div>
<div class="hidden md:block">
</div>
<div id="dropdownDotsHorizontal"
class="z-10 hidden bg-[#09090d] divide-y-2 divide-[#1c64f2] border-2 border-[#1c64f2] rounded-lg shadow w-44">
<ul class="py-2 text-white text-xs" aria-labelledby="dropdownMenuIconHorizontalButton">
<li class="">
<a href="https://keyauthdocs.apidog.io" target="_blank"
class="block px-4 py-2 hover:opacity-60 inline-flex">
<i class="lni lni-code mr-2 mt-1"></i>Documentation
</a>
</li>
<li>
<a href="https://github.com/keyauth" target="_blank"
class="block px-4 py-2 hover:opacity-60 inline-flex">
<i class="lni lni-github-original mr-2 mt-1"></i>Examples
</a>
</li>
<li>
<a href="https://youtube.com/keyauth" target="_blank"
class="block px-4 py-2 hover:opacity-60 inline-flex">
<i class="lni lni-youtube mr-2 mt-1"></i>YouTube
</a>
</li>
<li>
<a href="https://t.me/keyauth" target="_blank"
class="block px-4 py-2 hover:opacity-60 inline-flex">
<i class="lni lni-telegram-original mr-2 mt-1"></i>Telegram
</a>
</li>
<li>
<a href="https://twitter.com/keyauth" target="_blank"
class="block px-4 py-2 hover:opacity-60 inline-flex">
<i class="lni lni-twitter-original mr-2 mt-1"></i>Twitter
</a>
</li>
<li>
<a href="https://instagram.com/keyauthllc" target="_blank"
class="block px-4 py-2 hover:opacity-60 inline-flex">
<i class="lni lni-instagram-original mr-2 mt-1"></i>Instagram
</a>
</li>
<li>
<a href="https://vaultcord.com" target="_blank"
class="block px-4 py-2 hover:opacity-60 inline-flex">
<i class="lni lni-instagram-original mr-2 mt-1"></i>VaultCord
</a>
</li>
</ul>
</div>
<div class="ml-auto flex items-center">
<a type="button" data-canny-changelog style="margin-right: 5px; cursor: pointer;" class="mb-1">
<svg xmlns="http://www.w3.org/2000/svg" height="1.25em" viewBox="0 0 576 512" class="text-white" fill="currentColor">
<!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
<path
d="M224 0c-17.7 0-32 14.3-32 32V51.2C119 66 64 130.6 64 208v18.8c0 47-17.3 92.4-48.5 127.6l-7.4 8.3c-8.4 9.4-10.4 22.9-5.3 34.4S19.4 416 32 416H416c12.6 0 24-7.4 29.2-18.9s3.1-25-5.3-34.4l-7.4-8.3C401.3 319.2 384 273.9 384 226.8V208c0-77.4-55-142-128-156.8V32c0-17.7-14.3-32-32-32zm45.3 493.3c12-12 18.7-28.3 18.7-45.3H224 160c0 17 6.7 33.3 18.7 45.3s28.3 18.7 45.3 18.7s33.3-6.7 45.3-18.7z" />
</svg>
</a>
<a class="block md:hidden" type="button" id="dropdownMenuIconHorizontalButton"
data-dropdown-toggle="dropdownDotsHorizontal" style="cursor: pointer;">
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path
d="M8.465 11.293c1.133-1.133 3.109-1.133 4.242 0l.707.707 1.414-1.414-.707-.707a4.965 4.965 0 0 0-3.535-1.465A4.965 4.965 0 0 0 7.05 9.88L4.929 12a5.008 5.008 0 0 0 0 7.071 4.984 4.984 0 0 0 3.535 1.462A4.984 4.984 0 0 0 12 19.071l.707-.707-1.414-1.414-.707.707a3.007 3.007 0 0 1-4.243 0 3.005 3.005 0 0 1 0-4.243l2.122-2.12Z">
</path>
<path
d="m12 4.93-.707.708 1.414 1.414.707-.707a3.007 3.007 0 0 1 4.243 0 3.005 3.005 0 0 1 0 4.243l-2.122 2.12c-1.133 1.134-3.11 1.134-4.242 0l-.707-.706-1.414 1.414.707.707a4.965 4.965 0 0 0 3.535 1.465 4.965 4.965 0 0 0 3.535-1.465l2.122-2.121a5.008 5.008 0 0 0 0-7.071 5.006 5.006 0 0 0-7.071 0Z">
</path>
</svg>
</a>
</div>
</div>
</div>
</nav>

156
app/license-fetch.php Normal file
View File

@@ -0,0 +1,156 @@
<?php
use function misc\etc\timeconversion;
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);
global $databaseUsername;
$errorMsg = str_replace($databaseUsername, "REDACTED", $exception->getMessage());
die("Error: " . $errorMsg);
});
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if ($_SESSION['role'] == "Reseller") {
die("Resellers can't access this.");
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("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
## Total number of records without filtering
$sel = misc\mysql\query("select count(1) as allcount from `keys` where app = ?", [$_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecords = $records['allcount'];
$totalRecordwithFilter = $totalRecords;
if (!is_null($searchValue)) { // don't double query if no search value was provided
## Total number of record with filtering
$sel = misc\mysql\query("select count(1) as allcount from `keys` WHERE 1 and (`key` like ? or `user` like ? or `note` like ? or `genby` like ? or `usedby` like ? ) and app = ?", ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecordwithFilter = $records['allcount'];
}
// whitelist certain column names and sort orders to prevent SQL injection
if (!in_array($columnName, array("key", 'user', "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 `user` like ? or `note` like ? or `genby` like ? or `usedby` like ? ) and app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, ["%" . $searchValue . "%", "%" . $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 = '<button class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700" name="unbankey" value="' . $row['key'] . '">Unban Key</button>';
} else {
$banBtns = '<button class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700" type="button" onclick="bankey(\'' . $row["key"] . '\')">Ban Key</button>';
}
$MarginManager = "";
if ($query->num_rows < 2) {
$MarginManager = "margin-bottom: 20px;";
} else {
$MarginManager = "margin-bottom: 0px;";
}
match ($row['status']) {
'Not Used' => $statusColor = "border-white text-white",
'Banned' => $statusColor = "border-red-700 text-red-600",
default => $statusColor = "border-blue-700 text-blue-800"
};
$data[] = array(
"checkbox" => '<input type="checkbox" style="outline:none;"class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 checkbox" value="' . $row["key"] .'">',
"key" => $row['key'],
"user" => $row['user'],
"gendate" => '<div id="' . $row['key'] . '-gendate"><script>document.getElementById("' . $row['key'] . '-gendate").textContent=convertTimestamp(' . $row["gendate"] . ');</script></div>',
"genby" => $row['genby'],
"expires" => timeconversion($row["expires"]),
"note" => $row['note'] ?? 'N/A',
"usedon" => (!is_null($row["usedon"])) ? '<div id="' . $row['key'] . '-usedon"><script>document.getElementById("' . $row['key'] . '-usedon").textContent=convertTimestamp(' . $row["usedon"] . ');</script></div>' : 'N/A',
"usedby" => ($row["usedby"] == $row['key']) ? 'Same as key' : $row["usedby"] ?? 'N/A',
"status" => '<span class="border ' . $statusColor . ' text-xs font-medium mr-2 px-2.5 py-0.5 rounded">' . $row['status'] . '</span>',
"actions" => '
<form method="POST" style="' . $MarginManager . '">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true" class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4" type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" style="margin-top:3px">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false" class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1" style="min-width:15rem">
<li>
<button type="button" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
onclick="delkey(\'' . $row["key"] . '\')">
Delete Key
</button>
</li>
<li>
' . $banBtns . '
</li>
<li>
<button class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
name="editkey" value="' . $row['key'] . '">
Edit Key
</button>
</li>
</ul>
</div>
</td>
</tr>
</form>
',
);
}
## Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data
);
die(json_encode($response));
}
die("Request not from datatables, aborted.");

92
app/log-fetch.php Normal file
View File

@@ -0,0 +1,92 @@
<?php
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);
global $databaseUsername;
$errorMsg = str_replace($databaseUsername, "REDACTED", $exception->getMessage());
die("Error: " . $errorMsg);
});
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if ($_SESSION['role'] == "Reseller") {
die("Resellers can't access this.");
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("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
## Total number of records without filtering
$sel = misc\mysql\query("select count(1) as allcount from `logs` where logapp = ?", [$_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecords = $records['allcount'];
$totalRecordwithFilter = $totalRecords;
if (!is_null($searchValue)) { // don't double query if no search value was provided
## Total number of record with filtering
$sel = misc\mysql\query("select count(1) as allcount from `logs` WHERE 1 and (`logdata` like ? or `credential` like ? or `pcuser` like ? ) and logapp = ?", ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecordwithFilter = $records['allcount'];
}
// 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 (!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();
while ($row = mysqli_fetch_assoc($query->result)) {
$data[] = array(
"logdate" => '<div id="' . $row['id'] . '-logdate"><script>document.getElementById("' . $row['id'] . '-logdate").textContent=convertTimestamp(' . $row["logdate"] . ');</script></div>',
"logdata" => $row['logdata'],
"credential" => $row['credential'] ?? 'N/A',
"pcuser" => $row['pcuser'] ?? 'N/A',
);
}
## Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data
);
die(json_encode($response));
}
die("Request not from datatables, aborted.");

View File

@@ -0,0 +1,71 @@
<?php
if ($_SESSION['username'] == "demodeveloper" || $_SESSION['username'] == "demoseller") {
dashboard\primary\error("Due to privacy purposes, demo accounts do not have access to account logs!");
die();
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">Account Logs</h1>
<p class="text-xs text-gray-500">View the event history of your account.</p>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Alert Box -->
<div id="alert" class="flex items-center p-4 mb-4 text-yellow-800 rounded-lg bg-[#09090d]"
role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<span class="sr-only">Info</span>
<div class="ml-3 text-sm font-medium text-yellow-500">
Check out <a
href="https://vaultcord.com/?utm_source=keyauth" target="_blank"
class="font-semibold underline hover:no-underline">VaultCord</a> - Free Discord backup bot. Backup all members & your entire Discord server! Avoid Discord term waves and server nukes <a
href="https://vaultcord.com/?utm_source=keyauth" target="_blank"
class="font-semibold underline hover:no-underline">(click here)</a>
</div>
</div>
<!-- End Alert Box -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_account_logs"
class="w-full text-sm text-left text-gray-500">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Date</th>
<th class="px-6 py-3">IP</th>
<th class="px-6 py-3">User-Agent</th>
</tr>
</thead>
<tbody>
<?php
$query = misc\mysql\query("SELECT * FROM `acclogs` WHERE `username` = ?", [$_SESSION['username']]);
$rows = array();
while ($r = mysqli_fetch_assoc($query->result))
{
$rows[] = $r;
}
foreach ($rows as $row)
{
?>
<tr>
<td>
<script>
document.write(convertTimestamp(<?= $row["date"]; ?>));
</script>
</td>
<td><a class="blur-sm hover:blur-none"><?= $row["ip"]; ?></a></td>
<td><a class="blur-sm hover:blur-none"><?= $row["useragent"]; ?></a></td>
</tr>
<?php
}
?>
</tbody>
</table>

View File

@@ -0,0 +1,607 @@
<?php
if ($_SESSION['username'] == "demodeveloper" || $_SESSION['username'] == "demoseller")
{
dashboard\primary\error("Demo accounts do not have access here... view manage apps for your owner ID!");
die();
}
$twofactor = $row['twofactor'];
require_once '../auth/GoogleAuthenticator.php';
$gauth = new GoogleAuthenticator();
if ($row["googleAuthCode"] == NULL) {
$code_2factor = $gauth->createSecret();
misc\mysql\query("UPDATE `accounts` SET `googleAuthCode` = ? WHERE `username` = ?", [$code_2factor, $_SESSION['username']]);
} else {
$code_2factor = $row["googleAuthCode"];
}
$google_QR_Code = $gauth->getQRCodeGoogleUrl($_SESSION['username'], $code_2factor, 'KeyAuth');
$query = misc\mysql\query("SELECT * FROM `accounts` WHERE `username` = ?", [$_SESSION['username']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)) {
$acclogs = $row['acclogs'];
$expiry = $row["expires"];
$emailVerify = $row["emailVerify"];
}
}
if (isset($_POST['updatesettings'])) {
$pfp = misc\etc\sanitize($_POST['pfp']);
$acclogs = misc\etc\sanitize($_POST['acclogs']);
$emailVerify = misc\etc\sanitize($_POST['emailVerify']);
misc\mysql\query("UPDATE `accounts` SET `acclogs` = ? WHERE `username` = ?", [$acclogs, $_SESSION['username']]);
if ($acclogs == 0) {
misc\mysql\query("DELETE FROM `acclogs` WHERE `username` = ?", [$_SESSION['username']]); // delete all account logs
}
misc\mysql\query("UPDATE `accounts` SET `emailVerify` = ? WHERE `username` = ?", [$emailVerify, $_SESSION['username']]);
if (isset($_POST['pfp']) && trim($_POST['pfp']) != '') {
if (!filter_var($pfp, FILTER_VALIDATE_URL)) {
dashboard\primary\error("Invalid Url For Profile Image!");
echo "<meta http-equiv='Refresh' Content='2;'>";
return;
}
if (strpos($pfp, "file:///") !== false) {
dashboard\primary\error("Url must start with https://");
echo "<meta http-equiv='Refresh' Content='2;'>";
return;
}
$_SESSION['img'] = $pfp;
misc\mysql\query("UPDATE `accounts` SET `img` = ? WHERE `username` = ?", [$pfp, $_SESSION['username']]);
}
dashboard\primary\success("Updated Account Settings!");
}
if (isset($_POST['dlacc'])) {
echo "<meta http-equiv='Refresh' Content='0; url=download-types.php?type=account'>";
}
if (isset($_POST['submit_code'])) {
if($_SESSION['discordLogin']) {
echo "<meta http-equiv='Refresh' Content='3;'>";
dashboard\primary\error("You can't use 2FA when you sign-in with different website! Use 2FA on that website instead");
return;
}
$code = misc\etc\sanitize($_POST['scan_code1'] . ($_POST['scan_code2']) . ($_POST['scan_code3']) . ($_POST['scan_code4']) . ($_POST['scan_code5']) . ($_POST['scan_code6']));
$query = misc\mysql\query("SELECT `googleAuthCode` from `accounts` WHERE `username` = ?", [$_SESSION['username']]);
while ($row = mysqli_fetch_array($query->result)) {
$secret_code = $row['googleAuthCode'];
}
$checkResult = $gauth->verifyCode($secret_code, $code, 2);
if ($checkResult) {
$query = misc\mysql\query("UPDATE `accounts` SET `twofactor` = '1' WHERE `username` = ?", [$_SESSION['username']]);
if ($query->affected_rows > 0) {
echo "<meta http-equiv='Refresh' Content='2;'>";
dashboard\primary\success("Two-factor security has been successfully activated on your account!");
dashboard\primary\wh_log($logwebhook, "{$username} has enabled 2FA", $webhookun, "3586ee", "No ping");
} else {
echo "<meta http-equiv='Refresh' Content='2;'>";
dashboard\primary\wh_log($logwebhook, "{$username} has disabled 2FA", $webhookun, "3586ee", "No ping");;
dashboard\primary\success("Two-factor security has been successfully disabled on your account!");
}
} else {
dashboard\primary\error("Invalid 2FA code! Make sure your device time settings are synced.");
}
}
if (isset($_POST['downloadSecWords'])){
if ($secwords == NULL){
function getRandomWords($count = 10) {
$url = "https://random-word-api.herokuapp.com/word?number={$count}";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
if ($response) {
return json_decode($response);
} else {
return false;
}
}
// Get 10 random words
$randomWords = getRandomWords(10);
if ($randomWords) {
// Format the words into a comma-separated string
$wordString = implode(', ', $randomWords);
$query = misc\mysql\query("UPDATE `accounts` SET `secwords` =? WHERE `username` = ?", [$wordString, $_SESSION['username']]);
if ($query->affected_rows > 0){
dashboard\primary\success("Successfully generated new security words!");
} else {
dashboard\primary\error("Failed to generate new security words!");
}
}
} else {
dashboard\primary\error("Security words already generated. Contact staff if you need to reset them.");
}
}
if (isset($_POST['submit_code_disable']))
{
$code = misc\etc\sanitize($_POST['scan_code']);
$query = misc\mysql\query("SELECT `googleAuthCode` from `accounts` WHERE `username` = ?", [$_SESSION['username']]);
while ($row = mysqli_fetch_array($query->result)) {
$secret_code = $row['googleAuthCode'];
}
$checkResult = $gauth->verifyCode($secret_code, $code, 2);
if ($checkResult)
{
$query = misc\mysql\query("UPDATE `accounts` SET `twofactor` = '0', `googleAuthCode` = NULL WHERE `username` = ?", [$_SESSION['username']]);
if ($query->affected_rows > 0) {
dashboard\primary\success("Successfully disabled 2FA!");
} else {
dashboard\primary\error("Failed to disable 2FA!");
}
} else {
dashboard\primary\error("Invalid 2FA code! Make sure your device time settings are synced.");
}
}
if (isset($_POST['deleteWebauthn']))
{
$name = misc\etc\sanitize($_POST['deleteWebauthn']);
$query = misc\mysql\query("DELETE FROM `securityKeys` WHERE `name` = ? AND `username` = ?", [$name, $_SESSION['username']]);
if ($query->affected_rows > 0) {
$query = misc\mysql\query("SELECT 1 FROM `securityKeys` WHERE `username` = ?", [$_SESSION['username']]);
if ($query->num_rows == 0) {
misc\mysql\query("UPDATE `accounts` SET `securityKey` = 0 WHERE `username` = ?", [$_SESSION['username']]);
}
dashboard\primary\success("Successfully deleted security key");
} else {
dashboard\primary\error("Failed to delete security key!");
}
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">Account Settings</h1>
<p class="text-xs text-gray-500">Manage your account. Tip: You can press Ctrl + S to save settings!</p>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Alert Box -->
<div id="alert" class="flex items-center p-4 mb-4 text-yellow-800 rounded-lg bg-[#09090d]"
role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<span class="sr-only">Info</span>
<div class="ml-3 text-sm font-medium text-yellow-500">
Check out <a
href="https://vaultcord.com/?utm_source=keyauth" target="_blank"
class="font-semibold underline hover:no-underline">VaultCord</a> - Free Discord backup bot. Backup all members & your entire Discord server! Avoid Discord term waves and server nukes <a
href="https://vaultcord.com/?utm_source=keyauth" target="_blank"
class="font-semibold underline hover:no-underline">(click here)</a>
</div>
</div>
<!-- End Alert Box -->
<form method="post">
<div id="lol" class="grid grid-cols-1 lg:grid-cols-2 2xl:grid-cols-8 gap-2">
<div class="relative">
<select id="acclogs" name="acclogs"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="1" <?= $acclogs == 1 ? ' selected="selected"' : ''; ?>>Enabled
</option>
<option value="0" <?= $acclogs == 0 ? ' selected="selected"' : ''; ?>>Disabled
</option>
</select>
<label for="acclogs"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Account
Logs</label>
</div>
<div class="relative">
<select id="emailVerify" name="emailVerify"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="1" <?= $emailVerify == 1 ? ' selected="selected"' : ''; ?>>Enabled
</option>
<option value="0" <?= $emailVerify == 0 ? ' selected="selected"' : ''; ?>>Disabled
</option>
</select>
<label for="emailVerify"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">New
Location Alerts
</label>
</div>
</div>
<div class="relative mb-4 mt-4">
<input type="text" name="username"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="<?= $_SESSION['username'];?>" readonly>
<label for="username"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Username</label>
</div>
<?php
if ($_SESSION["role"] != "Reseller"){ ?>
<div class="relative mb-4 mt-4">
<input type="text" name="ownerid"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on"
value="<?= $_SESSION['ownerid'] ?? "Manager or Reseller accounts do not have OwnerIDs as they can't create applications.";?>"
readonly>
<label for="ownerid"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">OwnerID
</label>
</div>
<?php } ?>
<div class="relative mb-4 mt-4">
<input type="text" name="expires"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " value="<?php if ($_SESSION["role"] == "tester")?> Never "
autocomplete="on" readonly>
<?php if($_SESSION["role"] == "tester"){ ?>
<label for="expires"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Subscription
Expires: </label>
<?php } ?>
<label for="expires"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Subscription
Expires </label>
</div>
<script>
var expiryInput = document.querySelector('input[name="expires"]');
var expiryValue = <?= $expiry ?>;
expiryInput.value = convertTimestamp(expiryValue);
</script>
<div class="relative mb-4 mt-4">
<input type="url" name="pfp" id="pfp"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " max="200" value="<?= $_SESSION['img']; ?>" autocomplete="on">
<label for="pfp"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Profile
Picture URL</label>
</div>
<?php if($_SESSION["role"] != "Manager"){?>
<h1 class="text-sm font-semibold text-white-900 sm:text-sm mb-3">Security Words</h1>
<a class="block max-w-full p-6 bg-[#09090d] border-1 border-gray-300 rounded-lg shadow mb-5">
<p class="text-regular text-white-500">Security Words: 10 random words
that you can use to regain access to your account if you forget your order ID, email,
password, and have no other way to verify the account belongs to you!</p>
<br>
<ul class="max space-y-1 text-gray-500 list-disc list-inside">
<li>Can only be generated <b>1 TIME!</b> (unless you get a new list from an admin)</li>
<li>Should be stored in 2 locations! (USB and PC for example)</li>
<li>Should NOT be called something obvious like "KeyAuthSecurityWords.txt". Prevent
theft! Be smart!</li>
<li>Should never be shared!</li>
<li>Only admins can give you new words</li>
<li>Remember, your words will appear below once generated. Once you refresh the page,
the words will disappear.</li>
</ul>
<p class="text-md text-blue-700 pt-5">
<?= $wordString; ?>
</p>
<div class="flex justify-end">
<?php if ($secwords == NULL){ ?>
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
name="downloadSecWords">
<i class="lni lni-download mr-2 mt-1"></i>Generate Words
</button>
<?php } else {?>
<p class="text-sm text-red-700">
You already generated your security words. Please contact support if you forgot
them.
</p>
<?php } ?>
</div>
</a>
<?php } ?>
<!-- Button Functions -->
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
name="updatesettings" id="updatesettings">
<i class="lni lni-circle-plus mr-2 mt-1"></i>Save
</button>
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-popover-target="linkDiscord-popover"
onclick="window.open('https://<?php echo ($_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME']) ?>/api-php/discord/','popup','width=600,height=600'); return false;">
<i class="lni lni-discord-alt mr-2 mt-1"></i>Link Discord
</button>
<?php dashboard\primary\popover("linkDiscord-popover", "Link Discord", "Linking to Discord will allow you to get a role if you have a paid subscription and be able to talk in the Discord Server."); ?>
<?php if (!$twofactor){
echo '<a class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200 cursor-pointer"
data-modal-target="enable-2fa-modal" data-modal-toggle="enable-2fa-modal"><i class="lni lni-shield mr-2 mt-1"></i>Enable 2FA</a>';
} else {
echo '<a class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200 cursor-pointer"
data-modal-target="disable-2fa-modal" data-modal-toggle="disable-2fa-modal"><i class="lni lni-shield mr-2 mt-1"></i>Disable 2FA</a>';
}
?>
<button name="dlacc"
class="inline-flex text-white bg-purple-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200 cursor-none" disabled>
<i class="lni lni-download mr-2 mt-1"></i>Export Account
</button>
<button type="button"
class="inline-flex text-white bg-purple-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-target="fido2-modal" data-modal-toggle="fido2-modal">
<i class="lni lni-shield mr-2 mt-1"></i>FIDO2 Webauthn (Security Key)
</button>
<a href="https://<?= $_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME'] ?>/forgot/"
target="_blank" type="button"
class="inline-flex text-white bg-orange-500 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">
<i class="lni lni-reload mr-2 mt-1"></i>Change Password
</a>
<a href="https://<?= $_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME']?>/changeEmail/"
target="_blank" type="button"
class="inline-flex text-white bg-orange-500 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">
<i class="lni lni-reload mr-2 mt-1"></i>Change Email
</a>
<a href="https://<?= $_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME']?>/changeUsername/"
target="_blank" type="button"
class="inline-flex text-white bg-orange-500 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">
<i class="lni lni-reload mr-2 mt-1"></i>Change Username
</a>
<a href="https://<?= $_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME']?>/deleteAccount/"
target="_blank" type="button"
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete Account
</a>
</form>
<!-- End Button Functions -->
<?php
if (!$twofactor) {?>
<!-- Enable 2fa Modal -->
<div id="enable-2fa-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Enable 2FA (Two Factor
Authentication)</h3>
<form class="space-y-6" method="POST">
<div>
<label class="mb-5">Scan this QR code into your 2FA App.</label>
<img class="mb-5 mt-5" src="<?= $google_QR_Code ?>" />
<label class="mb-5">Can't scan the QR code? Manually set it instead, code:
<code class="text-blue-700"><?= $code_2factor ?></code></label>
<br><br>
<div id="otp" class="tfa-container">
<input type="text" inputmode="numeric" maxlength="1" id="scan_code1"
name="scan_code1"
class="block px-2.5 pb-2.5 pt-4 w-full text-lg text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" onpaste="handlePaste(event)"
required>
<input type="text" inputmode="numeric" maxlength="1" id="scan_code2"
name="scan_code2"
class="block px-2.5 pb-2.5 pt-4 w-full text-lg text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<input type="text" inputmode="numeric" maxlength="1" id="scan_code3"
name="scan_code3"
class="block px-2.5 pb-2.5 pt-4 w-full text-lg text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<input type="text" inputmode="numeric" maxlength="1" id="scan_code4"
name="scan_code4"
class="block px-2.5 pb-2.5 pt-4 w-full text-lg text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<input type="text" inputmode="numeric" maxlength="1" id="scan_code5"
name="scan_code5"
class="block px-2.5 pb-2.5 pt-4 w-full text-lg text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<input type="text" inputmode="numeric" maxlength="1" id="scan_code6"
name="scan_code6"
class="block px-2.5 pb-2.5 pt-4 w-full text-lg text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
</div>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js">
</script>
<script>
</script>
</div>
<button name="submit_code" id="submit_code"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center"
>Enable 2FA</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Enable 2fa Modal -->
<?php } ?>
<!-- Disable 2fa Modal -->
<div id="disable-2fa-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border-[#1d4ed8] shadow">
<button type="button"
class="absolute top-3 right-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ml-auto inline-flex justify-center items-center"
data-modal-hide="disable-2fa-modal">
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="none" viewBox="0 0 14 14">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" />
</svg>
<span class="sr-only">Close modal</span>
</button>
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Disable 2FA (Two Factor
Authentication)</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4 mt-5">
<input type="text" id="scan_code" name="scan_code"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required="">
<label for="scan_code"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">6
Digit Code from your 2FA app</label>
</div>
</div>
<button name="submit_code_disable"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Disable
2FA</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Disable 2fa Modal -->
<!-- FIDO2 Modal -->
<form class="space-y-6" method="POST">
<div id="fido2-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">FIDO2 WebAuthn (Security
Keys)</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<div>
<div class="relative mb-4">
<input type="text" id="webauthn_name" name="webauthn_name"
placeholder=" " maxlength="99"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on">
<label for="webauthn_name"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">
New Security Key Name</label>
</div>
</div>
<button type="button" onclick="newregistration()"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center mb-5">Register
New Security Key</button>
<h3 class="mb-4 text-xl font-medium text-white-900">Existing Security Keys</h3>
<?php
$query = misc\mysql\query("SELECT * FROM `securityKeys` WHERE `username` = ?", [$_SESSION['username']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)) {
?>
<button type="submit" name="deleteWebauthn" value="<?= $row["name"]; ?>"
onclick="return confirm('Are you sure you want to delete your security key? This cannot be undone.')"
class="w-full text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center mb-5">Delete
Security Key: <?= $row["name"]; ?></button>
<?php
}
}
?>
</div>
</div>
</div>
</div>
</form>
<!-- End FIDO2 Modal -->
<script>
$(document).keydown(function(event) {
if (event.ctrlKey && event.key === 's') {
$("#updatesettings").click();
event.preventDefault();
}
});
function handlePaste(event) {
event.preventDefault();
var clipboardData = event.clipboardData || window.clipboardData;
var pastedData = clipboardData.getData('text');
var inputs = document.querySelectorAll(".tfa-container input");
// Check if the pasted data is exactly 6 digits long
if (/^\d{6}$/.test(pastedData)) {
for (var i = 0; i < 6; i++) {
inputs[i].value = pastedData.charAt(i);
}
}
}
function updateButtonState(inputs) {
var allNumeric = true;
// Check if all input fields have numeric values
for (var i = 0; i < inputs.length; i++) {
if (!/^\d$/.test(inputs[i].value)) {
allNumeric = false;
break;
}
}
// Enable or disable the button based on the input values
var button = document.getElementById('submit_code');
button.disabled = !allNumeric;
}
// Add event listeners to each input field to monitor changes
var inputs = document.querySelectorAll(".tfa-container input");
for (var i = 0; i < inputs.length; i++) {
(function(index){
inputs[index].addEventListener('input', function(e) {
// Move to the next field if the current one has a value
if (this.value.length === this.maxLength) {
if (index < inputs.length - 1) {
inputs[index + 1].focus(); // Move focus to the next input field
}
}
});
inputs[index].addEventListener('keydown', function(e) {
// Move to the previous field if backspace is pressed on an empty field
if (e.key === "Backspace" && this.value.length === 0) {
if (index > 0) {
inputs[index - 1].focus(); // Move focus to the previous input field
}
}
});
})(i);
inputs[i].addEventListener('input', function() {
updateButtonState(inputs);
});
}
</script>

806
app/pages/admin-panel.php Normal file
View File

@@ -0,0 +1,806 @@
<?php
if (!$admin) {
ob_clean();
http_response_code(403);
require '../404_error.html';
die();
}
date_default_timezone_set('UTC');
if (!$twofactor) {
dashboard\primary\error("Admin accounts must have 2FA enabled.");
die("Admin accounts must have 2FA enabled");
}
if (isset($_POST['searchemail'])) {
$email = misc\etc\sanitize($_POST['email']);
header("Location:./?page=admin-panel&email=" . $email);
die();
}
if (isset($_POST['searchusername'])) {
$un = misc\etc\sanitize($_POST['un']);
header("Location: ./?page=admin-panel&username=" . urlencode($un));
die();
}
if (isset($_POST['searchownerid'])){
$ownerid = misc\etc\sanitize($_POST['ownerid']);
header("Location: ./?page=admin-panel&ownerid=" . urlencode($ownerid));
die();
}
if (isset($_POST['banacc'])) {
if(misc\cache\rateLimit("KeyAuthAdminBans:" . $_SESSION['username'], 1, 3600, 3)) {
misc\mysql\query("UPDATE `accounts` SET `admin` = 0 WHERE `username` = ?", [$_SESSION['username']]);
dashboard\primary\wh_log($adminwebhook, " the admin `{$username}` has been removed for banning too many people", $adminwebhookun, "41db10", "<@1268915723330392096>");
dashboard\primary\error("You banned too many accounts too frequently, your admin is removed");
return;
}
$un = misc\etc\sanitize($_POST['banacc']);
$reason = misc\etc\sanitize($_POST['reason']);
$query = misc\mysql\query("SELECT `admin`, `banned` FROM `accounts` WHERE `username` = ?", [$un]);
if ($query->num_rows < 1) {
echo '<meta http-equiv="refresh" content="2">';
dashboard\primary\error("Account not found!");
return;
}
if (!is_null(mysqli_fetch_array($query->result)['banned'])) {
echo '<meta http-equiv="refresh" content="2">';
dashboard\primary\error("User is already banned!");
return;
}
if (mysqli_fetch_array($query->result)['admin']) {
echo '<meta http-equiv="refresh" content="2">';
dashboard\primary\error("User is an admin!");
return;
}
misc\mysql\query("UPDATE `accounts` SET `banned` = ? WHERE `username` = ?", [$reason, $un]); // set account to banned
misc\mysql\query("UPDATE `apps` SET `banned` = '1' WHERE `owner` = ?", [$un]); // ban all apps owned by account
dashboard\primary\wh_log($adminwebhook, "Admin `{$username}` has banned user `{$un}` for reason `{$reason}`", $adminwebhookun, "41db10", "No ping");
dashboard\primary\success("Account Banned!");
$query = misc\mysql\query("SELECT `name`, `ownerid` FROM `apps` WHERE `owner` = ?", [$un]);
$rows = array();
while ($r = mysqli_fetch_assoc($query->result)) {
$rows[] = $r;
}
foreach ($rows as $row) {
misc\cache\purge('KeyAuthApp:' . $row['name'] . ':' . $row['ownerid']);
}
$query = misc\mysql\query("SELECT `role` FROM `accounts` WHERE `username` = ?", [$un]);
$row = mysqli_fetch_array($query->result);
if ($row['role'] == "seller") {
$query = misc\mysql\query("SELECT `sellerkey` FROM `apps` WHERE `owner` = ?", [$un]);
$rows = array();
while ($r = mysqli_fetch_assoc($query->result)) {
$rows[] = $r;
}
foreach ($rows as $row) {
misc\cache\purge('KeyAuthAppSeller:' . $row['sellerkey']);
}
}
}
if (isset($_POST['unbanacc'])) {
$un = misc\etc\sanitize($_POST['unbanacc']);
$query = misc\mysql\query("SELECT `admin`,`banned` FROM `accounts` WHERE `username` = ?", [$un]);
if ($query->num_rows < 1) {
echo '<meta http-equiv="refresh" content="2">';
dashboard\primary\error("Account not found!");
return;
}
if (is_null(mysqli_fetch_array($query->result)['banned'])) {
echo '<meta http-equiv="refresh" content="2">';
dashboard\primary\error("User isn't banned!");
return;
}
if (mysqli_fetch_array($query->result)['admin']) {
echo '<meta http-equiv="refresh" content="2">';
dashboard\primary\error("User is an admin!");
return;
}
misc\mysql\query("UPDATE `accounts` SET `banned` = NULL WHERE `username` = ?", [$un]); // set account to not banned
misc\mysql\query("UPDATE `apps` SET `banned` = '0' WHERE `owner` = ?", [$un]); // unban all apps owned by account
dashboard\primary\wh_log($adminwebhook, "Admin `{$username}` has unbanned user `{$un}`", $adminwebhookun, "41db10", "No ping");
dashboard\primary\success("Account Unbanned!");
$query = misc\mysql\query("SELECT `name`, `ownerid` FROM `apps` WHERE `owner` = ?", [$un]);
$rows = array();
while ($r = mysqli_fetch_assoc($query->result)) {
$rows[] = $r;
}
foreach ($rows as $row) {
misc\cache\purge('KeyAuthApp:' . $row['name'] . ':' . $row['ownerid']);
}
$query = misc\mysql\query("SELECT `role` FROM `accounts` WHERE `username` = ?", [$un]);
$row = mysqli_fetch_array($query->result);
if ($row['role'] == "seller") {
$query = misc\mysql\query("SELECT `sellerkey` FROM `apps` WHERE `owner` = ?", [$un]);
$rows = array();
while ($r = mysqli_fetch_assoc($query->result)) {
$rows[] = $r;
}
foreach ($rows as $row) {
misc\cache\purge('KeyAuthAppSeller:' . $row['sellerkey']);
}
}
}
if (isset($_POST['purgeRedis']))
{
$redisKey = misc\etc\sanitize($_POST['redisKey']);
if(str_contains(strtolower($redisKey), "keyauthadminbans")) {
echo '<meta http-equiv="refresh" content="2">';
dashboard\primary\error("You're not allowed to purge this key");
return;
}
if(str_contains(strtolower($redisKey), "keyauthadminedits")) {
echo '<meta http-equiv="refresh" content="2">';
dashboard\primary\error("You're not allowed to purge this key");
return;
}
misc\cache\purge($redisKey);
dashboard\primary\success("Purged redis key");
dashboard\primary\wh_log($adminwebhook, "Admin `{$username}` has purged a redis key for `{$redisKey}`", $adminwebhookun, "41db10", "No ping");
}
if (isset($_POST['purgeRedisPattern'])) {
$redisKey = misc\etc\sanitize($_POST['redisKeyPattern']);
if(str_contains(strtolower($redisKey), "keyauthadminbans")) {
echo '<meta http-equiv="refresh" content="2">';
dashboard\primary\error("You're not allowed to purge this key");
return;
}
if(str_contains(strtolower($redisKey), "keyauthadminedits")) {
echo '<meta http-equiv="refresh" content="2">';
dashboard\primary\error("You're not allowed to purge this key");
return;
}
misc\cache\purgePattern($redisKey);
dashboard\primary\success("Purged redis key(s)");
dashboard\primary\wh_log($adminwebhook, "Admin `{$username}` has purged a redis pattern for `{$redisKey}`", $adminwebhookun, "41db10", "No ping");
}
if(isset($_POST['searchOrder']))
{
$orderID = misc\etc\sanitize($_POST['orderID']);
$query = misc\mysql\query("SELECT `username` FROM `orders` WHERE `orderID` = ?", [$orderID]);
if($query->num_rows < 1) {
dashboard\primary\error("Order not found!");
} else {
$row = mysqli_fetch_array($query->result);
}
}
if (isset($_POST['saveacc'])) {
if(misc\cache\rateLimit("KeyAuthAdminEdits:" . $_SESSION['username'], 1, 3600, 3)) {
misc\mysql\query("UPDATE `accounts` SET `admin` = 0 WHERE `username` = ?", [$_SESSION['username']]);
dashboard\primary\wh_log($adminwebhook, "the admin `{$username}` has been removed for editing too many people", $adminwebhookun, "db1010", "<@1268915723330392096> ");
dashboard\primary\error("You edited too many accounts too frequently, your admin is removed");
return;
}
$un = misc\etc\sanitize($_POST['saveacc']);
$email = misc\etc\sanitize($_POST['email']);
$role = misc\etc\sanitize($_POST['role']);
$secKey = misc\etc\sanitize($_POST['secKey']);
$totp = misc\etc\sanitize($_POST['totp']);
$staff = misc\etc\sanitize($_POST['staff']);
$alertMsg = misc\etc\sanitize($_POST['alert']);
$formBanned = misc\etc\sanitize($_POST['formBanned']);
$query = misc\mysql\query("SELECT `role`,`admin` FROM `accounts` WHERE `username` = ?", [$un]);
$row = mysqli_fetch_array($query->result);
if ($row['admin']) {
echo '<meta http-equiv="refresh" content="2">';
dashboard\primary\error("User is an admin!");
return;
}
if ($row['role'] == "seller" || $role == "seller") { // purge cache for SellerAPI check if user was seller and getting downgraded, or was another plan and getting upgraded to seller.
misc\cache\purge('KeyAuthSellerCheck:' . $un);
}
switch ($role) {
case 'seller':
$expires = time() + (int) $_POST['expiry'];
break;
case 'developer':
$expires = time() + (int) $_POST['expiry'];
break;
case 'tester':
$expires = NULL;
break;
case 'reseller':
$expires = NULL;
break;
case 'manager':
$expires = NULL;
break;
default:
dashboard\primary\error("Invalid role!");
echo "<meta http-equiv='Refresh' Content='2'>";
return;
}
misc\mysql\query("UPDATE `accounts` SET `role` = ?, `securityKey` = ?, `twofactor` = ?, `alert` = ? WHERE `username` = ?", [$role, $secKey, $totp, $alertMsg, $un]);
if (strlen($email) != 40) {
misc\mysql\query("UPDATE `accounts` SET `email` = SHA1(?) WHERE `username` = ?", [$email, $un]);
}
if ($row['role'] != $role) {
misc\mysql\query("UPDATE `accounts` SET `expires` = NULLIF(?, '') WHERE `username` = ?", [$expires, $un]);
}
if ($row['staff'] != $staff){
misc\mysql\query("UPDATE `accounts` SET `staff` = NULLIF(?, '') WHERE `username` = ?", [$staff, $un]);
}
if ($row['formBanned'] != $formBanned){
misc\mysql\query("UPDATE `accounts` SET `formBanned` = NULLIF(?, '') WHERE `username` = ?", [$formBanned, $un]);
}
if (isset($_POST['resetSecWordsCB'])){
misc\mysql\query("UPDATE `accounts` SET `secWords` = NULL WHERE `username` = ?", [$un]);
}
dashboard\primary\wh_log($adminwebhook, "Admin `{$username}` has updated user `{$un}` \n email to: `{$email}`, \n role to: `{$role}`, \n 2FA status to: `{$totp}`, \n staff status to: `{$staff}`, \n form banned status to: `{$formBanned}`, \n alert to: `{$alertMsg}`", $adminwebhookun, "41db10", "No ping");
dashboard\primary\success("Updated Account!");
}
if (isset($_POST['editacc'])) {
$un = misc\etc\sanitize($_POST['editacc']);
$query = misc\mysql\query("SELECT * FROM `accounts` WHERE `username` = ?", [$un]);
$row = mysqli_fetch_array($query->result);
$role = $row['role'];
$secKey = $row['securityKey'];
$totp = $row['twofactor'];
$formBanned = $row['formBanned'];
$alertMsg = $row['alert'];
$secWords = $row['secWords'];
$staff = $row['staff'];
$admin = $row['admin'];
if ($admin) {
echo '<meta http-equiv="refresh" content="2">';
dashboard\primary\error("User is an admin!");
return;
}
?>
<!-- Edit Acc Modal -->
<div id="edit-acc" aria-hidden="true"
class="fixed grid place-items-center h-screen bg-black bg-opacity-60 z-50 p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Admin - Edit User</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="email" name="email"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="<?= $row['email']; ?>" required>
<label for="email"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Email</label>
</div>
<div class="relative mb-4">
<select id="role" name="role"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="seller" <?= $role == 'seller' ? 'selected="selected"' : ''; ?>>
Seller
</option>
<option value="developer" <?= $role == 'developer' ? 'selected="selected"' : ''; ?>>
Developer
</option>
<option value="tester" <?= $role == 'tester' ? 'selected="selected"' : ''; ?>>
Tester
</option>
<option value="reseller" <?= $role == 'reseller' ? 'selected="selected"' : ''; ?>>
Reseller
</option>
<option value="manager" <?= $role == 'manager' ? 'selected="selected"' : ''; ?>>
Manager
</option>
</select>
<label for="role"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Role</label>
</div>
<div class="relative mb-4">
<select id="expiry" name="expiry"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="31556926">
Yearly
</option>
<option value="2629743">
Monthly
</option>
</select>
<label for="expiry"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Expiration</label>
</div>
<div class="relative mb-4">
<select id="secKey" name="secKey"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="0" <?= $secKey == 0 ? 'selected="selected"' : ''; ?>>
false
</option>
<option value="1" <?= $secKey == 1 ? 'selected="selected"' : ''; ?>>
true
</option>
</select>
<label for="secKey"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Security Key</label>
</div>
<div class="relative mb-4">
<select id="totp" name="totp"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="0" <?= $totp == 0 ? 'selected="selected"' : ''; ?>>
false
</option>
<option value="1" <?= $totp == 1 ? 'selected="selected"' : ''; ?>>
true
</option>
</select>
<label for="totp"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">2FA
Status</label>
</div>
<div class="relative mb-4">
<select id="staff" name="staff"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="0" <?= $staff == 0 ? 'selected="selected"' : ''; ?>>
false
</option>
<option value="1" <?= $staff == 1 ? 'selected="selected"' : ''; ?>>
true
</option>
</select>
<label for="staff"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Staff
Status</label>
</div>
<div class="relative mb-4">
<select id="formBanned" name="formBanned"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"
data-popover-target="formBanned-popover">
<option value="0" <?= $formBanned == 0 ? 'selected="selected"' : ''; ?>>
false
</option>
<option value="1" <?= $formBanned == 1 ? 'selected="selected"' : ''; ?>>
true
</option>
</select>
<label for="formBanned"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Form
Banned</label>
<?php dashboard\primary\popover("formBanned-popover", "Form Banned", "Used to ban the user from submitting any forms (suggestion, bug, staff, etc)."); ?>
</div>
<div class="relative mb-4">
<input type="text" id="alert" name="alert"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="<?= $row['alert']; ?>"
data-popover-target="alert-popover">
<label for="alert"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Alert</label>
<?php dashboard\primary\popover("alert-popover", "Alert", "Used to send a message to the users manage-apps page."); ?>
</div>
<div class="relative mb-4">
<input datepicker datepicker-autohide type="datetime-local"
name="expiryType" class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5 "
placeholder="Subscription Expiry"
value="<?= date('Y-m-d H:i:s', $row['expires']);?>" required readonly>
</div>
<div class="relative mb-4">
<p class="text-xs text-white-500"><b>Security Words:</b> <?= $secWords ?? "N/A"; ?>
</div>
<?php if ($secWords != null) {?>
<div class="flex items-center mb-4">
<input id="resetSecWordsCB" name="resetSecWordsCB" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
unchecked data-popover-target="resetSecWordsCB-popover">
<label for="resetSecWordsCB"
class="ml-2 text-sm font-medium text-white-900">
Reset Security Words?</label>
<?php dashboard\primary\popover("resetSecWordsCB-popover", "Reset Security Words", "If a user forgot their security words, or gave them to you to verify their account, they must be reset. "); ?>
</div>
<?php } ?>
</div>
<button name="saveacc" value="<?= $un; ?>"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Update
Account</button>
<button onClick="window.location.href=window.location.href"
class="w-full text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Edit Acc Modal -->
<?php }
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">Admin Panel</h1>
<p class="text-xs text-gray-500">Welcome <a class="text-blue-700"><?= $username; ?></a> To The Admin Panel!
</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Admin Functions -->
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="search-by-email-modal" data-modal-target="search-by-email-modal">
<i class="lni lni-search mr-2 mt-1"></i>Search By Email
</button>
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="search-by-username-modal" data-modal-target="search-by-username-modal">
<i class="lni lni-search mr-2 mt-1"></i>Search By Username
</button>
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="search-by-ownerid-modal" data-modal-target="search-by-ownerid-modal">
<i class="lni lni-search mr-2 mt-1"></i>Search By Owner ID
</button>
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="search-by-orderid-modal" data-modal-target="search-by-orderid-modal">
<i class="lni lni-search mr-2 mt-1"></i>Search By Order ID
</button>
<!-- End Admin Functions -->
<br>
<!-- Admin Redis Functions -->
<button
class="inline-flex text-white bg-orange-500 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="purge-redis-key-modal" data-modal-target="purge-redis-key-modal">
<i class="lni lni-eraser mr-2 mt-1"></i>Purge Redis Key
</button>
<button
class="inline-flex text-white bg-orange-500 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="purge-redis-pattern-modal" data-modal-target="purge-redis-pattern-modal">
<i class="lni lni-eraser mr-2 mt-1"></i>Purge Redis Pattern
</button>
<!-- End Admin Redis Functions -->
<!-- Search By Email Modal -->
<div id="search-by-email-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-blue-700 shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Search By Email</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="email" name="email"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required="">
<label for="email"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Users
Email</label>
</div>
</div>
<button name="searchemail"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Search</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Search By Email Modal -->
<!-- Search By Username Modal -->
<div id="search-by-username-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-blue-700 shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Search By Username</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="un" name="un"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required="">
<label for="un"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Users
Username</label>
</div>
</div>
<button name="searchusername"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Search</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Search By Username Modal -->
<!-- Search By Ownerid Modal -->
<div id="search-by-ownerid-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-blue-700 shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Search By Ownerid</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="ownerid" name="ownerid"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<label for="ownerid"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Users
Ownerid</label>
</div>
</div>
<button name="searchownerid"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Search</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Search By Ownerid Modal -->
<!-- Search By OrderID Modal -->
<div id="search-by-orderid-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-blue-700 shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Search By Order ID</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="orderID" name="orderID"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<label for="orderID"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Users
OrderID</label>
</div>
</div>
<button name="searchOrder"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Search</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Search By OrderID Modal -->
<!-- Purge Redis Key Modal -->
<div id="purge-redis-key-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-orange-700 shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Purge Redis Key</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="un" name="purgeRedis"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer focus:border-orange-700"
placeholder=" " autocomplete="on" required="">
<label for="purgeRedis"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-orange-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Redis
Key</label>
</div>
</div>
<button name="redisKey"
class="w-full text-white bg-orange-700 hover:bg-orange-800 focus:ring-4 focus:outline-none focus:ring-orange-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Purge</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Purge Redis Key Modal -->
<!-- Purge Redis Key Pattern Modal -->
<div id="purge-redis-pattern-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-orange-700 shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Purge Redis Key Pattern</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="un" name="purgeRedis"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer focus:border-orange-700"
placeholder=" " autocomplete="on" required="">
<label for="purgeRedis"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-orange-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Redis
Key Pattern</label>
</div>
</div>
<button name="redisKey"
class="w-full text-white bg-orange-700 hover:bg-orange-800 focus:ring-4 focus:outline-none focus:ring-orange-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Purge</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Purge Redis Key Pattern Modal -->
<!-- Ban User Modal -->
<div id="ban-user-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-blue-700 shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Ban User - Reason</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="reason" name="reason"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<label for="reason"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Ban
Reason</label>
</div>
</div>
<button name="banacc"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center banacc">Ban
User</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Ban User Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_admin" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Username</th>
<th class="px-6 py-3">Owner ID</th>
<th class="px-6 py-3">Email</th>
<th class="px-6 py-3">Role</th>
<th class="px-6 py-3">Staff</th>
<th class="px-6 py-3">Ban Status</th>
<th class="py-6 py-3">Security Key</th>
<th class="px-6 py-3">2FA Status</th>
<th class="px-6 py-3">Register IP</th>
<th class="px-6 py-3">Last IP</th>
<th class="px-6 py-3">Action</th>
</tr>
</thead>
<tbody>
<?php
$un = misc\etc\sanitize($_GET['username']);
$email = misc\etc\sanitize($_GET['email']);
$ownerid = misc\etc\sanitize($_GET['ownerid']);
$query = misc\mysql\query("SELECT * FROM `accounts` WHERE (`username` = ? OR `email` = SHA1(?)) OR `ownerid` = ? AND `admin` = 0", [$un, $email, $ownerid]);
$rows = array();
while ($r = mysqli_fetch_assoc($query->result)){
$rows[] = $r;
}
foreach ($rows as $row){
$un = $row['username'];
$ban = $row['banned'] == NULL ? 'False' : 'True';
$secKey = (($row['securityKey'] ? 1 : 0) ? 'True' : 'False');
$totp = (($row['twofactor'] ? 1 : 0) ? 'True' : 'False');
$staff = (($row['staff'] ? 1 : 0) ? 'True' : 'False');
?>
<tr>
<td><?= $un; ?></td>
<td><?= $row["ownerid"]; ?></td>
<td><?= $row["email"]; ?></td>
<td><?= $row["role"]; ?></td>
<td><?= $staff; ?></td>
<td><?= $ban; ?></td>
<td><?= $secKey; ?></td>
<td><?= $totp; ?></td>
<td><a class="blur-sm hover:blur-none"><?= $row["registrationip"] ?? "None"; ?></a>
</td>
<td><a class="blur-sm hover:blur-none"><?= $row["lastip"] ?? "None"; ?></a></td>
<form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true"
class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4"
type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20" style="margin-top:3px">
<path
d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" />
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false"
class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1"
style="min-width:15rem">
<li>
<button type="button" data-modal-target="ban-user-modal" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
data-modal-toggle="ban-user-modal"
onclick="banacc('<?= $un; ?>')">
Ban
</button>
</li>
<li>
<button name="unbanacc"
class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
value="<?= $un; ?>">
Unban
</button>
</li>
<li>
<button name="editacc"
class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
value="<?= $un; ?>">
Edit
</button>
</li>
</ul>
</div>
</td>
</tr>
</form>
<?php
}
?>
</tbody>
</table>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
function banacc(un) {
var banacc = $('.banacc');
banacc.attr('value', un);
}
</script>

2087
app/pages/app-settings.php Normal file

File diff suppressed because it is too large Load Diff

120
app/pages/audit-logs.php Normal file
View File

@@ -0,0 +1,120 @@
<?php
if ($_SESSION['role'] == "Reseller") {
header("location: ./?page=reseller-licenses");
die();
}
if ($role == "Manager") {
misc\auditLog\send("Attempted (and failed) to view audit logs.");
dashboard\primary\error("Managers aren't allowed to view audit logs.");
die();
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
if (isset($_POST['delauditLogs'])){
$resp = misc\auditLog\deleteAll();
match($resp){
'failure' => dashboard\primary\error("Failed to delete all audit logs"),
'success' => dashboard\primary\success("Successfully deleted all audit logs!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['exportAuditLogs'])) {
echo "<meta http-equiv='Refresh' Content='0; url=download-types.php?type=auditLog'>";
// get all rows, put in text file, download text file, delete text file.
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">Audit Logs</h1>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<form method="POST">
<!-- Audit Logs Functions -->
<button name="exportAuditLogs"
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">
<i class="lni lni-download mr-2 mt-1"></i>Export Audit Logs
</button>
<!-- End Audit Logs Functions -->
<br>
<!-- Delete Audit Logs Functions -->
<button type="button"
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-audit-logs-modal"
data-modal-target="delete-all-audit-logs-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Audit Logs
</button>
<!-- End Delete Audit Logs Functions -->
</form>
<!-- Delete All Audit Logs Modal -->
<div id="delete-all-audit-logs-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to delete all of your
Audit logs. Are you sure you want to continue?
</b>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
all of your Audit Logs? This can not be undone.</h3>
<form method="POST">
<button data-modal-hide="delete-all-audit-logs-modal" name="delauditLogs"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-audit-logs-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Audit Logs Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_webhooks" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">User</th>
<th class="px-6 py-3">Event</th>
<th class="px-6 py-3">Time</th>
</tr>
</thead>
<tbody>
<?php
if ($_SESSION['app']) {
$query = misc\mysql\query("SELECT * FROM `auditLog` WHERE `app` = ?", [$_SESSION['app']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)) {
echo "<tr>";
echo " <td>" . $row["user"] . "</td>";
echo " <td>" . $row["event"] . "</td>";
echo " <td><script>document.write(convertTimestamp(" . $row["time"] . "));</script></td>";
echo "</tr>";
}
}
}
?>
</tbody>
</table>
</div>

239
app/pages/blacklists.php Normal file
View File

@@ -0,0 +1,239 @@
<?php
if ($_SESSION['role'] == "Reseller") {
header("location: ./?page=reseller-licenses");
die();
}
if ($role == "Manager" && !($permissions & 512)) {
misc\auditLog\send("Attempted (and failed) to view blacklists.");
dashboard\primary\error("You weren't granted permission to view this page!");
die();
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
if (isset($_POST['addblack'])) {
$resp = misc\blacklist\add($_POST['blackdata'], $_POST['blacktype']);
match($resp){
'invalid' => dashboard\primary\error("Invalid blacklist type!"),
'failure' => dashboard\primary\error("Failed to add blacklists!"),
'success' => dashboard\primary\success("Successfully added blacklists!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['delblacks'])) {
$resp = misc\blacklist\deleteAll();
match($resp){
'failure' => dashboard\primary\error("Failed to delete all whitelists!"),
'success' => dashboard\primary\success("Successfully deleted all whitelists!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['deleteblack'])) {
$resp = misc\blacklist\deleteSingular($_POST['deleteblack'], $_POST['type']);
match($resp){
'invalid' => dashboard\primary\error("Invalid blacklist type!"),
'failure' => dashboard\primary\error("Failed to delete blacklist!"),
'success' => dashboard\primary\success("Successfully deleted blacklist!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST["selected"]) && isset($_POST["action"])) {
if ($_POST["action"] == "delete") {
$data = json_decode($_POST["selected"], true);
$array = array_map('urldecode', $data);
foreach ($array as $item) {
$decoded = json_decode($item, true);
$resp = misc\blacklist\deleteSingular($decoded['value'], $decoded['type']);
match($resp){
'invalid' => dashboard\primary\error("Invalid blacklist type!"),
'failure' => dashboard\primary\error("Failed to delete blacklist!"),
'success' => dashboard\primary\success("Successfully deleted blacklist!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
}else {
dashboard\primary\error("Unhandled Error! Contact us if you need help - Action:BLPxDB");
}
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">Blacklists</h1>
<p class="text-xs text-gray-500">Block access from certain IPs/HWIDs <a
href="https://keyauthdocs.apidog.io/api/features/check-blacklist" target="_blank"
class="text-blue-600 hover:underline">Learn More</a>.</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Blacklists Functions -->
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="add-blacklist-modal" data-modal-target="add-blacklist-modal">
<i class="lni lni-circle-plus mr-2 mt-1"></i>Create Blacklist
</button>
<!-- End Blacklists Functions -->
<br>
<!-- Delete Blacklists Functions -->
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-blacklists-modal" data-modal-target="delete-all-blacklists-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Blacklists
</button>
<button id="dropdownselection" data-dropdown-toggle="blacklistdropdown"
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200 hidden"
type="button">Selection Options
</button>
<div id="blacklistdropdown" class="z-10 hidden bg-[#09090d] divide-y divide-gray-100 rounded-lg shadow w-44">
<ul class="py-2 text-sm text-white">
<li>
<form method="post">
<input type="hidden" name="action" value="delete">
<input type="hidden" id="selected" name="selected">
<a href="#" onclick="this.parentNode.submit();" class="block px-4 py-2 focus:bold ml-2 hover:text-red-700">Delete selected</a>
</form>
</li>
</ul>
</div>
<!-- End Delete Blacklists Functions -->
<!-- Add To Blacklist Modal -->
<div id="add-blacklist-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Add Blacklist</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4 ">
<select id="blacktype" name="blacktype"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="IP Address" selected>IP Address</option>
<option value="Hardware ID">Hardware ID</option>
<option value="region">Region/State</option>
<option value="country">Country Code</option>
<option value="asn">ASN Number</option>
</select>
<label for="blacktype"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Blacklist
Type</label>
</div>
<div class="relative mb-4">
<input type="text" id="blackdata" name="blackdata"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<label for="blackdata"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">
Enter blacklist data
</label>
</div>
</div>
<button type="submit" name="addblack"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Blacklist</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Add Blacklist Modal -->
<!-- Delete All Blacklists Modal -->
<div id="delete-all-blacklists-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to delete all of your
Blacklists. Are you sure you want to continue?
</b>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
all of your Blacklists? This can not be undone.</h3>
<form method="POST">
<button data-modal-hide="delete-all-blacklists-modal" name="delblacks"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-blacklists-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Blacklists Modal -->
<!-- Dynamically change placeholder for blacklist, so users have examples of what data to enter -->
<script>
$(document).ready(function() {
$('#blacktype').on('change', function() {
var selectedValue = $(this).val();
var placeholderText = '';
switch (selectedValue) {
case 'IP Address':
placeholderText = 'IP Address (example: 142.250.64.206)';
break;
case 'Hardware ID':
placeholderText = 'Hardware ID (example: S-1-5-21-1085031214-1563985344-725345543)';
break;
case 'region':
placeholderText = 'Region/State (example: ENG for England)';
break;
case 'country':
placeholderText = 'Country Code (example: IT for Italy)';
break;
case 'asn':
placeholderText = 'ASN Number (example: 15169 for Google LLC)';
break;
default:
placeholderText = ''; // Default placeholder if needed
}
$('#blackdata').attr('placeholder', placeholderText);
});
// Trigger change event on page load to set the initial placeholder
$('#blacktype').trigger('change');
});
</script>
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_blacklists"
class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Selection</th>
<th class="px-6 py-3">Blacklist Data</th>
<th class="px-6 py-3">Blacklist Type</th>
<th class="px-6 py-3">Actions</th>
</tr>
</thead>
</table>
</div>
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>

631
app/pages/chats.php Normal file
View File

@@ -0,0 +1,631 @@
<?php
if ($_SESSION['role'] == "Reseller") {
header("location: ./?page=reseller-licenses");
die();
}
if ($role == "Manager" && !($permissions & 8)) {
misc\auditLog\send("Attempted (and failed) to view chats.");
dashboard\primary\error("You weren't granted permission to view this page!");
die();
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
if (isset($_POST['deletemsg'])) {
$resp = misc\chat\deleteMessage($_POST['deletemsg']);
match($resp){
'failure' => dashboard\primary\error("Failed to delete message!"),
'success' => dashboard\primary\success("Successfully deleted message!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['muteuser'])) {
$muted = misc\etc\sanitize($_POST['muted']);
$time = misc\etc\sanitize($_POST['time']);
$time = $time * $muted + time();
$resp = misc\chat\muteUser($_POST['user'], $time);
match($resp){
'missing' => dashboard\primary\error("User doesn't exist!"),
'failure' => dashboard\primary\error("Failed to mute user!"),
'success' => dashboard\primary\success("Successfully muted user!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['unmuteuser'])) {
$resp = misc\chat\unMuteUser($_POST['user']);
match($resp){
'failure' => dashboard\primary\error("Failed to unmute user!"),
'success' => dashboard\primary\success("Successfully unmuted user!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['clearchannel'])) {
$resp = misc\chat\clearChannel($_POST['channel']);
match($resp){
'failure' => dashboard\primary\error("Failed to clear channel!"),
'success' => dashboard\primary\success("Successfully cleared channel!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['deleteallchatchannels'])){
$resp = misc\chat\deleteAllChannels();
match($resp){
'failure' => dashboard\primary\error("Failed to delete all chat channels!"),
'success' => dashboard\primary\success("Successfully deleted all chat channels!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['editchan'])) {
$chan = misc\etc\sanitize($_POST['editchan']);
$query = misc\mysql\query("SELECT * FROM `chats` WHERE `name` = ? AND `app` = ?", [$chan, $_SESSION['app']]);
if ($query->num_rows < 1) {
dashboard\primary\error("Channel not found!");
echo "<meta http-equiv='Refresh' Content='2'>";
return;
}
?>
<!-- Edit Chat Channel Modal -->
<div id="edit-chat-channel-modal" tabindex="-1" aria-hidden="true"
class="fixed grid place-items-center h-screen bg-black bg-opacity-60 z-50 p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Edit Chat Channel</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<select id="unit" name="unit"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="1">Seconds</option>
<option value="60">Minutes</option>
<option value="3600">Hours</option>
<option value="86400">Days</option>
<option value="604800">Weeks</option>
<option value="2629743">Months</option>
<option value="31556926">Years</option>
<option value="315569260">Lifetime</option>
</select>
<label for="unit"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Chat
Cooldown Unit</label>
</div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" id="delay" name="delay"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on">
<label for="delay"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Cooldown
Time * By Unit</label>
</div>
</div>
<button name="savechan" value="<?= $chan; ?>"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Save
Changes</button>
<button onClick="window.location.href=window.location.href"
class="w-full text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Edit Chat Channel Modal -->
<?php
}
if (isset($_POST['savechan'])) {
$chan = misc\etc\sanitize($_POST['savechan']);
$unit = misc\etc\sanitize($_POST['unit']);
$delay = misc\etc\sanitize($_POST['delay']);
$delay = $delay * $unit;
$query = misc\mysql\query("UPDATE `chats` SET `delay` = ? WHERE `app` = ? AND `name` = ?", [$delay, $_SESSION['app'], $chan]);
if ($query->affected_rows > 0) { // check query impacted something, else show error
dashboard\primary\success("Successfully updated channel!");
} else {
dashboard\primary\error("Failed To update channel!");
}
}
if (isset($_POST['deletechan'])) {
$resp = misc\chat\deleteChannel($_POST['deletechan']);
match($resp){
'failure' => dashboard\primary\error("Failed to delete channel!"),
'success' => dashboard\primary\success("Successfully deleted channel!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['addchannel'])) {
if ($_SESSION['role'] != "seller") {
dashboard\primary\error("You must upgrade to seller to create chat channels");
} else {
$unit = misc\etc\sanitize($_POST['unit']);
$delay = misc\etc\sanitize($_POST['delay']);
$delay = $delay * $unit;
$resp = misc\chat\createChannel($_POST['name'], $delay);
match($resp){
'failure' => dashboard\primary\error("Failed to create channel!"),
'success' => dashboard\primary\success("Successfully created channel!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">Chats</h1>
<p class="text-xs text-gray-500">Allow your users to chat with each other. <a
href="https://keyauthdocs.apidog.io/api/features/chatroom/messages/send-messages" target="_blank"
class="text-blue-600 hover:underline">Learn More</a>.
</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Chat Functions -->
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="create-chat-channel-modal" data-modal-target="create-chat-channel-modal">
<i class="lni lni-circle-plus mr-2 mt-1"></i>Create Chat Channel
</button>
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="unmute-user-modal" data-modal-target="unmute-user-modal">
<i class="lni lni-volume-mute mr-2 mt-1"></i>Unmute User
</button>
<!-- End Chat Functions -->
<br>
<!-- Delete Chat Functions -->
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="clear-chat-channel-modal" data-modal-target="clear-chat-channel-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Clear Chat Channel
</button>
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-chat-channels-modal" data-modal-target="delete-all-chat-channels-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Chat Channels
</button>
<!-- Create Chat Channel Modal -->
<div id="create-chat-channel-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Create Chat Channel</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="name" name="name"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on">
<label for="name"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Chat
Channel Name</label>
</div>
<div class="relative mb-4">
<select id="unit" name="unit"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="1">Seconds</option>
<option value="60">Minutes</option>
<option value="3600">Hours</option>
<option value="86400">Days</option>
<option value="604800">Weeks</option>
<option value="2629743">Months</option>
<option value="31556926">Years</option>
<option value="315569260">Lifetime</option>
</select>
<label for="unit"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Chat
Cooldown Unit</label>
</div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" id="delay" name="delay"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on">
<label for="delay"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Cooldown
Time * By Unit</label>
</div>
</div>
<button name="addchannel"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Create
Chat Cannel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Create Chat Channel Modal -->
<!-- Clear Chat Channel Modal -->
<div id="clear-chat-channel-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<svg class="flex-shrink-0 inline w-4 h-4 mr-3" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to clear a chat
channel. This will delete all messages in this channel. This can not be
undone!
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to clear
the chat channel? This can not be undone.</h3>
<div class="relative mb-4">
<select type="text" id="channel" name="channel"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<?php
$query = misc\mysql\query("SELECT * FROM `chats` WHERE `app` = ?", [$_SESSION['app']]);
$rows = array();
while ($r = mysqli_fetch_assoc($query->result)) {
$rows[] = $r;
}
foreach ($rows as $row) {
?>
<option value="<?= $row["name"]; ?>"><?= $row["name"]; ?></option>
<?php
} ?>
</select>
<label for="channel"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Select
Channel</label>
</div>
<form method="POST">
<button data-modal-hide="clear-chat-channel-modal" name="clearchannel"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="clear-chat-channel-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- Unmute User Modal -->
<!-- Unmute User Channel Modal -->
<div id="unmute-user-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<form method="POST">
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to
unmute
this user?</h3>
<div class="relative mb-4">
<select type="text" id="user" name="user"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<?php
$query = misc\mysql\query("SELECT * FROM `chatmutes` WHERE `app` = ?", [$_SESSION['app']]);
$rows = array();
while ($r = mysqli_fetch_assoc($query->result)) {
$rows[] = $r;
}
foreach ($rows as $row) {
?>
<option value="<?= $row["user"]; ?>"><?= $row["user"]; ?></option>
<?php
} ?>
</select>
<label for="user"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Select
User To Unmute</label>
</div>
<button data-modal-hide="unmute-user-modal" name="unmuteuser"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="unmute-user-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Unmute User Modal -->
<!-- Delete All Chat Channels Modal -->
<div id="delete-all-chat-channels-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<svg class="flex-shrink-0 inline w-4 h-4 mr-3" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to delete all of your
chat channels. This can not be undone!
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
all of your chat channels?</h3>
<form method="POST">
<button data-modal-hide="delete-all-chat-channels-modal"
name="deleteallchatchannels"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-chat-channels-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Chat Channels Modal -->
<!-- Mute User Modal -->
<div id="mute-user-modal" tabindex="-1" aria-hidden="true"
class="fixed grid place-items-center hidden h-screen bg-black bg-opacity-60 z-50 p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Mute User</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<select id="muted" name="muted"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="1">Seconds</option>
<option value="60">Minutes</option>
<option value="3600">Hours</option>
<option value="86400">Days</option>
<option value="604800">Weeks</option>
<option value="2629743">Months</option>
<option value="31556926">Years</option>
<option value="315569260">Lifetime</option>
</select>
<label for="muted"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Mute
Unit</label>
<input type="hidden" class="muteuser" name="user">
</div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" id="time" name="time"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on">
<label for="time"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Mute
Duration:</label>
</div>
</div>
<button name="muteuser"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Mute
User</button>
<button type="button" onclick="closeModal('mute-user-modal')"
class="w-full text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Mute User Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_chats" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Chat Name</th>
<th class="px-6 py-3">Message Delay</th>
<th class="px-6 py-3">Actions</th>
</tr>
</thead>
<tbody>
<?php
if ($_SESSION['app']) {
$query = misc\mysql\query("SELECT * FROM `chats` WHERE `app` = ?", [$_SESSION['app']]);
$rows = array();
while ($r = mysqli_fetch_assoc($query->result)) {
$rows[] = $r;
}
foreach ($rows as $row) {
$chan = $row['name'];
?>
<tr>
<td><?= $chan; ?></td>
<td><?= dashboard\primary\time2str(time() - $row["delay"]); ?></td>
<form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true"
class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4"
type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20" style="margin-top:3px">
<path
d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" />
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false"
class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1"
style="min-width:15rem">
<li>
<button name="deletechan"
class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="<?= $chan; ?>">
Delete Channel
</button>
</li>
<li>
<button name="editchan"
class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
value="<?= $chan; ?>">
Edit Channel
</button>
</li>
</ul>
</div>
</td>
</tr>
</form>
<?php
}
}
?>
</tbody>
</table>
</div>
<!-- END CHAT TABLE -->
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>
<br>
<!-- START MESSAGES TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_messages" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Author</th>
<th class="px-6 py-3">Message</th>
<th class="px-6 py-3">Time Sent</th>
<th class="px-6 py-3">Channel</th>
<th class="px-6 py-3">Actions</th>
</tr>
</thead>
<tbody>
<?php
if ($_SESSION['app']) {
$query = misc\mysql\query("SELECT * FROM `chatmsgs` WHERE `app` = ?", [$_SESSION['app']]);
$rows = array();
while ($r = mysqli_fetch_assoc($query->result)) {
$rows[] = $r;
}
foreach ($rows as $row) {
$user = $row['author'];
?>
<tr>
<td><?= $user; ?></td>
<td><?= $row["message"]; ?></td>
<td>
<script>
document.write(convertTimestamp(<?= $row["timestamp"]; ?>));
</script>
</td>
<td><?= $row["channel"]; ?></td>
<form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true"
class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4"
type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20" style="margin-top:3px">
<path
d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" />
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false"
class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1"
style="min-width:15rem">
<li>
<button name="deletemsg"
class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="<?= $row["id"]; ?>">
Delete Message
</button>
</li>
<li>
<button type="button"
class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
onclick="muteuser('<?= $user; ?>')">
Mute User
</button>
</li>
</ul>
</div>
</td>
</tr>
</form>
<?php
}
}
?>
</tbody>
</table>
</div>
<!-- END MESSAGES TABLE -->
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>
<script>
function muteuser(key) {
var muteuser = $('.muteuser');
muteuser.attr('value', key);
openModal('mute-user-modal');
}
</script>

474
app/pages/files.php Normal file
View File

@@ -0,0 +1,474 @@
<?php
if ($_SESSION['role'] == "Reseller") {
header("location: ./?page=reseller-licenses");
die();
}
if ($role == "Manager" && !($permissions & 64)) {
misc\auditLog\send("Attempted (and failed) to view files.");
dashboard\primary\error("You weren't granted permission to view this page.");
die();
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
if (isset($_POST['addfile'])) {
$authed = misc\etc\sanitize($_POST['authed']) == NULL ? 0 : 1;
$resp = misc\upload\add($_POST['url'], $authed);
match($resp){
'invalid' => dashboard\primary\error("URL not valid!"),
'no_local' => dashboard\primary\error("URL can't be a local path! Must be a remote URL accessible by the open internet!"),
'failure' => dashboard\primary\error("Failed to add file!"),
'success' => dashboard\primary\success("Successfully added file!"),
'tester_file_exceed' => dashboard\primary\error("Tester plan may only upload files up to 10MB. Upgrade for larger file size!"),
'dev_file_exceed' => dashboard\primary\error("File size limit is 50MB. Please upgrade for larger file size!"),
'seller_file_exceed' => dashboard\primary\error("File size limit is 75MB. This is the MAX"),
'name_too_large' => dashboard\primary\error("File name is too large. Rename it to something shorter"),
'invalid_extension' => dashboard\primary\error("No HTML files. You must get the DIRECT URL which downloads INSTANTLY. No download page, direct file."),
'bad_response' => dashboard\primary\error("File either not found or URL not allowed by the file host!"),
'discord_cdn' => dashboard\primary\error("Discord's developers made files expire after 24 hours, use catbox.moe or pages.dev instead!"),
'github_no_raw' => dashboard\primary\error("Click the \"Raw\" button on GitHub file. Only use raw.githubusercontent.com URLs"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['delfiles'])) {
$resp = misc\upload\deleteAll();
match($resp){
'failure' => dashboard\primary\error("Failed to delete all files!"),
'success' => dashboard\primary\success("Successfully deleted all files!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['deletefile'])) {
$resp = misc\upload\deleteSingular($_POST['deletefile']);
match($resp){
'failure' => dashboard\primary\error("Failed to delete all files!"),
'success' => dashboard\primary\success("Successfully deleted all files!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['editfile'])) {
$file = misc\etc\sanitize($_POST['editfile']);
$result = misc\mysql\query("SELECT `url` FROM `files` WHERE `id` = ? AND `app` = ?", [$file, $_SESSION['app']]);
$fileUrl = mysqli_fetch_array($result->result);
echo '
<div id="edit-file-modal" tabindex="-1" aria-hidden="true"
class="fixed grid place-items-center h-screen bg-black bg-opacity-60 z-50 p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Edit File</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="url" name="url"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="' . $fileUrl['url']. '"required>
<label for="url"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">File URL:</label>
</div>
</div>
<div class="flex items-center mb-4">
<input id="authed" name="authed" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
checked>
<label for="authed"
class="ml-2 text-sm font-medium text-white-900">Authenticated</label>
</div>
<button name="savefile"
value="' . $file . '"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Save
Changes</button>
<button
class="w-full text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center" onClick="window.location.href=window.location.href">Cancel
</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Edit Files Modal -->';
}
if (isset($_POST['savefile'])) {
$fileid = misc\etc\sanitize($_POST['savefile']);
$url = misc\etc\sanitize($_POST['url']);
if (!filter_var($url, FILTER_VALIDATE_URL)) {
dashboard\primary\error("Invalid Url!");
echo "<meta http-equiv='Refresh' Content='2;'>";
return;
}
if (str_contains($url, "discord")) {
dashboard\primary\error("Discord's developers made files expire after 24 hours, use catbox.moe or pages.dev instead!");
echo "<meta http-equiv='Refresh' Content='2;'>";
return;
}
if (str_contains($url, "github.com")) {
dashboard\primary\error("Click the \"Raw\" button on GitHub file. Only use raw.githubusercontent.com URLs");
echo "<meta http-equiv='Refresh' Content='2;'>";
return;
}
if (str_contains($url, "localhost") || str_contains($url, "127.0.0.1") || str_contains($url, "file:/")) {
dashboard\primary\error("URL can't be a local path! Must be a remote URL accessible by the open internet");
echo "<meta http-equiv='Refresh' Content='2;'>";
return;
}
// Initialize cURL session
$ch = curl_init($url);
// Set options
curl_setopt($ch, CURLOPT_NOBODY, true); // Only fetch headers, no body
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the transfer as a string
curl_setopt($ch, CURLOPT_HEADER, true); // Include the header in the output
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla KeyAuth');
$response = curl_exec($ch);
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpStatusCode == 403 || $httpStatusCode == 404) {
dashboard\primary\error("File either not found or URL not allowed by the file host!");
echo "<meta http-equiv='Refresh' Content='2;'>";
return;
}
// Get content length
$filesize = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
$contType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
if(str_contains($contType, "html")) {
dashboard\primary\error("No HTML files. You must get the DIRECT URL which downloads INSTANTLY. No download page, direct file.");
echo "<meta http-equiv='Refresh' Content='2;'>";
return;
}
if ($filesize > 10000000 && $role == "tester") {
dashboard\primary\error("Users with tester plan may only upload files up to 10MB. Paid plans may upload up to 75MB.");
echo "<meta http-equiv='Refresh' Content='2;'>";
return;
} else if ($filesize > 50000000 && ($role == "developer" || $role == "Manager")) {
dashboard\primary\error("File size limit is 50 MB. Upgrade your account to gain a total of 75mb.");
echo "<meta http-equiv='Refresh' Content='2;'>";
return;
} else if ($filesize > 75000000) {
dashboard\primary\error("File size limit is 75 MB.");
echo "<meta http-equiv='Refresh' Content='2;'>";
return;
}
$fn = basename(parse_url($url, PHP_URL_PATH));
$fs = misc\etc\formatBytes($filesize);
if(strlen($fn) > 49) {
dashboard\primary\error("File name is too large! Rename it to have a shorter name.");
echo "<meta http-equiv='Refresh' Content='2;'>";
return;
}
$authed = misc\etc\sanitize($_POST['authed']) == NULL ? 0 : 1;
$query = misc\mysql\query("UPDATE `files` SET `name` = ?,`size` = ?,`url` = ?, `uploaddate` = ?, `authed` = ? WHERE `app` = ? AND `id` = ?", [$fn, $fs, $url, time(), $authed, $_SESSION['app'], $fileid]);
if ($query->affected_rows != 0) {
misc\cache\purge('KeyAuthFile:' . ($secret ?? $_SESSION['app']) . ':' . $fileid);
dashboard\primary\success("Successfully Updated File!");
} else {
dashboard\primary\error("Failed to update file");
}
}
if (isset($_POST["selected"]) && isset($_POST["action"])) {
$selected = json_decode($_POST['selected'], true);
if ($_POST["action"] == "delete") {
foreach ($selected as $value) {
$resp = misc\upload\deleteSingular($value);
match($resp){
'failure' => dashboard\primary\error("Failed to delete file!"),
'success' => dashboard\primary\success("Successfully deleted file!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
}
else if ($_POST["action"] == "authEnable") {
foreach ($selected as $value) {
$query = misc\mysql\query("UPDATE `files` SET `authed` = 1 WHERE `app` = ? AND `id` = ?", [$_SESSION['app'], $value]);
if ($query->affected_rows != 0) {
misc\cache\purge('KeyAuthFile:' . ($secret ?? $_SESSION['app']) . ':' . $fileid);
dashboard\primary\success("Successfully updated files!");
} else {
dashboard\primary\error("Failed to update files");
}
}
}
else if ($_POST["action"] == "authDisable") {
foreach ($selected as $value) {
$query = misc\mysql\query("UPDATE `files` SET `authed` = 0 WHERE `app` = ? AND `id` = ?", [$_SESSION['app'], $value]);
if ($query->affected_rows != 0) {
misc\cache\purge('KeyAuthFile:' . ($secret ?? $_SESSION['app']) . ':' . $fileid);
dashboard\primary\success("Successfully updated files!");
} else {
dashboard\primary\error("Failed to update files");
}
}
}
else {
dashboard\primary\error("Invalid action");
}
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl ">Files</h1>
<p class="text-xs text-gray-500">Let your users download files you upload here. <a
href="https://keyauthdocs.apidog.io/api/features/download-file" target="_blank"
class="text-blue-600 hover:underline">Learn More</a>.</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Alert Box -->
<div id="alert" class="flex items-center p-4 mb-4 text-yellow-800 rounded-lg bg-[#09090d]"
role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<span class="sr-only">Info</span>
<div class="ml-3 text-sm font-medium text-yellow-500">
Please <a
href="https://www.iorad.com/player/2327871/KeyAuth-upload-files-tutorial" target="_blank"
class="font-semibold underline hover:no-underline">follow this guide</a> to upload files. FREE & super easy!
</div>
</div>
<!-- End Alert Box -->
<!-- Files Functions -->
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="create-file-modal" data-modal-target="create-file-modal">
<i class="lni lni-upload mr-2 mt-1"></i>Upload File
</button>
<!-- End Files Functions -->
<br>
<!-- Delete Files Functions -->
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-files-modal" data-modal-target="delete-all-files-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Files
</button>
<button
id="dropdownselection" data-dropdown-toggle="filedropdown"
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200 hidden"
type="button">
Selection Options
</button>
<div id="filedropdown" class="z-10 hidden bg-[#09090d] divide-y divide-gray-100 rounded-lg shadow w-44">
<ul class="py-2 text-sm text-white">
<li>
<form method="post">
<input type="hidden" name="action" value="delete">
<input type="hidden" id="selected" name="selected">
<a href="#" onclick="this.parentNode.submit();" class="block px-4 py-2 focus:bold ml-2 hover:text-red-700">Delete selected</a>
</form>
</li>
<li>
<form method="post">
<input type="hidden" name="action" value="authEnable">
<input type="hidden" id="selected" name="selected">
<a href="#" onclick="this.parentNode.submit();" class="block px-4 py-2 focus:bold ml-2 hover:text-red-700">Turn on authenticated</a>
</form>
</li>
<li>
<form method="post">
<input type="hidden" name="action" value="authDisable">
<input type="hidden" id="selected" name="selected">
<a href="#" onclick="this.parentNode.submit();" class="block px-4 py-2 focus:bold ml-2 hover:text-red-700">Turn off authenticated</a>
</form>
</li>
</ul>
</div>
<!-- End Delete Files Functions -->
<!-- Create New File Modal -->
<div id="create-file-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-blue-700 shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Upload A New File</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<div id="alert" class="flex items-center p-4 mb-4 text-yellow-800 rounded-lg bg-[#09090d]" role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"></path>
</svg>
<span class="sr-only">Info</span>
<div class="ml-3 text-sm font-medium text-yellow-500">
Please <a href="https://www.iorad.com/player/2327871/KeyAuth-upload-files-tutorial" target="_blank" class="font-semibold underline hover:no-underline">follow this guide</a> to upload files. FREE &amp; super easy!
</div>
</div>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="url" name="url"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<label for="url"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">File
Direct Download Link</label>
</div>
<div class="flex items-center">
<input checked id="authed" type="checkbox" name="authed"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2 ">
<label for="authed"
class="ml-2 text-sm font-medium text-white-900 ">Authenticated</label>
</div>
</div>
<button type="submit" name="addfile"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Add
File</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Create A File Modal -->
<!-- Delete All Files Modal -->
<div id="delete-all-files-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to delete all of your
file!. <b>This can
NOT be undone</b>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure
you want
to
delete all of your files?</h3>
<form method="POST">
<button name="delfiles"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-files-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Files Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_files" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Select</th>
<th class="px-6 py-3">Filename</th>
<th class="px-6 py-3">ID</th>
<th class="px-6 py-3">Size</th>
<th class="px-6 py-3">Upload Date</th>
<th class="px-6 py-3">Authenticated</th>
<th class="px-6 py-3">Actions</th>
</tr>
</thead>
<tbody>
<?php
if ($_SESSION['app']){
$query = misc\mysql\query("SELECT * FROM `files` WHERE `app` = ?", [$_SESSION['app']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)){
echo "<tr>";
echo '<td> <input type="checkbox" style="outline:none;"class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 checkbox" value="' . $row["id"] .'">' . '</td>';
echo " <td>" . $row["name"] . "</td>";
echo " <td>" . $row["id"] . "</td>";
echo " <td>" . $row["size"] . "</td>";
echo " <td><script>document.write(convertTimestamp(" . $row["uploaddate"] . "));</script></td>";
echo "<td><span class='border " . ($row["authed"] ? 'border-green-700 text-green-700' : 'border-red-700 text-red-700') . " text-xs font-medium mr-2 px-2.5 py-0.5 rounded'>" . ($row["authed"] ? 'True' : 'False') . "</span></td>";
echo '<form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true" class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4" type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" style="margin-top:3px">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false" class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1" style="min-width:15rem">
<li>
<button name="deletefile" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row["id"] . '">
Delete File
</button>
</li>
<li>
<a href="' . $row['url'] . '" target="_blank" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . urlencode($row["username"]) . '">
Download File
</a>
</li>
<li>
<button name="editfile" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
value="' . $row["id"] . '">
Edit File
</button>
</li>
</ul>
</div>
</td>
</tr>
</form>
';
}
}
}
?>
</tbody>
</table>
</div>
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a
class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>
<!-- Include the jQuery library -->

641
app/pages/forms.php Normal file
View File

@@ -0,0 +1,641 @@
<?php
if ($formBanned){
dashboard\primary\error("You were banned from submitting forms.");
die();
}
include 'application-functions.php';
if (isset($_POST['submitStaffApplication'])){
if (isset($_POST['appliedBefore'])) {
$appliedBeforeValue = "Yes";
} else {
$appliedBeforeValue = "No";
}
if (isset($_POST['previousStaff'])) {
$previousStaffValue = "Yes";
} else {
$previousStaffValue = "No";
}
if (isset($_POST['ticketAssist'])) {
$ticketAssistValue = "Yes";
} else {
$ticketAssistValue = "No";
}
$color = 345342;
$message =
"\n **KeyAuth Username:** \n" . $_SESSION['username'] .
"\n\n **Telegram, or Email:** \n" . $_POST['staffContactName'] .
"\n\n **Member Duration:** \n" . $_POST['memberDuration'] .
"\n\n **Timezone:** \n" . $_POST['timezone'] .
"\n\n **Programming Languages:** \n" . $_POST['programLang'] .
"\n\n **Join Reason:** \n" . $_POST['joinReason'] .
"\n\n **Additional Info:** \n" . $_POST['additionalInfo'] .
"\n\n **Applied Before?:** \n" . $appliedBeforeValue .
"\n\n **Previous Staff?:** \n" . $previousStaffValue .
"\n\n **Ticket Assistance?:** \n" . $ticketAssistValue .
"\n\n ** --- MAKE SURE YOUR REACT IF YOU ACCEPT/DENY SOMEONE AND GIVE A REASON! --- **";
sendStaffApplication($color, $_SESSION['username'], $message);
}
if (isset($_POST['submitSuggestion'])){
$suggestionTag = isset($_POST['suggestionType']) ? $_POST['suggestionType'] : '';
match($suggestionTag){
"Website" => $suggestionTag = "Website",
"Telegram Bot" => $suggestionTag = "Telegram Bot",
"Discord Bot" => $suggestionTag = "Discord Bot",
"Documentation" => $suggestionTag = "Documentation",
"Examples" => $suggestionTag = "Examples",
"Telegram Server" => $suggestionTag = "Telegram Server",
"API" => $suggestionTag = "API",
"Seller API" => $suggestionTag = "Seller API",
default => $suggestionTag = "Unhandled Error!"
};
MakeSuggestion($_POST['suggestionDescription'], "Videos/Images \n" . $_POST['suggestionLinks'] . "\n\nContact Information: \n" . $_POST['suggestionContactName'], $suggestionTag);
}
if (isset($_POST['reportBug'])){
$bugTag = isset($_POST['bugType']) ? $_POST['bugType'] : '';
match($bugTag){
"Website" => $bugTag = "Website",
"Telegram Bot" => $bugTag = "Telegram Bot",
"Discord Bot" => $bugTag = "Discord Bot",
"Documentation" => $bugTag = "Documentation",
"Examples" => $bugTag = "Examples",
"API" => $bugTag = "API",
"Seller API" => $bugTag = "Seller API",
default => $bugTag = "Unhandled Error!"
};
ReportBug($_POST['bugDescription'], "Videos/Images \n" . $_POST['bugLinks'] . "\n\nContact Information: \n" . $_POST['bugContactName'], $bugTag);
}
if (isset($_POST['submitReport'])){
if (!isset($_POST['reportHonesty'])){
dashboard\primary\error("You must be honest on your report!");
}
if (!isset($_POST['reportUnderstanding'])){
dashboard\primary\error("You must fully understand you being banned if you fail to be truthful to submit your report!");
}
$color = 880808;
$message =
"\n **KeyAuth Username:** \n" . $_SESSION['username'] .
"\n\n **Contact Method:** \n" . $_POST['reportcontactName'] .
"\n\n **Staff or Member:** \n" . $_POST['reportType'] .
"\n\n **Report Reason:** \n" . $_POST['reportReason'] .
"\n\n **Users (Reported) Contact:** \n" . $_POST['usersContact'];
sendReport($color, $_SESSION['username'], $message);
}
if (isset($_POST['fileDmca'])){
if (!isset($_POST["dmcaHonesty"])){
dashboard\primary\error("You must be honest on your report!");
}
if (!isset($_POST["dmcaalerted"])){
dashboard\primary\error("You must attempt to reach out to the user before submitting a DMCA request!");
}
if (isset($_POST['reachoutFailure'])) {
$reachoutFailureValue = "Yes";
} else {
$reachoutFailureValue = "No";
}
$color = 880808;
$message =
"\n **KeyAuth Username:** \n" . $_SESSION['username'] .
"\n\n **Contact Method:** \n" . $_POST['dmcaContactName'] .
"\n\n **DMCA Type:** \n" . $_POST['dmcaType'] .
"\n\n **Report Reason:** \n" . $_POST['dmcaDescription'] .
"\n\n **Proof:** \n" . $_POST['dmcaProof'] .
"\n\n **User failed to respond to reach out?** \n" . $reachoutFailureValue;
submitDMCA($color, $_SESSION['username'], $message);
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">Forms</h1>
<p class="text-xs text-gray-500">Just about any form you need.</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Alert Box -->
<div id="alert-4" class="flex items-center p-4 mb-1 text-red-600 rounded-lg bg-[#09090d]"
role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<span class="sr-only">Info</span>
<div class="ml-3 text-sm font-medium">
Lying, spamming, or abusing any of these forms will result in you being banned from
submitting any form.
</div>
</div>
<!-- End Alert Box -->
<div class="mt-3 gap-1.5 grid grid-cols-1 sm:grid-cols-2 md:block md:grid-cols-0">
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 transition duration-200"
id="staffButton">
<i class="lni lni-pencil-alt mr-2 mt-1"></i>
Apply For Staff
</button>
<button
class="inline-flex text-white bg-purple-500 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 transition duration-200"
id="suggestionButton">
<i class="lni lni-bulb mr-2 mt-1"></i>
Make A Suggestion
</button>
<button
class="inline-flex text-white bg-orange-500 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 transition duration-200"
id="bugButton">
<i class="lni lni-bug mr-2 mt-1"></i>
Report A Bug
</button>
<a href="?page=bug-bounty"
class="inline-flex text-white bg-green-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 transition duration-200">
<i class="lni lni-warning mr-2 mt-1"></i>
Report A Vulnerability
</a>
<button
class="inline-flex text-white bg-cyan-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 transition duration-200"
id="fileReportButton">
<i class="lni lni-folder mr-2 mt-1"></i>
File A Report
</button>
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 transition duration-200"
id="dmcaButton">
<i class="lni lni-trash-can mr-2 mt-1"></i>
DMCA
</button>
</div>
</div>
</div>
</div>
<div class="bg-[#09090d] block sm:flex items-center justify-between lg:mt-5">
<div class="mb-1 w-full bg-[#0f0f17] mt-4 md:mt-2 rounded-xl">
<div class="mb-4 p-4">
<div id="sect1" class="hidden">
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">Apply For Staff</h1>
<p class="text-xs text-gray-500">Join our team! As a member of staff, you will be able to assist
the community with any issues they are having, receive the seller subscription for free, and
get $10 off of Enterprise.</p>
<form method="POST">
<div class="relative mb-4 mt-5">
<input type="text" id="staffContactName" name="staffContactName"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="staffContactName"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Telegram Link,
or Email</label>
</div>
<div class="relative mb-4 ">
<select id="memberDuration" name="memberDuration"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="Less than 1 week" selected>Less than 1 week</option>
<option value="More than 1 month">More than 1 month</option>
<option value="More than 3 months">More than 3 months</option>
<option value="More than 6 months">More than 6 months</option>
<option value="More than 9 months">More than 9 months</option>
<option value="More than 1 year">More than 1 year</option>
</select>
<label for="memberDuration"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">How
long have you been a KeyAuth member?</label>
</div>
<div class="relative mb-4">
<input type="text" id="timezone" name="timezone"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="timezone"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">What
is your timezone?</label>
</div>
<div class="relative mb-4">
<input type="text" id="programLang" name="programLang"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="programLang"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">What programming
languages do you know? (must be experienced in them for more than 6 months to be considered known)</label>
</div>
<div class="relative mb-4">
<input type="text" id="joinReason" name="joinReason"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="joinReason"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Why
do you want to join staff?</label>
</div>
<div class="relative mb-4">
<input type="text" id="additionalInfo" name="additionalInfo"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="">
<label for="additionalInfo"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Additional
Info?</label>
</div>
<input checked id="appliedBefore" name="appliedBefore" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="appliedBefore" class="ml-1 text-sm font-medium text-white-900">I have applied
before</label>
<input checked id="previousStaff" name="previousStaff" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="previousStaff" class="ml-1 text-sm font-medium text-white-900">I am a previous
staff member</label>
<input checked id="ticketAssist" name="ticketAssist" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="ticketAssist" class="ml-1 text-sm font-medium text-white-900">I understand I must assist with Web</label>
<div class="flex justify-end">
<button type="submit"
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 transition duration-200"
name="submitStaffApplication">
<i class="lni lni-arrow-right mr-2 mt-1"></i>
Submit Staff Application
</button>
</div>
</form>
</div>
<div id="sect2" class="hidden">
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">Make A Suggestion</h1>
<p class="text-xs text-gray-500">Have a suggestion? Feel free to let us know!</p>
<br>
<!-- Alert Box -->
<div id="alert-4" class="flex items-center p-4 mb-4 text-yellow-800 rounded-lg bg-[#09090d]"
role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<span class="sr-only">Info</span>
<div class="ml-3 text-sm font-medium text-yellow-500">
This is for new feature requests.
NOT anything else.
If you need account support, please use the <b><u>Chat with us</u></b>
on the right-hand side of your screen.
</div>
</div>
<!-- End Alert Box -->
<form method="POST">
<div class="relative mb-4 mt-5">
<input type="text" id="suggestionContactName" name="suggestionContactName"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="suggestionContactName"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Telegram Link,
or Email</label>
</div>
<div class="relative mb-4 ">
<select id="suggestionType" name="suggestionType"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="Website" selected>Website</option>
<option value="Telegram Bot">Telegram Bot</option>
<option value="Discord Bot">Discord Bot</option>
<option value="Documentation">Documentation</option>
<option value="Examples">Examples</option>
<option value="Telegram Server">Telegram Server</option>
<option value="API">API</option>
<option value="Seller API">Seller API</option>
</select>
<label for="suggestionType"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">What
are you making a suggestion for?</label>
</div>
<div class="relative mb-4">
<input type="text" id="suggestionDescription" name="suggestionDescription"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="suggestionDescription"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Describe
the suggestion</label>
</div>
<div class="relative mb-4">
<input type="text" id="suggestionLinks" name="suggestionLinks"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="">
<label for="suggestionLinks"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Provide
links to images/videos (optional)</label>
</div>
<input checked id="firstSuggestion" name="firstSuggestion" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="firstSuggestion" class="ml-1 text-sm font-medium text-white-900">This is my
first
time
making this suggestion</label>
<input checked id="existingSuggestion" name="existingSuggestion" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="existingSuggestion" class="ml-1 text-sm font-medium text-white-900">This
suggestion
does
NOT exist yet</label>
<div class="flex justify-end">
<button type="submit"
class="inline-flex text-white bg-purple-500 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 transition duration-200"
name="submitSuggestion">
<i class="lni lni-arrow-right mr-2 mt-1"></i>
Submit Suggestion
</button>
</div>
</form>
</div>
<div id="sect3" class="hidden">
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">Report A Bug</h1>
<p class="text-xs text-gray-500">Found a bug? Report it so that we can fix it ASAP!</p>
<br>
<!-- Alert Box -->
<div id="alert-4" class="flex items-center p-4 mb-4 text-yellow-800 rounded-lg bg-[#09090d]"
role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<span class="sr-only">Info</span>
<div class="ml-3 text-sm font-medium text-yellow-500">
This is ONLY for issues found with DEFAULT settings and happens after testing many ways.
If you need account support, please use the <b><u>Chat with us</u></b>
on the right-hand side of your screen.
</div>
</div>
<!-- End Alert Box -->
<form method="POST">
<div class="relative mb-4 mt-5">
<input type="text" id="bugContactName" name="bugContactName"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="bugContactName"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Telegram Link,
or Email</label>
</div>
<div class="relative mb-4 ">
<select id="bugType" name="bugType"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="Website" selected>Website</option>
<option value="Telegram Bot">Telegram Bot</option>
<option value="Discord Bot">Discord Bot</option>
<option value="Documentation">Documentation</option>
<option value="Examples">Examples</option>
<option value="API">API</option>
<option value="Seller API">Seller API</option>
</select>
<label for="bugType"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">What
are you making a bug for?</label>
</div>
<div class="relative mb-4">
<input type="text" id="bugDescription" name="bugDescription"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="bugDescription"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Describe
the bug</label>
</div>
<div class="relative mb-4">
<input type="text" id="bugLinks" name="bugLinks"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="">
<label for="bugLinks"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Provide
links to images/videos (optional)</label>
</div>
<input checked id="firstBug" name="firstBug" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="firstBug" class="ml-1 text-sm font-medium text-white-900">This is my first time
making this bug report</label>
<div class="flex justify-end">
<button
class="inline-flex text-white bg-orange-500 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 transition duration-200"
name="reportBug">
<i class="lni lni-arrow-right mr-2 mt-1"></i>
Report Bug
</button>
</div>
</form>
</div>
<div id="sect4" class="hidden">
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">File A Report</h1>
<p class="text-xs text-gray-500">Need to report a staff member or a member of the community?
Feel free to do so here.</p>
<form method="POST">
<div class="relative mb-4 mt-5">
<input type="text" id="reportcontactName" name="reportcontactName"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="reportcontactName"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Telegram Link,
or Email</label>
</div>
<div class="relative mb-4 ">
<select id="reportType" name="reportType"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="A Community Member" selected>A Community Member</option>
<option value="A Staff Member">A Staff Member</option>
</select>
<label for="reportType"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Who
are you reporting?</label>
</div>
<div class="relative mb-4">
<input type="text" id="reportReason" name="reportReason"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="reportReason"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Reason
for the report?</label>
</div>
<div class="relative mb-4">
<input type="text" id="usersContact" name="usersContact"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="usersContact"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Provide
a way we can contact them.</label>
</div>
<input checked id="reportHonesty" name="reportHonesty" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="reportHonesty" class="ml-1 text-sm font-medium text-white-900">My report is 100%
honest!</label>
<input checked id="reportUnderstanding" name="reportUnderstanding" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="reportUnderstanding" class="ml-1 text-sm font-medium text-white-900">I
understand I
will be banned from submitting forms if I am caught lying on this form.</label>
<div class="flex justify-end">
<button type="submit"
class="inline-flex text-white bg-cyan-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 transition duration-200"
name="submitReport">
<i class="lni lni-arrow-right mr-2 mt-1"></i>
Submit Report
</button>
</div>
</form>
</div>
<div id="sect5" class="hidden">
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">File A DMCA Request</h1>
<p class="text-xs text-gray-500">Found someone breaking KeyAuth license/TOS or stealing your
content? Report it so we can review it.</p>
<form method="POST">
<div class="relative mb-4 mt-5">
<input type="text" id="dmcaContactName" name="dmcaContactName"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="dmcaContactName"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Telegram Link,
or Email</label>
</div>
<div class="relative mb-4 ">
<select id="dmcaType" name="dmcaType"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="KeyAuth Content" selected>KeyAuth Content</option>
<option value="My Content">My Content</option>
</select>
<label for="dmcaType"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">What
would you like to file a DMCA for?</label>
</div>
<div class="relative mb-4">
<input type="text" id="dmcaProof" name="dmcaProof"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="dmcaProof"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Provide
links to images/videos/sites.</label>
</div>
<div class="relative mb-4">
<input type="text" id="dmcaDescription" name="dmcaDescription"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="dmcaDescription"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Explain
the reason for the request</label>
</div>
<input checked id="dmcaHonesty" name="dmcaHonesty" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="dmcaHonesty" class="ml-1 text-sm font-medium text-white-900">All info on this
request is 100% honest</label>
<input checked id="dmcaalerted" name="dmcaalerted" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="dmcaalerted" class="ml-1 text-sm font-medium text-white-900">I have alerted the
user
to take it down already</label>
<input checked id="reachoutFailure" name="reachoutFailure" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="reachoutFailure" class="ml-1 text-sm font-medium text-white-900">The user
acknowledged my reach out, but failed to respond</label>
<div class="flex justify-end">
<button type="submit"
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 transition duration-200"
name="fileDmca">
<i class="lni lni-arrow-right mr-2 mt-1"></i>
File DMCA
</button>
</div>
</form>
</div>
<script>
// Function to show the corresponding section based on the button clicked
function showSection(sectionId) {
// Hide all sections
const sections = document.querySelectorAll('div[id^="sect"]');
sections.forEach(section => {
section.classList.add('hidden');
});
// Show the selected section
const selectedSection = document.getElementById(sectionId);
if (selectedSection) {
selectedSection.classList.remove('hidden');
}
}
// Add event listeners to the buttons
const staffButton = document.getElementById('staffButton');
const sectSuggestion = document.getElementById('suggestionButton');
const sectBug = document.getElementById('bugButton');
const sectReport = document.getElementById('fileReportButton');
const sectDmca = document.getElementById('dmcaButton');
staffButton.addEventListener('click', function() {
showSection('sect1');
});
suggestionButton.addEventListener('click', function() {
showSection('sect2');
});
bugButton.addEventListener('click', function() {
showSection('sect3');
});
sectReport.addEventListener('click', function() {
showSection('sect4');
});
dmcaButton.addEventListener('click', function() {
showSection('sect5');
});
</script>

974
app/pages/licenses.php Normal file
View File

@@ -0,0 +1,974 @@
<?php
if ($_SESSION['role'] == "Reseller") {
header("location: ./?page=reseller-licenses");
die();
}
if ($role == "Manager" && !($permissions & 1)) {
misc\auditLog\send("Attempted (and failed) to view licenses.");
dashboard\primary\error("You weren't granted permission to view this page!");
die();
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("You must select an app first.");
header("location: ./?page=manage-apps");
die();
}
if (isset($_POST['unbankey'])) {
$resp = misc\license\unban($_POST['unbankey']);
match ($resp) {
'failure' => 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 "<meta http-equiv='Refresh' Content='2'>";
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 "<meta http-equiv='Refresh' Content='2'>";
return;
}
$row = mysqli_fetch_array($query->result);
?>
<!-- Edit User Modal -->
<div id="edit-key-modal" tabindex="-1" aria-hidden="true"
class="fixed grid place-items-center h-screen bg-black bg-opacity-60 z-50 p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Edit License</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="level" name="level"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " value="<?= $row['level']; ?>" autocomplete="on">
<label for="level"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Level:</label>
</div>
<div class="relative mb-4">
<select id="expiry" name="expiry"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="1">Seconds</option>
<option value="60">Minutes</option>
<option value="3600">Hours</option>
<option value="86400">Days</option>
<option value="604800">Weeks</option>
<option value="2629743">Months</option>
<option value="31556926">Years</option>
<option value="315569260">Lifetime</option>
</select>
</div>
<div class="relative mb-4">
<input type="text" id="duration" name="duration"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" ">
<label for="duration"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Duration:</label>
</div>
<div class="relative mb-4">
<input type="text" id="editNote" name="editNote"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" ">
<label for="editNote"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">New
Note:</label>
</div>
</div>
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;">
<button name="savekey"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center"
value="<?= $key; ?>">Save Changes</button>
<button
class="w-full text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center"
onClick="window.location.href=window.location.href">Cancel</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- End Edit User Modal -->
<?php
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 lang class="text-xl font-semibold text-white-900 sm:text-2xl">Licenses</h1>
<p class="text-xs text-gray-500">Licenses allow your users to register on your application.</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<form method="POST">
<!-- Key Functions -->
<button type="button"
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="create-key-modal" data-modal-target="create-key-modal">
<i class="lni lni-circle-plus mr-2 mt-1"></i> Create Keys
</button>
<button type="button"
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="add-time-modal" data-modal-target="add-time-modal">
<i class="lni lni-timer mr-2 mt-1"></i>Add Time To Unused Keys
</button>
<?php
if ($role != "tester"){?>
<button type="button"
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="import-key-modal" data-modal-target="import-key-modal">
<i class="lni lni-upload mr-2 mt-1"></i>Import Keys
</button>
<?php } ?>
<button name="dlkeys"
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">
<i class="lni lni-download mr-2 mt-1"></i>Export Keys
</button>
</form>
<!-- End Key Functions -->
<!-- Delete Key Functions -->
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-keys-modal" data-modal-target="delete-all-keys-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Keys
</button>
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-used-keys-modal" data-modal-target="delete-all-used-keys-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Used Keys
</button>
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-unused-keys-modal"
data-modal-target="delete-all-unused-keys-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i></i>Delete All Unused Keys
</button>
<button id="dropdownselection" data-dropdown-toggle="licenseSelecteddropdown"
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200 hidden"
type="button"><i class="lni lni-trash-can mr-2 mt-1"></i>Selection Options
</button>
<div id="licenseSelecteddropdown" class="z-10 hidden bg-[#09090d] divide-y divide-gray-100 rounded-lg shadow w-44">
<ul class="py-2 text-sm text-white">
<li>
<form method="post">
<input type="hidden" name="action" value="delete">
<input type="hidden" id="selected" name="selected">
<a href="#" onclick="this.parentNode.submit();" class="block px-4 py-2 focus:bold ml-2 hover:text-red-700">Delete selected</a>
</form>
</li>
<li>
<form method="post">
<input type="hidden" name="action" value="banKeyMulti">
<input type="hidden" id="selected" name="selected">
<a href="#" onclick="this.parentNode.submit();" class="block px-4 py-2 focus:bold ml-2 hover:text-red-700">Ban selected</a>
</form>
</li>
</ul>
</div>
<!-- End Delete Key Functions -->
<?php
if (isset($_SESSION['keys_array'])) {
$list = $_SESSION['keys_array'];
$keys = NULL;
for ($i = 0; $i < count($list); $i++) {
$keys .= "" . $list[$i] . "<br>";
}
echo "<div class=\"card\"> <div class=\"card-body\" id=\"multi-keys\"> $keys </div> </div> <br>";
echo "<button onclick=\"copyToClipboard()\" class=\"inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200\">Copy new license(s)</button>";
unset($_SESSION['keys_array']);
}
?>
<!-- Create Key Modal -->
<div id="create-key-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<?php
$query = misc\mysql\query("SELECT `format`, `amount`, `lvl`, `note`, `user`, `duration`, `unit` FROM `apps` WHERE `secret` = ?", [$_SESSION['app']]);
$row = mysqli_fetch_array($query->result);
$format = $row['format'];
$amt = $row['amount'];
$lvl = $row['lvl'];
$note = $row['note'];
$user = $row['user'];
$dur = $row['duration'];
$unit = $row['unit'];
?>
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="text-xl font-medium text-white-900">Create A New Key</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" min="1" max="100" id="amount"
name="amount"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on"
value="<?php if (!is_null($amt)) { echo $amt; } ?>"
required data-popover-target="amount-popover">
<label for="amount"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">License
Amount</label>
<?php dashboard\primary\popover("amount-popover", "License Amount", "The amount of licenses you would like to create."); ?>
</div>
<!-- Alert Box -->
<div id="alert" class="flex items-center p-4 mb-4 text-yellow-800 rounded-lg bg-[#09090d]"
role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<span class="sr-only">Info</span>
<div class="ml-3 text-sm font-medium text-yellow-500">
Free user keys will say "<a
href="https://vaultcord.com/?utm_source=keyauth" target="_blank"
class="font-semibold underline hover:no-underline">VAULTCORD</a>" because of our partnership with the Free Discord backup bot. Backup all members & your entire Discord server!
</div>
</div>
<!-- End Alert Box -->
<div class="relative mb-4">
<input type="text" maxlength="49" id="mask" name="mask"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder="*****-*****-*****-*****" autocomplete="on"
value="<?php if (!is_null($format)) { echo $format; } else { echo "*****-*****-*****-*****-*****"; } ?>"
required data-popover-target="mask-popover">
<label for="mask"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">License
Mask</label>
<?php dashboard\primary\popover("mask-popover", "License Mask", "The format of the license. You can use * to generate random characters."); ?>
</div>
<div class="flex items-center justify-between mb-4">
<div class="flex items-center">
<input id="lowercaseLetters" name="lowercaseLetters" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
checked data-popover-target="lowercase-popover">
<label for="lowercaseLetters" class="ml-2 text-sm font-medium text-white-900">
Lowercase Letters</label>
<?php dashboard\primary\popover("lowercase-popover", "Lowercase Letters", "Include lowercase letters in your license."); ?>
</div>
<div class="flex items-center">
<input id="capitalLetters" name="capitalLetters" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
checked data-popover-target="capital-popover">
<label for="capitalLetters" class="ml-2 text-sm font-medium text-white-900">
Uppercase Letters</label>
<?php dashboard\primary\popover("capital-popover", "Capital Letters", "Include capital letters in your license."); ?>
</div>
</div>
<div class="relative mb-4 pt-2">
<select id="level" name="level"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"
data-popover-target="level-popover">
<?php
$query = misc\mysql\query("SELECT DISTINCT `level` FROM `subscriptions` WHERE `app` = ? ORDER BY `level` ASC", [$_SESSION['app']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)) {
$queryName = misc\mysql\query("SELECT `name` FROM `subscriptions` WHERE `level` = ? AND `app` = ?", [$row["level"], $_SESSION['app']]);
$name = " (";
$count = 0;
while ($rowSubs = mysqli_fetch_array($queryName->result)) {
$count++;
if ($count > 1) {
$name .= ", " . $rowSubs["name"];
} else {
$name .= $rowSubs["name"];
}
}
$name .= ")";
?>
<option <?= $lvl == $row["level"] ? 'selected="selected"' : ''; ?>
value="<?= $row["level"]; ?>">
<?= $row["level"] . $name; ?></option>
<?php
}
}
?>
</select>
<?php dashboard\primary\popover("level-popover", "License Level", "The level/subscription you would like to assign to your license(s)."); ?>
</div>
<div class="relative mb-4">
<input type="text" maxlength="69" id="note" name="note"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on"
value="<?php if (!is_null($note)) { } ?>"
data-popover-target="note-popover">
<label for="note"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">License
Note</label>
<?php dashboard\primary\popover("note-popover", "License Note", "A unique message for a license."); ?>
</div>
<div class="relative mb-4">
<input type="text" maxlength="69" id="user" name="user"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on"
value="<?php if (!is_null($user)) { } ?>"
required data-popover-target="user-popover">
<label for="user"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">License
User</label>
<?php dashboard\primary\popover("user-popover", "License User", "Function to Group license by user from shop."); ?>
</div>
<div class="relative mb-4">
<select id="expiry" name="expiry"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"
data-popover-target="expiry-popover">
<option value="1" <?= $unit == 1 ? 'selected="selected"' : ''; ?>>
Seconds
</option>
<option value="60" <?= $unit == 60 ? 'selected="selected"' : ''; ?>>
Minutes
</option>
<option value="3600"
<?= $unit == 3600 ? 'selected="selected"' : ''; ?>>
Hours
</option>
<option value="86400"
<?= $unit == 86400 ? 'selected="selected"' : ''; ?>>
Days
</option>
<option value="604800"
<?= $unit == 604800 ? 'selected="selected"' : ''; ?>>
Weeks
</option>
<option value="2629743"
<?= $unit == 2629743 ? 'selected="selected"' : ''; ?>>
Months
</option>
<option value="31556926"
<?= $unit == 31556926 ? 'selected="selected"' : ''; ?>>
Years
</option>
<option value="315569260"
<?= $unit == 315569260 ? 'selected="selected"' : ''; ?>>
Lifetime
</option>
</select>
<label for="expiry"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">License
Expiry Unit</label>
<?php dashboard\primary\popover("expiry-popover", "License Expiry (unit)", "The unit the license will expire in."); ?>
</div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" maxlength="4" id="duration"
name="duration"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" pattern="\d*"
value="<?php if (!is_null($dur)) { } ?>"
required data-popover-target="duration-popover">
<label for="duration"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">License
Duration</label>
<?php dashboard\primary\popover("duration-popover", "License Expiry (duration)", "The duration the license will expire in. (Unit * Duration = Expiry)"); ?>
</div>
</div>
<button type="submit" name="genkeys"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Generate
Keys</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Create Key Modal -->
<!-- Add Time To Key Modal -->
<div id="add-time-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Add Time To Unused Licenses</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4 ">
<select id="expiry" name="expiry"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="1" selected>Seconds</option>
<option value="60">Minutes</option>
<option value="3600">Hours</option>
<option value="86400">Days</option>
<option value="604800">Weeks</option>
<option value="2629743">Months</option>
<option value="31556926">Years</option>
<option value="315569260">Lifetime</option>
</select>
<label for="expiry"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Unit
of Time To Add</label>
</div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" min="1" id="time" name="time"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" placeholder="" required>
<label for="time"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Time
To Add</label>
</div>
</div>
<button name="addtime"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Add
Time</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Add Time To Key Modal -->
<!-- Import Keys Modal -->
<div id="import-key-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Import Licenses .json</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<form class="space-y-6" method="POST" enctype="multipart/form-data">
<div class="relative">
<input
class="block w-full text-sm text-gray-400 border border-gray-700 rounded-lg cursor-pointer focus:outline-none"
id="file_input" name="file_input" type="file">
</div>
<button type="submit" name="importkeysFile"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Import
Licenses</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Import Keys Modal -->
<!-- Delete All Keys Modal -->
<div id="delete-all-keys-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> This will not delete users (prevent
them from logging in). Go to https://keyauth.cc/app/?page=users for that.
</b>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
all of your keys? This can not be undone.</h3>
<form method="POST">
<button data-modal-hide="delete-all-keys-modal" name="delkeys"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-keys-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Keys Modal -->
<!-- Delete All Used Keys Modal -->
<div id="delete-all-used-keys-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> This will not delete users (prevent
them from logging in). Go to https://keyauth.cc/app/?page=users for that.
</b>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
all of your used keys? This can not be undone.</h3>
<form method="POST">
<button data-modal-hide="delete-all-used-keys-modal" name="deleteallused"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-used-keys-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Used Keys Modal -->
<!-- Delete All Unused Keys Modal -->
<div id="delete-all-unused-keys-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> This will not delete users (prevent
them from logging in). Go to https://keyauth.cc/app/?page=users for that.
</b>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
all of your unused keys? This can not be undone.</h3>
<form method="POST">
<button data-modal-hide="delete-all-unused-keys-modal" name="deleteallunused"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-unused-keys-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Unused Keys Modal -->
<!-- Delete Key Modal -->
<div id="del-key" tabindex="-1"
class="modal fixed inset-0 flex items-center justify-center z-50 hidden">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> This will not delete the user
(prevent them from logging in) unless you check Delete User Too
</b>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
this key? This can not be undone.</h3>
<form method="POST">
<div class="flex items-center mb-4">
<input id="delUserToo" name="delUserToo" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
checked>
<label for="delUserToo"
class="ml-2 text-sm font-medium text-white-900">Delete user too</label>
</div>
<button name="deletekey"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2 delkey">
Yes, I'm sure
</button>
<button type="button" onclick="closeModal('del-key')"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete Key Modal -->
<!-- Ban License Modal Actions-->
<div id="ban-key-modal" tabindex="-1"
class="modal fixed inset-0 flex items-center justify-center z-50 hidden">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-red-800 border border-red-700 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium text-red-400">Notice! This will not ban the user
(prevent them from logging in) unless you check Ban User Too</b></span>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to ban this
license?
<form method="POST">
<div>
<div class="relative mb-4 pt-4">
<input type="text" id="reason" name="reason"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer focus:border-red-700"
placeholder=" " autocomplete="on" required>
<label for="reason"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-red-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Ban
Reason</label>
</div>
</div>
<div class="flex items-center mb-4 pt-4">
<input id="banUserToo" name="banUserToo" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
checked>
<label for="banUserToo"
class="ml-2 text-sm font-medium text-white-900">Ban User
Too?</label>
</div>
<button name="bankey"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2 bankey">
Yes, I'm sure
</button>
<button type="button" onclick="closeModal('ban-key-modal')"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Ban License Modal Actions-->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_licenses" class="w-full text-sm text-left text-white">
<thead>
<tr class="border-2 border-gray-200 text-blue-700 px-7">
<th scope="col" class="px-6 py-3">Select</th>
<th scope="col" class="px-6 py-3">Key</th>
<th scope="col" class="px-6 py-3">User</th>
<th scope="col" class="px-6 py-3">Creation Date</th>
<th scope="col" class="px-6 py-3">Generated By</th>
<th scope="col" class="px-6 py-3">Duration</th>
<th scope="col" class="px-6 py-3">Note</th>
<th scope="col" class="px-6 py-3">Used On</th>
<th scope="col" class="px-6 py-3">Used By</th>
<th scope="col" class="px-6 py-3">Status</th>
<th scope="col" class="px-6 py-3">Actions</th>
</tr>
</thead>
</table>
</div>
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a
class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>
<!-- Include the jQuery library -->
<script>
$(document).keydown(function(event) {
if (event.key === 'Escape') {
$('[data-modal]').each(function() {
if (!$(this).hasClass('hidden')) {
const modalName = $(this).data('modal');
closeModal(modalName);
}
});
}
});
function bankey(key) {
var bankey = $('.bankey');
bankey.attr('value', key);
openModal('ban-key-modal');
}
function delkey(key) {
var delkey = $('.delkey');
delkey.attr('value', key);
openModal('del-key');
}
function copyToClipboard() {
const cardBodyContent = document.getElementById('multi-keys').innerText;
const formattedContent = cardBodyContent.replace(/<br>/g, '\n');
const textarea = document.createElement('textarea');
textarea.value = formattedContent;
textarea.style.position = 'fixed';
textarea.style.opacity = 0;
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body.removeChild(textarea);
alert('Copied new licenses!');
}
</script>
<!-- END TABLE -->
</div>
<?php
if (isset($_POST['delkeys'])) {
if ($_SESSION['role'] == "tester") {
dashboard\primary\error("Free tester accounts can't delete keys, upgrade your account to delete keys!");
echo "<meta http-equiv='Refresh' Content='2'>";
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 "<meta http-equiv='Refresh' Content='2'>";
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 "<meta http-equiv='Refresh' Content='2'>";
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 "<meta http-equiv='Refresh' Content='1;'>";
return;
}
if (!isset($jsonArray['keys'])) {
dashboard\primary\error("Missing 'keys' array in JSON!");
echo "<meta http-equiv='Refresh' Content='1;'>";
return;
}
if (!isset($jsonArray['tokens'])) {
dashboard\primary\error("Missing 'tokens' array in JSON!");
echo "<meta http-equiv='Refresh' Content='1;'>";
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 "<meta http-equiv='Refresh' Content='2;'>";
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 "<meta http-equiv='Refresh' Content='2;'>";
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 "<meta http-equiv='Refresh' Content='2'>";
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 "<meta http-equiv='Refresh' Content='0; url=download-types.php?type=licenses'>";
// 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")
};
}

8
app/pages/logout.php Normal file
View File

@@ -0,0 +1,8 @@
<?php
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
echo "<meta http-equiv='Refresh' Content='0; url=../../../login/'>";
session_destroy();
exit();

119
app/pages/logs.php Normal file
View File

@@ -0,0 +1,119 @@
<?php
if ($_SESSION['role'] == "Reseller") {
header("location: ./?page=reseller-licenses");
die();
}
if($role == "Manager" && !($permissions & 256)) {
misc\auditLog\send("Attempted (and failed) to view logs.");
dashboard\primary\error("You weren't granted permission to view this page.");
die();
}
if(!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
if (isset($_POST['dellogs'])) {
$resp = misc\logging\deleteAll();
match($resp){
'failure' => dashboard\primary\error("Failed to delete all logs!"),
'success' => dashboard\primary\success("Successfully deleted all logs!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['dllogs'])){
echo "<meta http-equiv='Refresh' Content='0; url=download-types.php?type=logs'>";
}
if($_SESSION['role'] == "tester") {
$query = misc\mysql\query("SELECT count(*) AS 'numLogs' FROM `logs` WHERE `logapp` = ?",[$_SESSION['app']]);
$row = mysqli_fetch_array($query->result);
$numLogs = $row["numLogs"];
if($numLogs >= 20) {
?><div class="alert alert-danger" role="alert">You have hit 20 logs! Upgrade to developer or seller to store
more logs.</div><?php
}
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl ">Logs</h1>
<br>
<div id="alert" class="flex items-center p-4 mb-4 text-yellow-500 rounded-lg bg-[#09090d]" role="alert">
<span class="sr-only">Info</span>
<div class="ml-3 text-sm font-medium text-yellow-500">
The maximum log message length is 275 characters. Logs are automatically deleted after 1 month. If
you set Discord webhook at <a
href="https://keyauth.cc/app/?page=app-settings">https://keyauth.cc/app/?page=app-settings</a>,
logs will go to Discord and not display on our site.
</div>
</div>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<form method="POST">
<!-- Logs Functions -->
<button name="dllogs"
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">
<i class="lni lni-download mr-2 mt-1"></i>Export Logs
</button>
<!-- End Logs Functions -->
<br>
<!-- Delete Logs Functions -->
<button type="button"
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-logs-modal" data-modal-target="delete-all-logs-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Logs
</button>
<!-- End Delete Logs Functions -->
</form>
<!-- Delete All Logs Modal -->
<div id="delete-all-logs-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to delete all of
your logs. <b>This can
NOT be undone</b>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure
you want
to
delete your logs?</h3>
<form method="POST">
<button data-modal-hide="delete-all-logs-modal" name="dellogs"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-logs-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Logs Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_logs" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Log Date</th>
<th class="px-6 py-3">Log Data</th>
<th class="px-6 py-3">Credential</th>
<th class="px-6 py-3">Device Name</th>
</tr>
</thead>
</table>
</div>

690
app/pages/manage-accs.php Normal file
View File

@@ -0,0 +1,690 @@
<?php
if ($_SESSION['role'] == "Reseller") {
header("location: ./?page=reseller-licenses");
die();
}
if ($_SESSION['role'] == "tester") {
dashboard\primary\error("Must have developer or seller plan to create sub-accounts.");
die();
}
if (isset($_POST['createacc'])) {
$resp = misc\account\addAccount($_POST['username'], $_POST['role'], $_POST['email'], $_POST['pw'], $_POST['keylevels'], $_SESSION['username'], $_POST['app'], $_POST['permissions']);
match($resp){
'invalid_perms' => dashboard\primary\error("Invalid permission value. You msut have at least one permission flag enabled"),
'invalid_role' => dashboard\primary\error("Role options are Manager or Reseller"),
'invalid_email' => dashboard\primary\error("No email defined"),
'username_taken' => dashboard\primary\error("Username already taken!"),
'email_taken' => dashboard\primary\error("Email already taken!"),
'failure' => dashboard\primary\error("Failed to add account!"),
'success' => dashboard\primary\success("Successfully added account"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['deleteacc'])) {
$query = misc\mysql\query("DELETE FROM `accounts` WHERE `owner` = ? AND `username` = ?", [$_SESSION['username'], $_POST['deleteacc']]);
if ($query->affected_rows > 0) {
dashboard\primary\success("Account Successfully Deleted!");
} else {
dashboard\primary\error("Failed To Delete Account!");
}
}
if (isset($_POST['deleteacckeys'])){
$query = misc\mysql\query("DELETE FROM `keys` WHERE `genby` = ? AND `app` = ?", [$_POST['deleteacckeys'], $secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
dashboard\primary\success("Successfully deleted all keys generated by this user!");
} else {
dashboard\primary\error("Failed To Delete Their Generated Keys!");
}
}
if (isset($_POST['deleteaccusers'])){
$query = misc\mysql\query("DELETE FROM `users` WHERE `owner` = ? AND `app` = ?", [$_POST['deleteaccusers'], $secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
dashboard\primary\success("Successfully deleted all users generated by this user!");
} else {
dashboard\primary\error("Failed To Delete Their Generated Users!");
}
}
if (isset($_POST['deleteresellers'])){
$query = misc\mysql\query("DELETE FROM `accounts` WHERE `owner` = ? AND `role` = ?", [$_SESSION['username'], "Reseller"]);
if ($query->affected_rows > 0){
dashboard\primary\success("All Resellers deleted successfully!");
} else {
dashboard\primary\error("Failed to delete all Resellers!");
}
}
if (isset($_POST['deletemanagers'])){
$query = misc\mysql\query("DELETE FROM `accounts` WHERE `owner` = ? AND `role` = ?", [$_SESSION['username'], "Manager"]);
if ($query->affected_rows > 0){
dashboard\primary\success("All Managers deleted successfully!");
} else {
dashboard\primary\error("Failed to delete all Managers!");
}
}
if (isset($_POST['editacc'])) {
$account = misc\etc\sanitize($_POST['editacc']);
$query = misc\mysql\query("SELECT * FROM `accounts` WHERE `username` = ? AND `owner` = ?", [$_POST['editacc'], $_SESSION['username']]);
if ($query->num_rows < 1) {
dashboard\primary\error("Account not Found!");
echo "<meta http-equiv='Refresh' Content='2'>";
return;
}
$row = mysqli_fetch_array($query->result);
$username = $row['username'];
$keylevels = $row['keylevels'];
$balance = $row["balance"];
$balance = explode("|", $balance);
$day = $balance[0];
$week = $balance[1];
$month = $balance[2];
$threemonth = $balance[3];
$sixmonth = $balance[4];
$life = $balance[5];
$year = $balance[6];
echo '<!-- Edit Account Modal -->
<div id="edit-account-modal" tabindex="-1" aria-hidden="true"
class="fixed grid place-items-center h-screen bg-black bg-opacity-60 z-50 p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Edit Account</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<form class="space-y-6" method="POST">
<div>
<div class="grid grid-cols-2 gap-1">
<div class="relative mb-4">
<input type="text" inputmode="numeric" id="daybalance" name="daybalance"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="' . $day . '" maxlength="3"
required>
<input type="hidden" id="account" name="account"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="' . $username . '">
<label for="daybalance"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Day
Balance:</label>
</div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" id="weekbalance" name="weekbalance"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="' . $week . '" maxlength="3"
required>
<label for="weekbalance"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Week
Balance:</label>
</div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" id="monthbalance" name="monthbalance"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="' . $month . '" maxlength="3"
required>
<label for="monthbalance"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Month
Balance:</label>
</div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" id="threemonthbalance"
name="threemonthbalance"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="' . $threemonth .'"
maxlength="3" required>
<label for="threemonthbalance"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Three
Month Balance:</label>
</div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" id="sixmonthbalance"
name="sixmonthbalance"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="' . $sixmonth .'"
maxlength="3" required>
<label for="sixmonthbalance"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Six
Month Balance:</label>
</div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" id="yearbalance"
name="yearbalance"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="' . $year .'"
maxlength="3" required>
<label for="yearbalance"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">
Year Balance:</label>
</div>
</div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" id="lifebalance" name="lifebalance"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="' . $life . '" maxlength="3"
required>
<label for="lifebalance"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Lifetime
Balance:</label>
</div>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<div class="relative mb-4">
<input type="text" inputmode="numeric" id="keylevels" name="keylevels"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="' . $keylevels .'">
<label for="keylevels"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Key
Levels:</label>
</div>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<div class="relative mb-4">
<input type="email" id="email" name="email"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on">
<label for="email"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">New
Email:</label>
</div>
<div class="relative mb-4">
<input type="password" id="pw" name="pw"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on">
<label for="pw"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">New
Password:</label>
</div>
</div>
<button name="saveacc"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Save
Changes</button>
<button
class="w-full text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center" onClick="window.location.href=window.location.href">Cancel
</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Edit Account Modal -->';
}
if (isset($_POST['saveacc'])) {
$account = misc\etc\sanitize($_POST['account']);
$day = misc\etc\sanitize($_POST['daybalance']);
$week = misc\etc\sanitize($_POST['weekbalance']);
$month = misc\etc\sanitize($_POST['monthbalance']);
$threemonth = misc\etc\sanitize($_POST['threemonthbalance']);
$sixmonth = misc\etc\sanitize($_POST['sixmonthbalance']);
$year = misc\etc\sanitize($_POST['yearbalance']);
$lifetime = misc\etc\sanitize($_POST['lifebalance']);
$keylevels = misc\etc\sanitize($_POST['keylevels']) ?? "N/A";
$email = misc\etc\sanitize($_POST['email']);
$pw = misc\etc\sanitize($_POST['pw']);
if (!empty($email)) {
$query = misc\mysql\query("SELECT `username` FROM `accounts` WHERE `email` = SHA1(?)", [$email]);
if ($query->num_rows > 0) {
dashboard\primary\error("Email already taken!");
echo '<meta http-equiv="refresh" content="5">';
return;
}
misc\mysql\query("UPDATE `accounts` SET `email` = SHA1(?) WHERE `username` = ? AND `owner` = ?", [$email, $account, $_SESSION['username']]);
}
if (!empty($pw)) {
$pw = password_hash($pw, PASSWORD_BCRYPT);
misc\mysql\query("UPDATE `accounts` SET `password` = ? WHERE `username` = ? AND `owner` = ?", [$pw, $account, $_SESSION['username']]);
}
$balance = "$day|$week|$month|$threemonth|$sixmonth|$lifetime|$year";
$query = misc\mysql\query("UPDATE `accounts` SET `balance` = ?, `keylevels` = ? WHERE `username` = ? AND `owner` = ?", [$balance, $keylevels, $account, $_SESSION['username']]);
if ($query->affected_rows > 0) {
dashboard\primary\success("Successfully updated settings!");
} else {
dashboard\primary\error("Failed to update settings " . $life . $day . $week . $threemonth);
}
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl ">Resellers & Managers</h1>
<p class="text-xs text-gray-500">Access your Reseller and Manager accounts. <a
href="https://keyauthdocs.apidog.io/sellerapi/reseller-manager/create-new-reseller-manager" target="_blank"
class="text-blue-600 hover:underline">Learn More</a>.</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Alert Box -->
<div id="alert" class="flex items-center p-4 mb-4 text-yellow-800 rounded-lg bg-[#09090d]"
role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<span class="sr-only">Info</span>
<div class="ml-3 text-sm font-medium text-yellow-500">
The balance is in Days|Weeks|Months|3Months|6Months|Lifetime|Years
</div>
</div>
<!-- End Alert Box -->
<!-- Subscripion Functions -->
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="create-acc-modal" data-modal-target="create-acc-modal">
<i class="lni lni-circle-plus mr-2 mt-1"></i>Create Account
</button>
<br>
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-resellers-modal" data-modal-target="delete-all-resellers-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Resellers
</button>
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-managers-modal" data-modal-target="delete-all-managers-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Managers
</button>
<!-- End Subscription Functions -->
<!-- Create Acc Modal -->
<div id="create-acc-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Create Reseller or Manager
Account</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<select id="role" name="role"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"
onchange="handleSelectChange(this.value)">
<option value="Reseller">
Reseller
</option>
<option value="Manager">
Manager
</option>
</select>
<label for="role"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Account
Type</label>
</div>
<div class="relative mb-4">
<select id="app" name="app"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<?php
$query = misc\mysql\query("SELECT * FROM `apps` WHERE `owner` = ? AND `ownerid` = ?",[$_SESSION['username'], $_SESSION['ownerid']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)) {
echo " <option value=\"" . $row["name"] . "\">" . $row["name"] . "</option>";
}
}
?>
</select>
<label for="app"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Assigned
Application</label>
</div>
<div class="relative mb-4">
<input type="text" id="username" name="username"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder="" autocomplete="on" required>
<label for="username"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Assign
Username</label>
</div>
<div class="relative mb-4">
<input type="email" id="email" name="email"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder="" autocomplete="on" required>
<label for="email"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Assign
Email</label>
</div>
<div class="relative mb-4">
<input type="password" id="pw" name="pw"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder="" autocomplete="on" required>
<label for="pw"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Assign
Password</label>
</div>
<div class="relative mb-4">
<input type="text" id="keylevels" name="keylevels"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on">
<label for="keylevels"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Assign
License Levels</label>
</div>
<div id="permDiv" hidden>
<h3 class="mb-4 text-xl font-medium text-white-900">What pages can this
Manager access?</h3>
<div class="grid grid-cols-3 gap-4">
<div class="flex items-center">
<input id="licenses" name="licenses" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="licenses"
class="ml-2 text-sm font-medium text-white-900">Licenses</label>
</div>
<div class="flex items-center">
<input id="users" name="users" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="users"
class="ml-2 text-sm font-medium text-white-900">Users</label>
</div>
<div class="flex items-center">
<input id="tokens" name="tokens" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="tokens"
class="ml-2 text-sm font-medium text-white-900">Tokens</label>
</div>
<div class="flex items-center">
<input id="subscriptions" name="subscriptions" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="subscriptions"
class="ml-2 text-sm font-medium text-white-900">Subscriptions</label>
</div>
<div class="flex items-center">
<input id="chats" name="chats" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="chats"
class="ml-2 text-sm font-medium text-white-900">Chats</label>
</div>
<div class="flex items-center">
<input id="sessions" name="sessions" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="sessions"
class="ml-2 text-sm font-medium text-white-900">Sessions</label>
</div>
<div class="flex items-center">
<input id="files" name="files" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="files"
class="ml-2 text-sm font-medium text-white-900">Files</label>
</div>
<div class="flex items-center">
<input id="vars" name="vars" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="vars"
class="ml-2 text-sm font-medium text-white-900">Variables</label>
</div>
<div class="flex items-center">
<input id="logs" name="logs" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="logs"
class="ml-2 text-sm font-medium text-white-900">Logs</label>
</div>
<div class="flex items-center">
<input id="blacklists" name="blacklists" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="blacklists"
class="ml-2 text-sm font-medium text-white-900">Blacklists</label>
</div>
<div class="flex items-center">
<input id="whitelists" name="whitelists" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="whitelists"
class="ml-2 text-sm font-medium text-white-900">Whitelists</label>
</div>
<div class="flex items-center">
<input id="appSettings" name="appSettings" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2">
<label for="appSettings"
class="ml-2 text-sm font-medium text-white-900">App
Settings</label>
</div>
</div>
<div id="permissionsLabel" class="mt-4 text-white-900 mb-2">Permissions
Code For Seller API:
<a class="mt-4 text-blue-900">0</a>
</div>
</div>
<button name="createacc"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Create
Account</button>
<input type="hidden" id="permissions" name="permissions" value="2047">
</form>
</div>
</div>
</div>
</div>
</div>
<!-- End Create Reseller/Manager Modal -->
<!-- Delete All Resellers Modal -->
<div id="delete-all-resellers-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to delete all of your
resellers! This can not be undone!
</b>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
all of your resellers?</h3>
<form method="POST">
<button data-modal-hide="delete-all-resellers-modal" name="deleteresellers"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-resellers-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Resellers Modal -->
<!-- Delete All Managers Modal -->
<div id="delete-all-managers-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to delete all of your
managers! This can not be undone!
</b>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
all of your managers?</h3>
<form method="POST">
<button data-modal-hide="delete-all-managers-modal" name="deletemanagers"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-managers-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Managers Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_manageaccs" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Username</th>
<th class="px-6 py-3">Role</th>
<th class="px-6 py-3">Application</th>
<th class="px-6 py-3">Balance</th>
<th class="px-6 py-3">Allowed Levels</th>
<th class="px-6 py-3">Actions</th>
</tr>
</thead>
<tbody>
<?php
$query = misc\mysql\query("SELECT * FROM `accounts` WHERE `owner` = ?", [$_SESSION['username']]);
if ($query->num_rows > 0){
while ($row = mysqli_fetch_array($query->result)){
echo "<tr>";
echo "<td>" . $row["username"] . "</td>";
echo "<td>" . $row["role"] . "</td>";
echo "<td>" . $row["app"] . "</td>";
if ($row["roles"] == "Manager"){
echo "<td>N/A</td>";
} else {
echo "<td>" . $row["balance"] . "</td>";
}
echo "<td>" . $row["keylevels"] . "</td>";
echo '<form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true" class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4" type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" style="margin-top:3px">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false" class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1" style="min-width:15rem">
<li>
<button name="deleteacc" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row['username'] . '">
Delete Account
</button>
</li>
<li>
<button name="deleteacckeys" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row['username'] . '">
Delete Their Created Keys
</button>
</li>
<li>
<button name="deleteaccusers" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row['username'] . '">
Delete Their Created Users
</button>
</li>
<li>
<button name="editacc" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
value="' . $row['username'] . '">
Edit Account
</button>
</li>
</ul>
</div>
</td></tr></form>';
}
}
?>
</tbody>
</table>
</div>
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a
class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>
<!-- Include the jQuery library -->
<script type="text/javascript">
function handleSelectChange(value) {
let element = document.getElementById("permDiv");
if (value == "Manager") {
element.removeAttribute("hidden");
} else {
element.setAttribute("hidden", "hidden");
}
}
// credits https://discordapi.com/permissions.html
var perms = {
licenses: 1,
users: 2,
subscriptions: 4,
chats: 8,
sessions: 16,
webhooks: 32,
files: 64,
vars: 128,
logs: 256,
blacklists: 512,
appSettings: 1024,
tokens: 2048,
whitelists: 4096
}
// Function to recalculate and update permissions
function recalculate() {
var totalPermissions = 0;
for (var s in perms) {
var checkbox = document.getElementById(s);
if (checkbox && checkbox.checked) {
totalPermissions += perms[s];
}
}
// Update the label with the calculated totalPermissions
var permissionsLabel = document.getElementById("permissionsLabel");
if (permissionsLabel) {
permissionsLabel.textContent = "Permissions Code For Seller API: " + totalPermissions;
}
// Update other elements as needed
document.getElementById("permissions").value = totalPermissions;
document.getElementById("permissionsSeller").textContent = totalPermissions;
console.log(totalPermissions);
}
// Add event listeners to all checkboxes
var checkboxes = document.querySelectorAll('input[type="checkbox"]');
checkboxes.forEach(function(checkbox) {
checkbox.addEventListener('change', recalculate);
});
</script>

1245
app/pages/manage-apps.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,268 @@
<?php
if ($_SESSION["role"] != 'Reseller'){
dashboard\primary\error("Only resellers can access this page.");
die();
}
?>
<script src="https://shoppy.gg/api/embed.js"></script>
<script src="https://cdn.sellix.io/static/js/embed.js"></script>
<link href="https://cdn.sellix.io/static/css/embed.css" rel="stylesheet" />
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 lang class="text-xl font-semibold text-white-900 sm:text-2xl">Reseller Balance</h1>
<p class="text-xs text-gray-500">Check your balance here.</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<?php
$query = misc\mysql\query("SELECT * FROM `apps` WHERE `secret` = ?",[$_SESSION['app']]);
$row = mysqli_fetch_array($query->result);
if ($row["sellappsecret"] != NULL) {
if ($row["sellappdayproduct"] != NULL) {
$dayproduct_holder = '<a href="' . $row["sellappdayproduct"] . $_SESSION['username'] . '" target="_blank">
<p class="text-sm text-yellow-700 hover:underline transition duration-200 cursor-pointer">
<b>Purchase Day Keys (SellApp)</b>
</p>
</a>';
} else { $dayproduct_holder = "N/A"; }
if ($row["sellappweekproduct"] != NULL) {
$weekproduct_holder = '<a href="' . $row["sellappweekproduct"] . $_SESSION['username'] . '" target="_blank">
<p class="text-sm text-yellow-700 hover:underline transition duration-200 cursor-pointer">
<b>Purchase Week Keys (SellApp)</b>
</p>
</a>';
} else { $weekproduct_holder = "N/A"; }
if ($row["sellappmonthproduct"] != NULL) {
$monthproduct_holder = '<a href="' . $row["sellappmonthproduct"] . $_SESSION['username'] . '" target="_blank">
<p class="text-sm text-yellow-700 hover:underline transition duration-200 cursor-pointer">
<b>Purchase Month Keys (SellApp)</b>
</p>
</a>';
} else { $monthproduct_holder = "N/A"; }
if ($row["sellapplifetimeproduct"] != NULL) {
$lifetimeproduct_holder = '<a href="' . $row["sellapplifetimeproduct"] . $_SESSION['username'] . '" target="_blank">
<p class="text-sm text-yellow-700 hover:underline transition duration-200 cursor-pointer">
<b>Purchase Lifetime Keys (SellApp)</b>
</p>
</a>';
} else { $lifetimeproduct_holder = "N/A"; }
}
if ($row["sellixsecret"] != NULL) {
if ($row["sellixdayproduct"] != NULL) {
$dayproduct_holder = '<a data-sellix-product="' . $row["sellixdayproduct"] . '" data-sellix-custom-Username=' . $_SESSION['username'] . '">
<p class="text-sm text-purple-700 hover:underline transition duration-200 cursor-pointer">
<b>Purchase Day Keys (Sellix)</b>
</p>
</a>';
} else { $dayproduct_holder = "N/A"; }
if ($row["sellixweekproduct"] != NULL) {
$weekproduct_holder = '<a data-sellix-product="' . $row["sellixweekproduct"] . '" data-sellix-custom-Username=' . $_SESSION['username'] . '">
<p class="text-sm text-purple-700 hover:underline transition duration-200 cursor-pointer">
<b>Purchase Week Keys (Sellix)</b>
</p>
</a>';
} else { $weekproduct_holder = "N/A"; }
if ($row["sellixmonthproduct"] != NULL) {
$monthproduct_holder = '<a data-sellix-product="' . $row["sellixmonthproduct"] . '" data-sellix-custom-Username=' . $_SESSION['username'] . '">
<p class="text-sm text-purple-700 hover:underline transition duration-200 cursor-pointer">
<b>Purchase Month Keys (Sellix)</b>
</p>
</a>';
} else { $monthproduct_holder = "N/A"; }
if ($row["sellixlifetimeproduct"] != NULL) {
$lifetimeproduct_holder = '<a data-sellix-product="' . $row["sellixlifetimeproduct"] . '" data-sellix-custom-Username=' . $_SESSION['username'] . '">
<p class="text-sm text-purple-700 hover:underline transition duration-200 cursor-pointer">
<b>Purchase Lifetime Keys (Sellix)</b>
</p>
</a>';
} else { $lifetimeproduct_holder = "N/A"; }
}
if ($row["shoppysecret"] != NULL) {
if ($row["shoppydayproduct"] != NULL) {
$dayproduct_holder = '<a data-shoppy-product="' . $row["shoppydayproduct"] . '" data-shoppy-username=' . $_SESSION['username'] . '">
<p class="text-sm text-green-700 hover:underline transition duration-200 cursor-pointer">
<b>Purchase Day Keys (Shoppy)</b>
</p>
</a>';
} else { $dayproduct_holder = "N/A"; }
if ($row["shoppyweekproduct"] != NULL) {
$weekproduct_holder = '<a data-shoppy-product="' . $row["shoppyweekproduct"] . '" data-shoppy-username=' . $_SESSION['username'] . '">
<p class="text-sm text-green-700 hover:underline transition duration-200 cursor-pointer">
<b>Purchase Week Keys (Shoppy)</b>
</p>
</a>';
} else { $weekproduct_holder = "N/A"; }
if ($row["shoppymonthproduct"] != NULL) {
$monthproduct_holder = '<a data-shoppy-product="' . $row["shoppymonthproduct"] . '" data-shoppy-username=' . $_SESSION['username'] . '">
<p class="text-sm text-green-700 hover:underline transition duration-200 cursor-pointer">
<b>Purchase Month Keys (Shoppy)</b>
</p>
</a>';
} else { $monthproduct_holder = "N/A"; }
if ($row["shoppylifetimeproduct"] != NULL) {
$lifetimeproduct_holder = '<a data-shoppy-product="' . $row["shoppylifetimeproduct"] . '" data-shoppy-username=' . $_SESSION['username'] . '">
<p class="text-sm text-green-700 hover:underline transition duration-200 cursor-pointer">
<b>Purchase Lifetime Keys (Shoppy)</b>
</p>
</a>';
} else { $lifetimeproduct_holder = "N/A"; }
}
if ($row["resellerstore"] != NULL) {
echo '<a href="' . $row["resellerstore"] . '" target="resellerstore">
<button class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">
<i class="lni lni-money-protection mr-2 mt-1"></i>Purchase Lifetime Keys (General Store)
</button>
</a>';
}
?>
<?php
$query = misc\mysql\query("SELECT `balance` FROM `accounts` WHERE `username` = ?",[$_SESSION['username']]);
$row = mysqli_fetch_array($query->result);
$balance = $row["balance"];
$balance = explode("|", $balance);
$day = $balance[0];
$week = $balance[1];
$month = $balance[2];
$threemonth = $balance[3];
$sixmonth = $balance[4];
$life = $balance[5];
$year = $balance[6];
echo '<br><br>
<div class="relative overflow-x-auto shadow-md sm:rounded-lg">
<table class="w-full text-sm text-left text-gray-500">
<thead class="text-xs text-blue-700 uppercase">
<tr>
<th scope="col" class="px-6 py-3">
Duration
</th>
<th scope="col" class="px-6 py-3">
Amount
</th>
<th scope="col" class="px-6 py-3">
Restock
</th>
</tr>
</thead>
<tbody>
<tr class="border-b bg-[#0f0f17]">
<th scope="row" class="px-6 py-4 font-medium text-white whitespace-nowrap">
Day
</th>
<td class="px-6 py-4 text-white">
' . $day . '
</td>
<td class="px-6 py-4 text-white">
<p>' . $dayproduct_holder . '</p>
</td>
</tr>
<tr class="border-b bg-[#0f0f17]">
<th scope="row" class="px-6 py-4 font-medium text-white whitespace-nowrap">
Week
</th>
<td class="px-6 py-4 text-white">
' . $week . '
</td>
<td class="px-6 py-4 text-white">
<p>' . $weekproduct_holder . '</p>
</td>
</tr>
<tr class="border-b bg-[#0f0f17]">
<th scope="row" class="px-6 py-4 font-medium text-white whitespace-nowrap">
Month
</th>
<td class="px-6 py-4 text-white">
' . $month . '
</td>
<td class="px-6 py-4 text-white">
<p>' . $monthproduct_holder . '</p>
</td>
</tr>
<tr class="border-b bg-[#0f0f17]">
<th scope="row" class="px-6 py-4 font-medium text-white whitespace-nowrap">
Three Month
</th>
<td class="px-6 py-4 text-white">
' . $threemonth . '
</td>
<td class="px-6 py-4 text-white">
<p>N/A</p>
</td>
</tr>
<tr class="border-b bg-[#0f0f17]">
<th scope="row" class="px-6 py-4 font-medium text-white whitespace-nowrap">
Six Month
</th>
<td class="px-6 py-4 text-white">
' . $sixmonth . '
</td>
<td class="px-6 py-4 text-white">
<p>N/A</p>
</td>
</tr>
<tr class="border-b bg-[#0f0f17]">
<th scope="row" class="px-6 py-4 font-medium text-white whitespace-nowrap">
Year
</th>
<td class="px-6 py-4 text-white">
' . $year . '
</td>
<td class="px-6 py-4 text-white">
<p>N/A</p>
</td>
</tr>
<tr class="border-b bg-[#0f0f17]">
<th scope="row" class="px-6 py-4 font-medium text-white whitespace-nowrap">
Lifetime
</th>
<td class="px-6 py-4 text-white">
' . $life . '
</td>
<td class="px-6 py-4 text-white">
<p>' . $lifetimeproduct_holder . '</p>
</td>
</tr>
</tbody>
</table>
</div>
';
?>

View File

@@ -0,0 +1,430 @@
<?php
if ($_SESSION["role"] != 'Reseller'){
dashboard\primary\error("Only resellers can access this page.");
die();
}
$query = misc\mysql\query("SELECT `keylevels` FROM `accounts` WHERE `username` = ?",[$_SESSION['username']]);
$row = mysqli_fetch_array($query->result);
$keylevels = $row['keylevels'];
if (isset($_SESSION['keys_array'])) {
$list = $_SESSION['keys_array'];
$keys = NULL;
for ($i = 0; $i < count($list); $i++) {
$keys .= "" . $list[$i] . "<br>";
}
echo "<div class=\"card\"> <div class=\"card-body\" id=\"multi-keys\"> $keys </div> </div> <br>";
echo "<button onclick=\"copyToClipboard()\" class=\"inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200\">Copy new license(s)</button>";
unset($_SESSION['keys_array']);
}
if (isset($_POST['genkeys'])) {
$key = misc\license\createLicense($_POST['amount'], $_POST['mask'], 1, $_POST['level'], $_POST['note'], $_POST['expiry']);
switch ($key) {
case 'max_keys':
dashboard\primary\error("You can only generate 100 licenses at a time");
break;
case 'no_negative':
dashboard\primary\error("Amount can't be negative!");
break;
case 'unauthed_level':
dashboard\primary\error("Not authorized to make licenses with that level!");
break;
case 'invalid_exp':
dashboard\primary\error("Invalid expiry!");
break;
case 'insufficient_balance':
dashboard\primary\error("Not enough balance to create license(s)");
break;
case 'dupe_custom_key':
dashboard\primary\error("Can't do custom key with amount greater than one");
break;
default:
if (misc\etc\sanitize($_POST['amount']) > 1) {
$_SESSION['keys_array'] = $key;
echo "<meta http-equiv='Refresh' Content='0;'>";
} else {
echo "<script>navigator.clipboard.writeText('" . array_values($key)[0] . "');</script>";
dashboard\primary\success("License Created And Copied To Clipboard!");
misc\auditLog\send("Created a new license");
}
break;
}
}
if (isset($_POST['deletekey'])) {
$userToo = ($_POST['delUserToo'] == "on") ? 1 : 0;
$resp = misc\license\deleteSingular($_POST['deletekey'], $userToo);
switch ($resp) {
case 'failure':
dashboard\primary\error("Failed to delete license!");
break;
case 'nope':
misc\auditLog\send("Attempted (and failed) to delete license he doesn't own " . $_POST['deletekey']);
dashboard\primary\error("Nope, nice try!");
break;
case 'success':
misc\auditLog\send("Deleted license key " . $_POST['deletekey']);
dashboard\primary\success("Successfully deleted license!");
break;
default:
dashboard\primary\error("Unhandled Error! Contact us if you need help");
break;
}
}
if (isset($_POST['bankey'])) {
$userToo = ($_POST['banUserToo'] == "on") ? 1 : 0;
$resp = misc\license\ban($_POST['bankey'], $_POST['reason'], $userToo);
switch ($resp) {
case 'failure':
dashboard\primary\error("Failed to ban license!");
break;
case 'nope':
misc\auditLog\send("Attempted (and failed) to ban license he doesn't own " . $_POST['bankey']);
dashboard\primary\error("Nope, nice try!");
break;
case 'success':
misc\auditLog\send("Banned license key " . $_POST['bankey']);
dashboard\primary\success("Successfully banned license!");
break;
default:
dashboard\primary\error("Unhandled Error! Contact us if you need help");
break;
}
}
if (isset($_POST['unbankey'])) {
$resp = misc\license\unban($_POST['unbankey']);
switch ($resp) {
case 'failure':
dashboard\primary\error("Failed to unban license!");
break;
case 'nope':
misc\auditLog\send("Attempted (and failed) to unban license he doesn't own " . $_POST['unbankey']);
dashboard\primary\error("Nope, nice try!");
break;
case 'success':
misc\auditLog\send("Unbanned license key " . $_POST['unbankey']);
dashboard\primary\success("Successfully unbanned license!");
break;
default:
dashboard\primary\error("Unhandled Error! Contact us if you need help");
break;
}
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 lang class="text-xl font-semibold text-white-900 sm:text-2xl">Reseller Licenses</h1>
<p class="text-xs text-gray-500">Manage your licenses here.</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<button type="button"
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="create-key-modal" data-modal-target="create-key-modal">
<i class="lni lni-circle-plus mr-2 mt-1"></i> Create Keys
</button>
<!-- Create Key Modal -->
<div id="create-key-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<?php
$query = misc\mysql\query("SELECT `format`, `amount`, `lvl`, `note`, `duration`, `unit` FROM `apps` WHERE `secret` = ?",[$_SESSION['app']]);
$row = mysqli_fetch_array($query->result);
$format = $row['format'];
$amt = $row['amount'];
$lvl = $row['lvl'];
$note = $row['note'];
$dur = $row['duration'];
$unit = $row['unit'];
?>
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Create A New Key</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" min="1" max="100" id="amount"
name="amount"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
autocomplete="on" required>
<label for="amount"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">License
Amount</label>
</div>
<div class="relative mb-4">
<input type="text" maxlength="49" id="mask" name="mask"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder="*****-*****-*****-*****" autocomplete="on"
value="*****-*****-*****-*****" required>
<label for="mask"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">License
Mask</label>
</div>
<div class="flex items-center mb-4">
<input id="lowercaseLetters" name="lowercaseLetters" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
checked>
<label for="lowercaseLetters"
class="ml-2 text-sm font-medium text-white-900">Include
Lowercase Letters</label>
</div>
<div class="flex items-center">
<input checked id="checked-checkbox" name="capitalLetters" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
checked>
<label for="checked-checkbox"
class="ml-2 text-sm font-medium text-white-900">Include
Uppercase Letters</label>
</div>
<div class="relative mb-4 pt-3">
<select id="level" name="level"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<?php
if ($keylevels != "N/A") {
$keylevels = explode("|", $keylevels);
foreach ($keylevels as $levels) {
?>
<option value="<?= $levels; ?>"><?= $levels; ?>
</option>
<?php
}
} else {
$query = misc\mysql\query("SELECT DISTINCT `level` FROM `subscriptions` WHERE `app` = ? ORDER BY `level` ASC",[$_SESSION['app']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)) {
$queryName = misc\mysql\query("SELECT `name` FROM `subscriptions` WHERE `level` = ? AND `app` = ?",[$row["level"], $_SESSION['app']]);
$name = " (";
$count = 0;
while ($rowSubs = mysqli_fetch_array($queryName->result)) {
$count++;
if($count > 1) {
$name .= ", " . $rowSubs["name"];
}
else {
$name .= $rowSubs["name"];
}
}
$name .= ")";
?>
<option value="<?= $row["level"]; ?>">
<?= $row["level"] . $name; ?></option>
<?php
}
}
}
?>
</select>
</div>
<div class="relative mb-4">
<input type="text" maxlength="69" id="note" name="note"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on">
<label for="note"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">License
Note</label>
</div>
<div class="relative mb-4">
<select id="expiry" name="expiry"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="1 Day">
1 Day
</option>
<option value="1 Week">
1 Week
</option>
<option value="1 Month">
1 Month
</option>
<option value="3 Month">
3 Months
</option>
<option value="6 Month">
6 Months
</option>
<option value="1 Year">
1 Year
</option>
<option value="1 Lifetime">
Lifetime
</option>
</select>
<label for="expiry"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">License
Expiry Unit</label>
</div>
</div>
<button type="submit" name="genkeys"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Generate
Keys</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Create Key Modal -->
<!-- Ban License Modal Actions-->
<div id="ban-key-modal" tabindex="-1"
class="modal fixed inset-0 flex items-center justify-center z-50 hidden">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-red-800 border border-red-700 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium text-red-400">Notice! This will not ban the user
(prevent them from logging in) unless you check Ban User Too</b></span>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to ban this
license?
<form method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="reason" name="reason"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer focus:border-red-700"
placeholder=" " autocomplete="on" required>
<label for="reason"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Ban
Reason</label>
</div>
</div>
<div class="flex items-center mb-4">
<input id="banUserToo" name="banUserToo" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
checked>
<label for="banUserToo"
class="ml-2 text-sm font-medium text-white-900">Ban User
Too?</label>
</div>
<button name="bankey"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2 bankey">
Yes, I'm sure
</button>
<button type="button" onclick="closeModal('ban-key-modal')"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Ban License Modal Actions-->
<!-- Delete Key Modal -->
<div id="del-key" tabindex="-1"
class="modal fixed inset-0 flex items-center justify-center z-50 hidden">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> This will not delete the user
(prevent them from logging in) unless you check Delete User Too
</b>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
this key? This can not be undone.</h3>
<div class="flex items-center mb-4">
<input id="lowercaseLetters" name="lowercaseLetters" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
checked>
<label for="lowercaseLetters"
class="ml-2 text-sm font-medium text-white-900">Delete user too</label>
</div>
<form method="POST">
<button name="deletekey"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2 delkey">
Yes, I'm sure
</button>
<button type="button" onclick="closeModal('del-key')"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Unused Keys Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_reseller_licenses" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Key</th>
<th class="px-6 py-3">Creation Date</th>
<th class="px-6 py-3">Duration</th>
<th class="px-6 py-3">Note</th>
<th class="px-6 py-3">Used On</th>
<th class="px-6 py-3">Used By</th>
<th class="px-6 py-3">Status</th>
<th class="px-6 py-3">Actions</th>
</tr>
</thead>
</table>
</div>
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a
class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>
<script>
function bankey(key) {
var bankey = $('.bankey');
bankey.attr('value', key);
openModal('ban-key-modal');
}
function delkey(key) {
var delkey = $('.delkey');
delkey.attr('value', key);
openModal('del-key');
}
function copyToClipboard() {
const cardBodyContent = document.getElementById('multi-keys').innerText;
const formattedContent = cardBodyContent.replace(/<br>/g, '\n');
const textarea = document.createElement('textarea');
textarea.value = formattedContent;
textarea.style.position = 'fixed';
textarea.style.opacity = 0;
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body.removeChild(textarea);
alert('Copied new licenses!');
}
</script>

View File

@@ -0,0 +1,394 @@
<?php
if ($_SESSION["role"] != 'Reseller'){
dashboard\primary\error("Only resellers can access this page.");
die();
}
if (isset($_POST['deleteuser'])) {
$resp = misc\user\deleteSingular($_POST['deleteuser']);
switch($resp) {
case 'nope':
misc\auditLog\send("Attempted (and failed) to delete user he doesn't own " . $_POST['deleteuser']);
dashboard\primary\error("You don't own this user!");
break;
case 'success':
misc\auditLog\send("Deleted user " . $_POST['deleteuser']);
dashboard\primary\success("User Successfully Deleted!");
break;
case 'failure':
dashboard\primary\error("Failed To Delete User!");
break;
default:
dashboard\primary\error("Unhandled Error! Contact us if you need help");
break;
}
}
if (isset($_POST['resetuser'])) {
$resp = misc\user\resetSingular($_POST['resetuser']);
switch($resp) {
case 'nope':
misc\auditLog\send("Attempted (and failed) to reset HWID of user he doesn't own " . $_POST['resetuser']);
dashboard\primary\error("You don't own this user!");
break;
case 'success':
misc\auditLog\send("Reset HWID for user " . $_POST['resetuser']);
dashboard\primary\success("User Successfully Reset!");
break;
case 'failure':
misc\auditLog\send("Attempted (and failed) to reset a user");
dashboard\primary\error("Failed To Reset User!");
break;
default:
dashboard\primary\error("Unhandled Error! Contact us if you need help");
break;
}
}
if (isset($_POST['banuser'])) {
$resp = misc\user\ban($_POST['un'], $_POST['reason']);
switch($resp) {
case 'nope':
misc\auditLog\send("Attempted (and failed) to ban user he doesn't own " . $_POST['banuser']);
dashboard\primary\error("You don't own this user!");
break;
case 'missing':
dashboard\primary\error("User not Found!");
break;
case 'success':
misc\auditLog\send("Banned user " . $_POST['banuser']);
dashboard\primary\success("User Successfully Banned!");
break;
case 'failure':
misc\auditLog\send("Attempted (and failed) to ban a user");
dashboard\primary\error("Failed To Ban User!");
break;
default:
dashboard\primary\error("Unhandled Error! Contact us if you need help");
break;
}
}
if (isset($_POST['edituser'])) {
$un = misc\etc\sanitize($_POST['edituser']);
$query = misc\mysql\query("SELECT * FROM `users` WHERE `username` = ? AND `app` = ? AND `owner` = ?",[$un, $_SESSION['app'], $_SESSION['username']]);
if ($query->num_rows < 1) {
dashboard\primary\error("User not Found!");
echo "<meta http-equiv='Refresh' Content='2'>";
return;
}
$row = mysqli_fetch_array($query->result);
?>
<!-- Edit User Modal -->
<div id="edit-user-modal" tabindex="-1" aria-hidden="true"
class="fixed grid place-items-center h-screen bg-black bg-opacity-60 z-50 p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Edit User</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="password" id="pass" name="pass"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on">
<label for="pass"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Password:</label>
</div>
<div class="relative mb-4 pt-3">
<select id="sub" name="sub"
class="bg-[#0f0f17] border border-gray-700 text-white-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<?php
$query = misc\mysql\query("SELECT * FROM `subs` WHERE `user` = ? AND `app` = ? AND `expiry` > ?",[$un, $_SESSION['app'], time()]);
$rows = array();
while ($r = mysqli_fetch_assoc($query->result)) {
$rows[] = $r;
}
foreach ($rows as $subrow) {
$sub = $subrow['subscription'];
$value = "[" . $subrow['subscription'] . "] - Expires: <script>document.write(convertTimestamp(" . $subrow["expiry"] . "));</script>";
?>
<option value="<?= $sub; ?>"><?= $value; ?></option>
<?php
}
?>
</select>
<label for="sub"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">User
Subscription</label>
</div>
<div class="relative mb-4">
<input type="text" id="hwid" name="hwid"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" ">
<label for="hwid"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Additional
HWID:</label>
</div>
<p class="text-xs text-white-500">HWID: <?= $row['hwid'] ?? "N/A"; ?>
</p>
<p class="text-xs text-white-500">IP: <?= $row['ip']?? "N/A";?></p>
</div>
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;">
<button name="deletesub"
class="w-full text-white bg-orange-700 hover:bg-orange-800 focus:ring-4 focus:outline-none focus:ring-orange-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center"
value="<?= $un; ?>">Delete Subscription</button>
<button name="saveuser"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center"
value="<?= $un; ?>">Save Changes</button>
<button
class="w-full text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center"
onClick="window.location.href=window.location.href">Cancel</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- End Edit User Modal -->
<?php
}
if (isset($_POST['saveuser'])) {
$un = misc\etc\sanitize($_POST['saveuser']);
$hwid = misc\etc\sanitize($_POST['hwid']);
$pass = misc\etc\sanitize($_POST['pass']);
if (isset($hwid) && trim($hwid) != '') {
$query = misc\mysql\query("SELECT `hwid` FROM `users` WHERE `username` = ? AND `app` = ? AND `owner` = ?",[$un, $_SESSION['app'], $_SESSION['username']]);
$row = mysqli_fetch_array($query->result);
$oldHwid = $row["hwid"];
$oldHwid = $oldHwid .= $hwid;
misc\mysql\query("UPDATE `users` SET `hwid` = ? WHERE `username` = ? AND `app` = ? AND `owner` = ?",[$oldHwid, $un, $_SESSION['app'], $_SESSION['username']]);
}
if (isset($pass) && trim($pass) != '') {
misc\mysql\query("UPDATE `users` SET `password` = ? WHERE `username` = ? AND `app` = ? AND `owner` = ?",[password_hash($pass, PASSWORD_BCRYPT), $un, $_SESSION['app'], $_SESSION['username']]);
}
dashboard\primary\success("Successfully Updated User");
misc\auditLog\send("Successfully Updated User $un");
misc\cache\purge('KeyAuthUser:'.$_SESSION['app'].':'.$un);
}
if (isset($_POST['deletesub'])) {
$un = misc\etc\sanitize($_POST['deletesub']);
$query = misc\mysql\query("SELECT * FROM `users` WHERE `username` = ? AND `app` = ? AND `owner` = ?",[$un, $_SESSION['app'], $_SESSION['username']]);
if ($query->num_rows < 1) {
dashboard\primary\error("User not Found!");
echo "<meta http-equiv='Refresh' Content='2'>";
return;
}
$sub = misc\etc\sanitize($_POST['sub']);
function get_string_between($string, $start, $end)
{
$string = ' ' . $string;
$ini = strpos($string, $start);
if ($ini < 1) return '';
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
return substr($string, $ini, $len);
}
$sub = get_string_between($sub, '[', ']');
$query = misc\mysql\query("DELETE FROM `subs` WHERE `app` = ? AND `user` = ? AND `subscription` = ?",[$_SESSION['app'], $un, $sub]);
if ($query->affected_rows != 0) {
misc\auditLog\send("Deleted the subscription \"{$sub}\" from $un");
dashboard\primary\success("Successfully Deleted User's Subscription");
} else {
dashboard\primary\error("Failed To Delete User's Subscription!");
}
}
if (isset($_POST['delusers'])) {
$query = misc\mysql\query("DELETE FROM `users` WHERE `app` = ? AND `owner` = ?",[$_SESSION['app'], $_SESSION['username']]);
if ($query->affected_rows != 0) {
misc\auditLog\send("Deleted all users");
dashboard\primary\success("Users Successfully Deleted!");
misc\cache\purgePattern('KeyAuthUser:' . $_SESSION['app']);
misc\cache\purge('KeyAuthUsernames:' . $_SESSION['app']);
misc\cache\purge('KeyAuthUsers:' . $_SESSION['app']);
} else {
dashboard\primary\error("Failed To Delete Users!");
}
}
if (isset($_POST['resetall'])) {
$query = misc\mysql\query("UPDATE `users` SET `hwid` = '' WHERE `app` = ? AND `owner` = ?",[$_SESSION['app'], $_SESSION['username']]);
if ($query->affected_rows != 0) {
misc\auditLog\send("Reset all users' HWIDs");
dashboard\primary\success("Users Successfully Reset!");
misc\cache\purgePattern('KeyAuthUser:' . $_SESSION['app']);
misc\cache\purge('KeyAuthUsernames:' . $_SESSION['app']);
misc\cache\purge('KeyAuthUsers:' . $_SESSION['app']);
} else {
dashboard\primary\error("Failed To Reset Users!");
}
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 lang class="text-xl font-semibold text-white-900 sm:text-2xl">Reseller Users</h1>
<p class="text-xs text-gray-500">Manage your users here.</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="del-all-users-modal" data-modal-target="del-all-users-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Users
</button>
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="reset-all-users-hwid-modal" data-modal-target="reset-all-users-hwid-modal">
<i class="lni lni-reload mr-2 mt-1"></i>Reset All Users HWID
</button>
<!-- Delete All Users Modal -->
<div id="del-all-users-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to delete all your
users. This can not be undone.
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
all of your users?</h3>
<form method="POST">
<button data-modal-hide="del-all-users-modal" name="delusers"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="del-all-users-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Users Modal -->
<!-- Reset All Users HWID Modal -->
<div id="reset-all-users-hwid-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to reset all users
HWIDs.
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to reset
the HWID of all users?</h3>
<form method="POST">
<button data-modal-hide="reset-all-users-hwid-modal" name="resetall"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="reset-all-users-hwid-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Reset All Users HWID Modal -->
<!-- Ban User Modal -->
<div id="ban-user-modal" tabindex="-1" aria-hidden="true"
class="fixed grid place-items-center hidden h-screen bg-black bg-opacity-60 z-50 p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Ban User</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="reason" name="reason"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder="" autocomplete="on" maxlength="99" required>
<input type="hidden" class="banuser" name="un">
<label for="users"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Ban
Reason:</label>
</div>
</div>
<div style="display: flex;">
<button onclick="closeModal('ban-user-modal')"
class="w-full text-white bg-gray-700 hover:bg-gray-800 focus:ring-4 focus:outline-none focus:ring-gray-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center"
style="margin-right: 10px;">Cancel</button>
<button name="banuser"
class="w-full text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center"
style="margin-right: 10px;">Ban User</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- End Ban User Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_reseller_users" class="w-full text-sm text-left white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Username</th>
<th class="px-6 py-3">HWID</th>
<th class="px-6 py-3">IP</th>
<th class="px-6 py-3">Creation Date</th>
<th class="px-6 py-3">Last Login Date</th>
<th class="px-6 py-3">Status</th>
<th class="px-6 py-3">Actions</th>
</tr>
</thead>
</table>
</div>
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a
class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>
<script>
function banuser(username) {
var banuser = $('.banuser');
banuser.attr('value', username);
openModal('ban-user-modal');
}
</script>
<!-- Include the jQuery library -->

103
app/pages/seller-logs.php Normal file
View File

@@ -0,0 +1,103 @@
<?php
if ($_SESSION['role'] != "seller") {
misc\auditLog\send("Attempted (and failed) to view seller logs.");
dashboard\primary\error("Non-Sellers aren't allowed here.");
die();
}
if(!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
if (isset($_POST['enableLogs'])) {
$query = misc\mysql\query("UPDATE `apps` SET `sellerLogs` = 1 WHERE `secret` = ?",[$_SESSION['app']]);
if ($query->affected_rows > 0) {
misc\cache\purge('KeyAuthAppSeller:' . $_SESSION['sellerkey']);
dashboard\primary\success("Successfully enabled seller logs!");
}
else {
dashboard\primary\success("Failed to enable seller logs.");
}
}
if (isset($_POST['disableLogs'])) {
$query = misc\mysql\query("UPDATE `apps` SET `sellerLogs` = 0 WHERE `secret` = ?",[$_SESSION['app']]);
if ($query->affected_rows > 0) {
misc\cache\purge('KeyAuthAppSeller:' . $_SESSION['sellerkey']);
dashboard\primary\success("Successfully disabled seller logs!");
}
else {
dashboard\primary\success("Failed to disable seller logs.");
}
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl ">Seller Logs</h1>
<p class="text-xs text-gray-500">View seller key activity. <a
href="https://docs.keyauth.cc/website/seller/seller-logs" target="_blank"
class="text-blue-600 hover:underline">Learn More</a>.</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<form method="post">
<?php
$query = misc\mysql\query("SELECT `sellerLogs` FROM `apps` WHERE `secret` = ?",[$_SESSION['app']]);
$row = mysqli_fetch_array($query->result);
$enabled = $row['sellerLogs'];
if (!$enabled){
?>
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
name="enableLogs">
<i class="lni lni-power-switch mr-2 mt-1"></i>Enable Logging
</button>
<?php } else { ?>
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
name="disableLogs">
<i class="lni lni-power-switch mr-2 mt-1"></i>Disable Logging
</button>
<?php } ?>
</form>
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_seller_logs" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">IP Address</th>
<th class="px-6 py-3">URL</th>
<th class="px-6 py-3">Date</th>
</tr>
</thead>
<tbody>
<?php
if ($_SESSION['app']) {
$query = misc\mysql\query("SELECT * FROM `sellerLogs` WHERE `app` = ? ORDER BY `date` DESC",[$_SESSION['app']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)) {
echo "<tr>";
echo " <td>" . $row["ip"] . "</td>";
echo " <td><a class=\"blur-sm hover:blur-none\" href=\"".$row["path"]."\" target=\"_blank\">". urldecode($row["path"]) . "</a></td>";
echo " <td><script>document.write(convertTimestamp(".$row["date"]."));</script></td>";
echo "</tr>";
}
}
}
?>
</tbody>
</table>
</div>

File diff suppressed because it is too large Load Diff

102
app/pages/sessions.php Normal file
View File

@@ -0,0 +1,102 @@
<?php
if ($_SESSION['role'] == "Reseller") {
header("location: ./?page=reseller-licenses");
die();
}
if($role == "Manager" && !($permissions & 16)) {
misc\auditLog\send("Attempted (and failed) to view sessions.");
dashboard\primary\error("You weren't granted permission to view this page!");
die();
}
if(!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
if (isset($_POST['killall'])) {
$resp = misc\session\killAll();
match($resp){
'failure' => dashboard\primary\error("Failed to kill all sessions!"),
'success' => dashboard\primary\success("Successfully killed all sessions!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['kill'])) {
$resp = misc\session\killSingular($_POST['kill']);
match($resp){
'failure' => dashboard\primary\error("Failed to kill session!"),
'success' => dashboard\primary\success("Successfully killed session!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl ">Sessions</h1>
<p class="text-xs text-gray-500">All of your active sessions. (Active Users) <a
href="https://keyauthdocs.apidog.io/api/features/check-session" target="_blank"
class="text-blue-600 hover:underline">Learn More</a>.</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Session Functions -->
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="kill-all-sessions-modal" data-modal-target="kill-all-sessions-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Kill All Sessions
</button>
<!-- End Sessions Functions -->
<!--Kill All Sessions Modal -->
<div id="kill-all-sessions-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to kill all of
your active sessions. Requiring everyone to log into your app again.
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure
you want
to
kill your active sessions?</h3>
<form method="POST">
<button data-modal-hide="kill-all-sessions-modal" name="killall"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="kill-all-sessions-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Kill All Sessions Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_sessions" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">ID</th>
<th class="px-6 py-3">Credentials</th>
<th class="px-6 py-3">Expires</th>
<th class="px-6 py-3">Authenticated</th>
<th class="px-6 py-3">IP Address</th>
<th class="px-6 py-3">Action</th>
</tr>
</thead>
</table>
</div>
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a
class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>

146
app/pages/staff-panel.php Normal file
View File

@@ -0,0 +1,146 @@
<?php
if (!$staff)
{
ob_clean();
http_response_code(403);
require '../404_error.html';
die();
}
if (!$twofactor)
{
dashboard\primary\error("Staff accounts mut have 2FA enabled.");
die("Staff accounts must have 2FA enabled");
}
if (isset($_POST['changeEmail'])) {
$orderId = misc\etc\sanitize($_POST['orderID']);
$newEmail = misc\etc\sanitize($_POST['email']);
if (!is_null($orderId)) {
$query = misc\mysql\query("SELECT `username` FROM `orders` WHERE `orderID` = ?", [$orderId]);
if ($query->num_rows < 1) {
dashboard\primary\error("Order ID not found. Should be from shoppy, sellapp, sellix, or orders.keyauth.cc. NOT PayPal etc. Contact us https://chatting.page/gjqkqirygnfslvce2m5eycuo7tfxrhxl");
return;
}
$username = mysqli_fetch_array($query->result)['username'];
$query = misc\mysql\query("SELECT `username` FROM `accounts` WHERE `email` = SHA(?)", [$newEmail]);
if ($query->num_rows < 1) {
$query = misc\mysql\query("UPDATE `accounts` SET `email` = SHA1(?) WHERE `username` = ?", [$newEmail, $username]);
if ($query->affected_rows > 0) {
dashboard\primary\success("Successfully changed email.");
return;
} else {
dashboard\primary\error("Failed to change email. Perhaps the user changed their username after purchasing. Contact us https://chatting.page/gjqkqirygnfslvce2m5eycuo7tfxrhxl");
return;
}
} else {
dashboard\primary\error("Email already used by username " . mysqli_fetch_array($query->result)['username'] . "");
return;
}
}
$query = misc\mysql\query("SELECT 1 FROM `accounts` WHERE `email` = SHA1(?)", [$newEmail]);
if ($query->num_rows > 0) {
dashboard\primary\error("Email already used! You must specify another email");
return;
}
}
if (isset($_POST['checkExistence'])){
$username = misc\etc\sanitize($_POST['username']);
$query = misc\mysql\query("SELECT `username` FROM `accounts` WHERE `username` = ?",[$username]);
if ($query->num_rows > 0){
dashboard\primary\success("User exists");
} else{
dashboard\primary\error("User does not exist!");
}
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl ">Staff Panel</h1>
<p class="text-xs text-gray-500">Welcome Staff! If you need help, or don't understand something, please
contact an Admin. Thank You!</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Staff Functions -->
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="check-existence-modal" data-modal-target="check-existence-modal">
<i class="lni lni-user mr-2 mt-1"></i>Check Existence
</button>
<button
class="inline-flex text-white bg-orange-500 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="change-users-email-modal" data-modal-target="change-users-email-modal">
<i class="lni lni-reload mr-2 mt-1"></i>Change Users Email
</button>
<!-- End Staff Functions -->
<!-- Search By OrderID Modal -->
<div id="change-users-email-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-orange-700 shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Change Users Email</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="un" name="orderID"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border- border-gray-600 appearance-none focus:ring-0 peer focus:border-orange-700"
placeholder=" " autocomplete="on" required>
<label for="orderID"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-orange-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Users
OrderID</label>
</div>
<div class="relative mb-4">
<input type="text" id="email" name="email"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border- border-gray-600 appearance-none focus:ring-0 peer focus:border-orange-700"
placeholder=" " autocomplete="on" required>
<label for="email"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-orange-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">New Email</label>
</div>
</div>
<button name="changeEmail"
class="w-full text-white bg-orange-700 hover:bg-orange-800 focus:ring-4 focus:outline-none focus:ring-orange-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Change Email</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Search By OrderID Modal -->
<!-- Check Existence Modal -->
<div id="check-existence-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Check User Existence</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="username" name="username"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-600 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="off" required="">
<label for="username"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Username</label>
</div>
</div>
<button name="checkExistence"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Check Existence</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Check Existance Modal -->

369
app/pages/subscriptions.php Normal file
View File

@@ -0,0 +1,369 @@
<?php
if ($_SESSION['role'] == "Reseller") {
header("location: ./?page=reseller-licenses");
die();
}
if ($role == "Manager" && !($permissions & 4)) {
misc\auditLog\send("Attempted (and failed) to view subscriptions.");
dashboard\primary\error("You weren't granted permission to view this page.");
die();
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
if (isset($_POST['addsub'])) {
if (!is_numeric($_POST['level'])) {
dashboard\primary\error("Level must be a number!");
} else {
$resp = misc\sub\add($_POST['subname'], $_POST['level']);
match($resp){
'already_exists' => dashboard\primary\error("This subscription already exists!"),
'failure' => dashboard\primary\error("Failed to create subscription!"),
'success' => dashboard\primary\success("Successfully created subscription!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
}
if (isset($_POST['deletesub'])) {
$resp = misc\sub\deleteSingular($_POST['deletesub']);
match($resp){
'failure' => dashboard\primary\error("Failed to delete subscription"),
'success' => dashboard\primary\success("Successfully deleted subscription"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['delallsubs'])){
$resp = misc\sub\deleteall();
match($resp){
'failure' => dashboard\primary\error("Failed to delete subscriptions!"),
'success' => dashboard\primary\success("Successfully deleted all subscriptions!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['pausesub'])){
$resp = misc\sub\pause($_POST['pausesub']);
match($resp){
'failure' => dashboard\primary\error("Failed to pause subscription!"),
'success' => dashboard\primary\success("Successfully paused subscription!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['unpausesub'])){
$resp = misc\sub\unpause($_POST['unpausesub']);
match($resp){
'failure' => dashboard\primary\error("Failed to unpause subscription!"),
'success' => dashboard\primary\success("Successfully unpaused subscription!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['editsub'])) {
$subscription = misc\etc\sanitize($_POST['editsub']);
$query = misc\mysql\query("SELECT * FROM `subscriptions` WHERE `name` = ? AND `app` = ?", [$subscription, $_SESSION['app']]);
if ($query->num_rows < 1) {
dashboard\primary\error("Subscription not Found!");
echo "<meta http-equiv='Refresh' Content='2'>";
return;
}
$row = mysqli_fetch_array($query->result);
$level = $row["level"];
echo '
<div id="edit-file-modal" tabindex="-1" aria-hidden="true"
class="fixed grid place-items-center h-screen bg-black bg-opacity-60 z-50 p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Edit Subscription</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" id="level" name="level"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="' . $level . '" maxlength="12" required>
<input type="hidden" name="subscription" value="' . $subscription . '">
<label for="level"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Subscription Level:</label>
</div>
</div>
<button name="savesub"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Save
Changes</button>
<button
class="w-full text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center" onClick="window.location.href=window.location.href">Cancel
</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Edit Account Modal -->';
}
if (isset($_POST['savesub'])) {
$subscription = misc\etc\sanitize($_POST['subscription']);
$level = misc\etc\sanitize($_POST['level']);
if (!is_numeric($_POST['level'])) {
dashboard\primary\error("Level must be a number!");
} else {
misc\mysql\query("UPDATE `subscriptions` SET `level` = ? WHERE `name` = ? AND `app` = ?", [$level, $subscription, $_SESSION['app']]);
if ($_SESSION['role'] == "seller") {
misc\cache\purge('KeyAuthSubscriptions:' . $_SESSION['app']);
}
dashboard\primary\success("Successfully Updated Subscription!");
echo "<meta http-equiv='Refresh' Content='2'>";
}
}
if (isset($_POST["selected"]) && isset($_POST["action"])) {
$selected = json_decode($_POST["selected"]);
if ($_POST["action"] == "delete") {
foreach ($selected as $sub) {
$resp = misc\sub\deleteSingular($sub);
match($resp){
'failure' => dashboard\primary\error("Failed to delete subscription"),
'success' => dashboard\primary\success("Successfully deleted subscription"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
}
else if ($_POST["action"] == "pauseMulti") {
foreach ($selected as $value) {
$resp = misc\sub\pause($value);
match($resp){
'failure' => dashboard\primary\error("Failed to pause subscriptions!"),
'success' => dashboard\primary\success("Successfully paused subscriptions!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
}
else if ($_POST["action"] == "unpauseMulti") {
foreach ($selected as $value) {
$resp = misc\sub\unpause($value);
match($resp){
'failure' => dashboard\primary\error("Failed to unpause subscriptions!"),
'success' => dashboard\primary\success("Successfully unpaused subscriptions!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
}
else {
dashboard\primary\error("Invalid action!");
}
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl ">Subscriptions</h1>
<p class="text-xs text-gray-500">Subscriptions act as levels/tiers. <a
href="https://keyauthdocs.apidog.io/sellerapi/subscriptions/create-new-subscription" target="_blank"
class="text-blue-600 hover:underline">Learn More</a>.</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Subscripion Functions -->
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="create-subscription-modal" data-modal-target="create-subscription-modal">
<i class="lni lni-circle-plus mr-2 mt-1"></i>Create Subscription
</button>
<!-- End Subscription Functions -->
<br>
<!-- Delete Subscription Functions -->
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-subs-modal" data-modal-target="delete-all-subs-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Subscriptions
</button>
<button id="dropdownselection" data-dropdown-toggle="subscriptiondropdown"
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200 hidden"
type="button">Selection Options
</button>
<div id="subscriptiondropdown" class="z-10 hidden bg-[#09090d] divide-y divide-gray-100 rounded-lg shadow w-44">
<ul class="py-2 text-sm text-white">
<li>
<form method="post">
<input type="hidden" name="action" value="delete">
<input type="hidden" id="selected" name="selected">
<a href="#" onclick="this.parentNode.submit();" class="block px-4 py-2 focus:bold ml-2 hover:text-red-700">Delete Selected</a>
</form>
</li>
<li>
<form method="post">
<input type="hidden" name="action" value="pauseMulti">
<input type="hidden" id="selected" name="selected">
<a href="#" onclick="this.parentNode.submit();" class="block px-4 py-2 focus:bold ml-2 hover:text-red-700">Pause Selected</a>
</form>
</li>
<li>
<form method="post">
<input type="hidden" name="action" value="unpauseMulti">
<input type="hidden" id="selected" name="selected">
<a href="#" onclick="this.parentNode.submit();" class="block px-4 py-2 focus:bold ml-2 hover:text-red-700">Unpause Selected</a>
</form>
</li>
</ul>
</div>
<!-- End Delete Subscription Functions -->
<!-- Create Subscription Modal -->
<div id="create-subscription-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Create A Subscription</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="subname" name="subname"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<label for="subname"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Subscription
Name</label>
</div>
<div class="relative mb-4">
<input type="text" inputmode="numeric" id="level" name="level"
maxlength="12"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<label for="level"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Subscription
Level</label>
</div>
</div>
<button type="submit" name="addsub"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Create
Subscription</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Create Subscription Modal -->
<!-- Delete All Subscriptions Modal -->
<div id="delete-all-subs-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to delete all of your
subscriptions. This can not be undone.
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
all of your subscriptions?</h3>
<form method="POST">
<button data-modal-hide="delete-all-subs-modal" name="delallsubs"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-subs-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Keys Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_subs" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Select</th>
<th class="px-6 py-3">Subscription Name</th>
<th class="px-6 py-3">License Level</th>
<th class="px-6 py-3">Actions</th>
</tr>
</thead>
<tbody>
<?php
if ($_SESSION['app']) {
$query = misc\mysql\query("SELECT * FROM `subscriptions` WHERE `app` = ?", [$_SESSION['app']]);
if ($query->num_rows > 0){
while ($row = mysqli_fetch_array($query->result)){
echo "<tr>";
echo '<td> <input type="checkbox" style="outline:none;"class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 checkbox" value="' . $row["name"] .'">' . '</td>';
echo "<td>" . $row["name"] . "</td>";
echo "<td>" . $row["level"] . "</td>";
echo '<form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true" class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4" type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" style="margin-top:3px">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false" class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1" style="min-width:15rem">
<li>
<button name="deletesub" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row["name"] . '">
Delete Subscription
</button>
</li>
<li>
<button name="pausesub" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row["name"] . '">
Pause Subscription
</button>
</li>
<li>
<button name="unpausesub" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row["name"] . '">
Unpause Subscription
</button>
</li>
<li>
<button name="editsub" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
value="' . $row["name"] . '">
Edit Subscription
</button>
</li>
</ul>
</div>
</td>
</tr>
</form>';
}
}
}
?>
</tbody>
</table>
</div>
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>

23
app/pages/support.php Normal file
View File

@@ -0,0 +1,23 @@
<style>
div.scroll {
width: 1000px;
height: 330px;
overflow-x: hidden;
overflow-y: auto;
}
</style>
<!--begin::Container-->
<div id="kt_content_container" class="container-xxl">
<div class="card mb-xl-8">
<div class="card-header border-0 pt-5">
<h3 class="card-title align-items-start flex-column">
<span class="card-label fw-bolder fs-3 mb-1">Support Chat</span>
</h3>
</div>
<div class="card-body py-3">
Web tickets have been discontinued - Please use the chat box on the bottom right of the website.
</div>
</div>
</div>

43
app/pages/tokens.php Normal file
View File

@@ -0,0 +1,43 @@
<?php
if ($_SESSION['role'] == "Reseller") {
header("location: ./?page=reseller-licenses");
die();
}
if($role == "Manager" && !($permissions & 1)) {
misc\auditLog\send("Attempted (and failed) to view tokens.");
dashboard\primary\error("You weren't granted permission to view this page!");
die();
}
if(!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 lang class="text-xl font-semibold text-white-900 sm:text-2xl">Tokens</h1>
<p class="text-xs text-gray-500">Given to users to manage blacklists.</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_tokens" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">App</th>
<th class="px-6 py-3">Token</th>
<th class="px-6 py-3">Assigned</th>
<th class="px-6 py-3">Banned</th>
<th class="px-6 py-3">Reason</th>
<th class="px-6 py-3">Hash</th>
<th class="px-6 py-3">Type</th>
<th class="px-6 py-3">Status</th>
</tr>
</thead>
</table>
</div>

839
app/pages/upgrade.php Normal file
View File

@@ -0,0 +1,839 @@
<?php
if ($_SESSION['role'] == "Reseller" || $_SESSION['role'] == "Manager"){
misc\auditLog\send("Attempted (and failed) to view upgrade.");
dashboard\primary\error("Resellers or Managers aren't allowed here.");
echo "<meta http-equiv='Refresh' Content='3; url=?page=manage-apps'>";
die();
}
if ($_SESSION['username'] == "demoseller" || $_SESSION['username'] == "demodeveloper"){
dashboard\primary\error("You can not upgrade a demo account!");
echo "<meta http-equiv='Refresh' Content='3; url=?page=manage-apps'>";
die();
}
if (str_contains($ua, 'iPhone') || str_contains($ua, 'Mac OS') || str_contains($ua, 'Mobile')){
dashboard\primary\error("Like Spotify, you can't uprade in the app. We know, it's not ideal.");
echo "<meta http-equiv='Refresh' Content='3; url=?page=manage-apps'>";
die();
}
?>
<title>KeyAuth - Upgrade</title>
<script src="https://cdn.sellix.io/static/js/embed.js"></script>
<link href="https://cdn.sellix.io/static/css/embed.css" rel="stylesheet" />
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl ">Upgrade</h1>
<p class="text-xs text-gray-500">Upgrade your account today!</p>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Alert Box -->
<div id="alert-4" class="flex items-center p-4 mb-4 text-red-600 rounded-lg bg-[#09090d]"
role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<div class="ml-3 text-sm font-medium">
<b>Fraud Notice:</b> Committing fraud will result in your account being banned! There is also a risk rating on each payment. If it reaches a specific amount, we have the right to refund you and downgrade your account.
</div>
</div>
<!-- End Alert Box -->
<!-- Alert Box -->
<div id="alert-4" class="flex items-center p-4 mb-4 text-red-600 rounded-lg bg-[#09090d]"
role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<div class="ml-3 text-sm font-medium">
<b>Russian Blockages Notice:</b> We do not block any users in Russia, but Paypal & credit
cards do.
Use Binance, Cryptocurrency, or Perfect Money instead.
</div>
</div>
<!-- End Alert Box -->
<!-- Alert Box -->
<div id="alert-4" class="flex items-center p-4 mb-4 text-green-600 rounded-lg bg-[#09090d]"
role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<div class="ml-3 text-sm font-medium">
<b>Discount:</b> If you currently have the Developer subscription(yearly only!), you can use code
<b>alreadydev</b> to get 50% off when purchasing the seller subscription.
Attempting to use the code while having the tester subscription will result in you only
receiving the developer subscription.
</div>
</div>
<!-- End Alert Box -->
<section id="plans">
<div class="max-w-screen-xl px-4 py-8 mx-auto lg:px-6 sm:py-16 lg:py-24">
<div class="mx-auto max-w-screen-md text-center">
<div class="flex items-center justify-center mb-12 -mt-6">
<label class="relative inline-flex items-center mr-5 cursor-pointer">
<input type="checkbox" id="pricing_anually_month" class="sr-only peer"
checked>
<div
class="w-11 h-6 border-2 border-blue-700 bg-[#0f0f17] rounded-full peer peer-focus:ring-0 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-[#0C0C12] after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#0C0C12]">
</div>
<span class="ml-3 text-sm font-medium text-gray-300">Annual pricing <span
class="text-xs">(save
50% +)</span></span>
</label>
</div>
</div>
<div class="flex flex-wrap -m-7">
<div class="w-full md:w-1/3 p-7 animate-on-scroll">
<div class="h-full p-8 border border-white-700 rounded-xl bg-[#09090d]">
<div class="flex flex-wrap justify-between border-b border-gray-800 pb-7 mb-7">
<div class="w-full xl:w-auto">
<h3 class="font-bold text-2xl text-white">Tester</h3>
</div>
<div class="w-full xl:w-auto xl:text-right">
<h3 class="mb-0.5 font-bold text-2xl text-white">
<span class="text-sm mr-0.5">$</span> <span id="tester_mode"></span>
</h3>
<p class="text-sm text-gray-400">
Limited Access for those looking to experiment implementing KeyAuth
</p>
</div>
</div>
<ul class="mb-8">
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Users: 10
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Upload Files: (10 MB)
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Global Variables: 5
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
User Variables
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Logs (includes Discord logs): 20
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Hardware/IP Blacklist/Whitelist
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Web Loader
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-red-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm4.207 12.793-1.414 1.414L12 13.414l-2.793 2.793-1.414-1.414L10.586 12 7.793 9.207l1.414-1.414L12 10.586l2.793-2.793 1.414 1.414L13.414 12l2.793 2.793Z">
</path>
</svg>
<p>
Create Webhooks
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-red-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm4.207 12.793-1.414 1.414L12 13.414l-2.793 2.793-1.414-1.414L10.586 12 7.793 9.207l1.414-1.414L12 10.586l2.793-2.793 1.414 1.414L13.414 12l2.793 2.793Z">
</path>
</svg>
<p>
Reseller & Manager Access
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-red-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm4.207 12.793-1.414 1.414L12 13.414l-2.793 2.793-1.414-1.414L10.586 12 7.793 9.207l1.414-1.414L12 10.586l2.793-2.793 1.414 1.414L13.414 12l2.793 2.793Z">
</path>
</svg>
<p>
Chatrooms
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-red-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm4.207 12.793-1.414 1.414L12 13.414l-2.793 2.793-1.414-1.414L10.586 12 7.793 9.207l1.414-1.414L12 10.586l2.793-2.793 1.414 1.414L13.414 12l2.793 2.793Z">
</path>
</svg>
<p>
SellerAPI Access
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-red-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm4.207 12.793-1.414 1.414L12 13.414l-2.793 2.793-1.414-1.414L10.586 12 7.793 9.207l1.414-1.414L12 10.586l2.793-2.793 1.414 1.414L13.414 12l2.793 2.793Z">
</path>
</svg>
<p>
Discord Bot
</p>
</li>
</ul>
<?php if ($_SESSION["role"] !== "tester"){ ?>
<p class="text-sm text-gray-400">
This is the default subsription. But you have the <?= $_SESSION["role"]; ?>
subscription.
</p>
<?php } else { ?>
<p class="text-sm text-gray-400">
This is the default subsription, and your current one.
</p>
<?php } ?>
</div>
</div>
<div class="w-full md:w-1/3 p-7 animate-on-scroll-in-up">
<div class="h-full p-8 border border-green-700 rounded-xl bg-[#09090d]">
<div class="flex flex-wrap justify-between border-b border-gray-800 pb-7 mb-7">
<div class="w-full xl:w-auto">
<h3 class="font-bold text-2xl text-white">Developer</h3>
</div>
<div class="w-full xl:w-auto xl:text-right">
<h3
class="mb-0.5 font-bold text-2xl text-transparent bg-clip-text bg-gradient-to-r to-[#4fea74] from-[#1db233]">
<span class="text-sm mr-0.5">$</span><span
id="developer_mode"></span>
</h3>
<p class="text-sm text-gray-400">
Ample limits plus full access to reseller system. Most folks start
here.
</p>
</div>
</div>
<ul class="mb-8">
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Users: Unlimited
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Upload Files: (50 MB)
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Global Variables: Unlimited
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
User Variables
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Logs (includes Discord logs): Unlimited
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Hardware/IP Blacklist/Whitelist
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Web Loader
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Create Webhooks
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Reseller & Manager Access
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-red-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm4.207 12.793-1.414 1.414L12 13.414l-2.793 2.793-1.414-1.414L10.586 12 7.793 9.207l1.414-1.414L12 10.586l2.793-2.793 1.414 1.414L13.414 12l2.793 2.793Z">
</path>
</svg>
<p>
Chatrooms
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-red-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm4.207 12.793-1.414 1.414L12 13.414l-2.793 2.793-1.414-1.414L10.586 12 7.793 9.207l1.414-1.414L12 10.586l2.793-2.793 1.414 1.414L13.414 12l2.793 2.793Z">
</path>
</svg>
<p>
SellerAPI Access
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-red-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm4.207 12.793-1.414 1.414L12 13.414l-2.793 2.793-1.414-1.414L10.586 12 7.793 9.207l1.414-1.414L12 10.586l2.793-2.793 1.414 1.414L13.414 12l2.793 2.793Z">
</path>
</svg>
<p>
Discord Bot
</p>
</li>
</ul>
<?php if ($_SESSION["role"] == "seller") { ?>
<p class="text-sm text-gray-400 mb-5">
You already have this or a higher subscription.
</p>
<?php } ?>
<button type="button"
class="text-green-700 border-2 border-green-700 hover:bg-green-700 hover:text-white focus:ring-0 focus:outline-none transition duration-200 font-medium rounded-lg text-sm px-5 py-2.5 text-center items-center mb-3 w-full">
<a href="https://paddle.keyauth.cc/developer/?ownerid=<?= urlencode($_SESSION['ownerid']); ?>" target="_blank">
<span class="inline-flex">
Purchase Developer Now (PayPal/Card)
<svg class="w-3.5 h-3.5 ml-2 mt-0.5" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 14 10">
<path stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2"
d="M1 5h12m0 0L9 1m4 4L9 9" />
</svg></span>
</a>
</button>
<button id="sellixButtonDeveloper" data-sellix-product="6011e41969f3d" type="submit" data-sellix-custom-username="'.urlencode($_SESSION['ownerid']).'"
class="text-green-700 border-2 border-green-700 hover:bg-green-700 hover:text-white focus:ring-0 focus:outline-none transition duration-200 font-medium rounded-lg text-sm px-5 py-2.5 text-center items-center mb-3 w-full">
<span class="inline-flex">
Purchase Developer Now (Crypto)
<svg class="w-3.5 h-3.5 ml-2 mt-0.5" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 14 10">
<path stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2"
d="M1 5h12m0 0L9 1m4 4L9 9" />
</svg>
</span>
</button>
<button type="button"
class="text-green-700 border-2 border-green-700 hover:bg-green-700 hover:text-white focus:ring-0 focus:outline-none transition duration-200 font-medium rounded-lg text-sm px-5 py-2.5 text-center items-center mb-3 w-full"
data-modal-target="cashapp-purchase" data-modal-toggle="cashapp-purchase">
<span class="inline-flex">
Purchase Developer Now (Cashapp)
<svg class="w-3.5 h-3.5 ml-2 mt-0.5" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 14 10">
<path stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2"
d="M1 5h12m0 0L9 1m4 4L9 9" />
</svg></span>
</a>
</button>
</div>
</div>
<div class="w-full md:w-1/3 p-7 animate-on-scroll-right">
<div class="h-full p-8 border border-cyan-700 rounded-xl bg-[#09090d]">
<div class="flex flex-wrap justify-between border-b border-gray-800 pb-7 mb-7">
<div class="w-full xl:w-auto">
<h3 class="font-bold text-2xl text-white">Seller</h3>
</div>
<div class="w-full xl:w-auto xl:text-right">
<h3
class="mb-0.5 font-bold text-2xl text-transparent bg-clip-text bg-gradient-to-r to-[#36e2dd] from-[#1e96fc]">
<span class="text-sm mr-0.5">$</span><span id="seller_mode"></span>
</h3>
<p class="text-sm text-gray-400">
Full-fledged supporter, we appreciate you for keeping our servers
running!
</p>
</div>
</div>
<ul class="mb-8">
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Users: Unlimited
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Upload Files: (75 MB)
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Global Variables: Unlimited
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
User Variables
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Logs (includes Discord logs): Unlimited
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Hardware/IP Blacklist/Whitelist
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Web Loader
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Create Webhooks
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Reseller & Manager Access
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Chatrooms
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
SellerAPI Access
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Discord Bot
</p>
</li>
</ul>
<?php if ($_SESSION["role"] == "seller") { ?>
<p class="text-sm text-gray-400 mb-5">
You already have this or a higher subscription.
</p>
<?php } ?>
<button type="button"
class="text-cyan-700 border-2 border-cyan-700 hover:bg-cyan-700 hover:text-white focus:ring-0 focus:outline-none transition duration-200 font-medium rounded-lg text-sm px-5 py-2.5 text-center items-center mb-3 w-full">
<a href="https://paddle.keyauth.cc/seller/?ownerid=<?= urlencode($_SESSION['ownerid']); ?>" target="_blank">
<span class="inline-flex">
Purchase Seller Now (PayPal/Card)
<svg class="w-3.5 h-3.5 ml-2 mt-0.5" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 14 10">
<path stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2"
d="M1 5h12m0 0L9 1m4 4L9 9" />
</svg></span>
</a>
</button>
<button id="sellixButtonSeller" data-sellix-product="6011e42262457" type="submit" data-sellix-custom-username="'.urlencode($_SESSION['ownerid']).'"
class="text-cyan-700 border-2 border-cyan-700 hover:bg-cyan-700 hover:text-white focus:ring-0 focus:outline-none transition duration-200 font-medium rounded-lg text-sm px-5 py-2.5 text-center items-center mb-3 w-full">
<span class="inline-flex">
Purchase Seller Now (Crypto)
<svg class="w-3.5 h-3.5 ml-2 mt-0.5" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 14 10">
<path stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2"
d="M1 5h12m0 0L9 1m4 4L9 9" />
</svg>
</span>
</button>
<button type="button"
class="text-cyan-700 border-2 border-cyan-700 hover:bg-cyan-700 hover:text-white focus:ring-0 focus:outline-none transition duration-200 font-medium rounded-lg text-sm px-5 py-2.5 text-center items-center mb-3 w-full"
data-modal-target="cashapp-purchase" data-modal-toggle="cashapp-purchase">
<span class="inline-flex">
Purchase Seller Now (Cashapp)
<svg class="w-3.5 h-3.5 ml-2 mt-0.5" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 14 10">
<path stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2"
d="M1 5h12m0 0L9 1m4 4L9 9" />
</svg></span>
</a>
</button>
</div>
</div>
<div class="w-full p-7 animate-on-scroll-in-up">
<div class="h-full p-8 border border-yellow-700 rounded-xl bg-[#09090d]">
<div class="flex flex-wrap justify-between border-b border-gray-800 pb-7 mb-7">
<div class="w-full xl:w-auto">
<h3 class="font-bold text-2xl text-white">Enterprise <span
class="text-xs">(Source
Code)</span></h3>
</div>
<div class="w-full xl:w-auto xl:text-right">
<h3
class="mb-0.5 font-bold text-2xl text-transparent bg-clip-text bg-gradient-to-r to-[#eeba0b] from-[#f4e409]">
<span class="text-sm mr-0.5">$</span>79.99 / One-Time
</h3>
<p class="text-sm text-gray-400">
Opt for large-scale projects at $79.99 one-time cost. <br>Access
paid KeyAuth
features' source code, one-on-one setup support, and more.
</p>
</div>
</div>
<ul class="mb-8 md:grid md:grid-cols-2">
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-red-500" fill="currentColor"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm4.207 12.793-1.414 1.414L12 13.414l-2.793 2.793-1.414-1.414L10.586 12 7.793 9.207l1.414-1.414L12 10.586l2.793-2.793 1.414 1.414L13.414 12l2.793 2.793Z">
</path>
</svg>
<p>
Cloud Hosted Subscription (KeyAuth Servers)
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Source code of paid KeyAuth features
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
One-on-one setup support
</p>
</li>
<li class="flex items-center mb-4 font-medium text-base text-white">
<svg class="h-5 w-5 mr-2.5 text-green-500" fill="currentColor"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2Zm-1.999 14.413-3.713-3.705L7.7 11.292l2.299 2.295 5.294-5.294 1.414 1.414-6.706 6.706Z">
</path>
</svg>
<p>
Tutorial video showing how to host KeyAuth for 100% free
</p>
</li>
</ul>
<?php
echo '<button data-sellix-product="6361c20e415e9" type="submit"
class="text-[#eeba0b] border-2 border-[#eeba0b] hover:bg-[#eeba0b] hover:text-white focus:ring-0 focus:outline-none transition duration-200 font-medium rounded-lg text-sm px-5 py-2.5 text-center items-center mb-3 w-full">
<span class="inline-flex">
Purchase Enterprise Now
<svg class="w-3.5 h-3.5 ml-2 mt-0.5" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 14 10">
<path stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2"
d="M1 5h12m0 0L9 1m4 4L9 9" />
</svg>
</span>
</button>
<button type="button"
class="text-[#eeba0b] border-2 border-[#eeba0b] hover:bg-[#eeba0b] hover:text-black focus:ring-0 focus:outline-none transition duration-200 font-medium rounded-lg text-sm px-5 py-2.5 text-center items-center mb-3 w-full">
<a href="https://paddle.keyauth.cc/enterprise/?ownerid=' . urlencode($_SESSION['username']) . '" target="_blank">
<span class="inline-flex">
Purchase Enterprise Now (PayPal)
<svg class="w-3.5 h-3.5 ml-2 mt-0.5" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 14 10">
<path stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2"
d="M1 5h12m0 0L9 1m4 4L9 9" />
</svg>
</span>
</a>
</button>';
?>
</div>
</div>
</div>
</div>
</section>
<!-- cashapp-purchase Modal -->
<div id="cashapp-purchase" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<form method="post">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> Paying with CashApp does not automatically upgrade you! <b>It can take up to 2 days to upgrade your account if you decide to purchase via CashApp</b>.
</div>
</div>
<div class="relative mb-4">
<div class="grid place-items-center">
<img class="h-auto max-w-xl rounded-lg shadow-xl" src="https://cdn.keyauth.cc/v3/imgs/KeyAuthLLC CashAppImg.png" alt="Failed to load CashTag QR Code">
</div>
</div>
<p class="text-sm text-gray-400 mb-5">
Scan the QR code to pay with CashApp. Make sure you include your owner ID in the note so that you are upgraded successfully!
You must also contact support and send them a screenshot of your order, so that the process can go faster.
</p>
<button data-modal-hide="cashapp-purchase" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- cashapp-purchase Modal -->
<!--Flowbite JS-->
<script src="https://cdn.keyauth.cc/v3/dist/flowbite.js"></script>
<!-- jqeury -->
<script src="https://cdn.keyauth.cc/v3/scripts/jquery.min.js"></script>
<script>
$(document).ready(function() {
// Function to update text and button attribute
function updateTextAndButtonAttribute() {
if ($("#pricing_anually_month").is(':checked')) {
$("#tester_mode").text("0 / Year");
$("#developer_mode").text("14.99 / Year");
$("#seller_mode").text("24.99 / Year");
$("#sellixButtonSeller").attr("data-sellix-product", "6011e42262457");
$("#sellixButtonDeveloper").attr("data-sellix-product", "6011e41969f3d");
} else {
$("#tester_mode").text("0 / Year");
$("#developer_mode").text("2.99 / Month");
$("#seller_mode").text("4.99 / Month");
$("#sellixButtonSeller").attr("data-sellix-product", "65475b6dbe8e2");
$("#sellixButtonDeveloper").attr("data-sellix-product", "6547557555143");
}
}
// Initial setup
updateTextAndButtonAttribute();
// Toggle event handler
$("#pricing_anually_month").click(function() {
updateTextAndButtonAttribute();
});
});
</script>

312
app/pages/user-vars.php Normal file
View File

@@ -0,0 +1,312 @@
<?php
if ($_SESSION['role'] == "Reseller") {
header("location: ./?page=reseller-licenses");
die();
}
if ($role == "Manager" && !($permissions & 2)) {
misc\auditLog\send("Attempted (and failed) to view user variables.");
dashboard\primary\error("You weren't granted permission to view this page.");
die();
}
if(!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
if (isset($_POST['setvar'])) {
if(strlen($_POST['data']) > 500) {
dashboard\primary\error("Variable data must be 500 characters or less!");
}
else {
$readOnly = misc\etc\sanitize($_POST['readOnly']) == NULL ? 0 : 1;
$resp = misc\user\setVariable(urldecode($_POST['user']), $_POST['var'], $_POST['data'], null, $readOnly);
match($resp){
'missing' => dashboard\primary\error("No users found!"),
'failure' => dashboard\primary\error("Failed to set variable!"),
'success' => dashboard\primary\success("Successfully set variable!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
}
if (isset($_POST['delvars'])) {
$query = misc\mysql\query("DELETE FROM `uservars` WHERE `app` = ?",[$_SESSION['app']]);
if ($query->affected_rows > 0) {
dashboard\primary\success("Successfully deleted all variables");
} else {
dashboard\primary\error("Failed to delete all variables");
}
}
if (isset($_POST['deletevar'])) {
$varId = misc\etc\sanitize($_POST['deletevar']);
$query = misc\mysql\query("DELETE FROM `uservars` WHERE `app` = ? AND `id` = ?", [$_SESSION['app'], $varId]);
if ($query->affected_rows > 0) {
dashboard\primary\success("Successfully deleted variable");
}
else {
dashboard\primary\error("Failed to delete variable");
}
}
// edit modal
if (isset($_POST['editvar'])) {
$varId = misc\etc\sanitize($_POST['editvar']);
$query = misc\mysql\query("SELECT * FROM `uservars` WHERE `id` = ? AND `app` = ?",[$varId, $_SESSION['app']]);
if ($query->num_rows < 1) {
dashboard\primary\error("Variable not Found!");
echo "<meta http-equiv='Refresh' Content='2'>";
return;
}
$row = mysqli_fetch_array($query->result);
$data = $row["data"];
$readOnly = $row["readOnly"];
echo '
<div id="edit-variable-modal" tabindex="-1" aria-hidden="true"
class="fixed grid place-items-center h-screen bg-black bg-opacity-60 z-50 p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Edit Variable</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<label for="data" name="data"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">
Variable Data</label>
<textarea id="data" name="data" rows="4"
class="block p-2.5 w-full text-sm text-white-900 bg-[#0f0f17] rounded-lg border border-gray-700 focus:ring-blue-500 focus:border-blue-500"
placeholder="" maxlength="1000" required>' . $data . '</textarea>
</div>
</div>
<div class="flex items-center mb-4">
<input id="readOnly" name="readOnly" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
' . ($readOnly ? "checked" : "") . '>
<label for="readOnly"
class="ml-2 text-sm font-medium text-white-900">Read only</label>
</div>
<button name="savevar" value="' . $varId . '"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Save
Changes</button>
<button
class="w-full text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center" onClick="window.location.href=window.location.href">Cancel
</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Edit Var Modal -->';
}
if (isset($_POST['savevar'])) {
$readOnly = misc\etc\sanitize($_POST['readOnly']) == NULL ? 0 : 1;
$varData = misc\etc\sanitize($_POST['data']);
$varId = misc\etc\sanitize($_POST['savevar']);
if(strlen($varData) > 500) {
dashboard\primary\error("Variable too long! Must be 500 characters or less");
echo "<meta http-equiv='Refresh' Content='2'>";
return;
}
misc\mysql\query("UPDATE `uservars` SET `data` = ?, `readOnly` = ? WHERE `id` = ? AND `app` = ?", [$varData, $readOnly, $varId, $_SESSION['app']]);
if ($query->affected_rows > 0) {
dashboard\primary\success("Successfully edited variable");
}
else {
dashboard\primary\error("Failed to edit variable");
}
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl ">User Variables</h1>
<p class="text-xs text-gray-500">Pass, assign, obtain data uniquely for each user. <a
href="https://keyauthdocs.apidog.io/sellerapi/users/retrive-user-variable-data" target="_blank"
class="text-blue-600 hover:underline">Learn More</a>.</p>
<br>
<div class="overflow-x-auto">
<!-- Alert Box -->
<div id="alert-4" class="flex items-center p-4 mb-4 text-yellow-800 rounded-lg bg-[#09090d]"
role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<span class="sr-only">Info</span>
<div class="ml-3 text-sm font-medium text-yellow-500">
These are user variables. You must use getvar() and setvar() functions in the examples to access these.
</div>
</div>
<!-- End Alert Box -->
<!-- User Variable Functions -->
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="set-user-var-modal" data-modal-target="set-user-var-modal">
<i class="lni lni-circle-plus mr-2 mt-1"></i>Set User Variable
</button>
<!-- End User Variable Functions -->
<br>
<!-- Delete User Variable Functions -->
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-vars-modal" data-modal-target="delete-all-vars-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Variables
</button>
<!-- End Delete User Variable Functions -->
<!-- Set User Var Modal -->
<div id="set-user-var-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Set User Variable</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="user" name="user"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder="Type username here" placeholder=" " autocomplete="on">
<label for="user"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">User</label>
</div>
<div class="relative mb-4">
<input type="text" id="var" name="var"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder="" autocomplete="on" list="vars" required>
<datalist id="vars">
<?php
$query = misc\mysql\query("SELECT DISTINCT `name` FROM `uservars` WHERE `app` = ?", [$_SESSION['app']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)) {
echo " <option value=\"" . $row["name"] . "\">" . $row["name"] . "</option>";
}
}
?>
</datalist>
<label for="var"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Variable</label>
</div>
<div class="relative mb-4">
<label for="data" name="data"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">User
Variable Data</label>
<textarea id="data" name="data" rows="4"
class="block p-2.5 w-full text-sm text-white-900 bg-[#0f0f17] rounded-lg border border-gray-700 focus:ring-blue-500 focus:border-blue-500"
placeholder="" maxlength="500" required></textarea>
</div>
</div>
<div class="flex items-center mb-4">
<input id="readOnly" name="readOnly" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
checked>
<label for="readOnly"
class="ml-2 text-sm font-medium text-white-900">Readonly</label>
</div>
<button name="setvar"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Set
User Var</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Set User Var Modal -->
<!-- Delete All Vars Modal -->
<div id="delete-all-vars-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to delete all of your
user variables. This can not be undone.
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
all of your user variables?</h3>
<form method="POST">
<button data-modal-hide="delete-all-vars-modal" name="delvars"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-vars-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Vars Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_user_vars" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Variable Name</th>
<th class="px-6 py-3">Variable Data</th>
<th class="px-6 py-3">Username</th>
<th class="px-6 py-3">Read Only</th>
<th class="px-6 py-3">Actions</th>
</tr>
</thead>
</table>
</div>
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a
class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>
<script>
// Target the specific scrollable container
let scrollableElement = document.querySelector('.relative.overflow-x-auto.shadow-md.sm\\:rounded-lg.pt-5');
// Function to scroll to the bottom of the element
function scrollToBottom(el) {
el.scrollTop = el.scrollHeight;
}
// Monitor clicks on the "Actions" button and apply a delay before checking scroll position
document.querySelectorAll('#kt_datatable_user_vars button[type="button"]').forEach(function(button) {
button.addEventListener('click', function() {
// Wait for a second to account for any DOM updates or animations
setTimeout(() => {
// Check if the current scroll position is not at the bottom after updates
if (scrollableElement.scrollHeight - scrollableElement.clientHeight > scrollableElement.scrollTop) {
scrollToBottom(scrollableElement);
}
}, 1000); // Adjust this delay as necessary
});
});
</script>

1210
app/pages/users.php Normal file

File diff suppressed because it is too large Load Diff

279
app/pages/vars.php Normal file
View File

@@ -0,0 +1,279 @@
<?php
if ($_SESSION['role'] == "Reseller") {
header("location: ./?page=reseller-licenses");
die();
}
if($role == "Manager" && !($permissions & 128)) {
misc\auditLog\send("Attempted (and failed) to view vars.");
dashboard\primary\error("You weren't granted permission to view this page!");
die();
}
if(!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
if (isset($_POST['genvar'])) {
if ($_SESSION['role'] == "tester") {
if(strlen($_POST['vardata']) > 100) {
dashboard\primary\error("Must upgrade to developer or seller to create variables longer than 100 characters!");
echo "<meta http-equiv='Refresh' Content='2'>";
return;
}
$query = misc\mysql\query("SELECT count(*) AS 'numVars' FROM `vars` WHERE `app` = ?",[$_SESSION['app']]);
$row = mysqli_fetch_array($query->result);
$numVars = $row["numVars"];
if($numVars >= 5) {
dashboard\primary\error("Must upgrade to developer or seller to create more than 5 variables!");
echo "<meta http-equiv='Refresh' Content='2'>";
return;
}
}
$authed = misc\etc\sanitize($_POST['authed']) == NULL ? 0 : 1;
$resp = misc\variable\add($_POST['varname'], $_POST['vardata'], $authed);
match($resp){
'exists' => dashboard\primary\error("Variable name already exists!"),
'too_long' => dashboard\primary\error("Variable too long! Must be 1000 characters or less"),
'failure' => dashboard\primary\error("Failed to create variable"),
'success' => dashboard\primary\success("Successfully created variable"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['delvars'])) {
$resp = misc\variable\deleteAll();
match($resp){
'failure' => dashboard\primary\error("Failed to delete all variables"),
'success' => dashboard\primary\success("Successfully deleted all variables"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['deletevar'])) {
$resp = misc\variable\deleteSingular($_POST['deletevar']);
match($resp){
'failure' => dashboard\primary\error("Failed to delete variable"),
'success' => dashboard\primary\success("Successfully deleted variable"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
// edit modal
if (isset($_POST['editvar'])) {
$variable = misc\etc\sanitize($_POST['editvar']);
$query = misc\mysql\query("SELECT * FROM `vars` WHERE `varid` = ? AND `app` = ?",[$variable, $_SESSION['app']]);
if ($query->num_rows < 1) {
dashboard\primary\error("Variable not Found!");
echo "<meta http-equiv='Refresh' Content='2'>";
return;
}
$row = mysqli_fetch_array($query->result);
$data = $row["msg"];
$authed = $row["authed"];
echo '
<div id="edit-variable-modal" tabindex="-1" aria-hidden="true"
class="fixed grid place-items-center h-screen bg-black bg-opacity-60 z-50 p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Edit Variable</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<label for="msg" name="msg"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">
Variable Data</label>
<textarea id="msg" name="msg" rows="4"
class="block p-2.5 w-full text-sm text-white-900 bg-[#0f0f17] rounded-lg border border-gray-700 focus:ring-blue-500 focus:border-blue-500"
placeholder="" maxlength="1000" required>' . $data . '</textarea>
<input type="hidden" name="variable" value="' . $variable . '">
</div>
</div>
<div class="flex items-center mb-4">
<input id="authed" name="authed" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
' . ($authed ? "checked" : "") . '>
<label for="authed"
class="ml-2 text-sm font-medium text-white-900">Authenticated</label>
</div>
<button name="savevar"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Save
Changes</button>
<button
class="w-full text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center" onClick="window.location.href=window.location.href">Cancel
</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Edit Var Modal -->';
}
if (isset($_POST['savevar'])) {
$authed = misc\etc\sanitize($_POST['authed']) == NULL ? 0 : 1;
$resp = misc\variable\edit($_POST['variable'], $_POST['msg'], $authed);
switch ($resp) {
case 'success':
misc\cache\purge('KeyAuthVar:' . $_SESSION['app'] . ':' . $_POST['variable']);
dashboard\primary\success("Successfully edited variable!");
break;
}
match($resp){
'failure' => dashboard\primary\error("Failed to edit variable!"),
'too_long' => dashboard\primary\error("Variable too long! Must be 1000 characters or less"),
'success' => dashboard\primary\success("Successfully edited variable!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl ">Global Variables</h1>
<p class="text-xs text-gray-500">Pass, assign, obtain data globally. <a
href="https://keyauthdocs.apidog.io/api/features/retrieve-global-variable" target="_blank"
class="text-blue-600 hover:underline">Learn More</a>.</p>
<br>
<div class="overflow-x-auto">
<!-- Alert Box -->
<div id="alert-4" class="flex items-center p-4 mb-4 text-yellow-800 rounded-lg bg-[#09090d]"
role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<span class="sr-only">Info</span>
<div class="ml-3 text-sm font-medium text-yellow-500">
These are global variables. You must use 'var()', not get/setvar()(aka user variables). Please
view our <a href="https://keyauthdocs.apidog.io/api/features/retrieve-global-variable"
class="font-semibold underline hover:no-underline">Documentation</a> to learn how to use
global variables.
</div>
</div>
<!-- End Alert Box -->
<!-- Global Variable Functions -->
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="set-global-var-modal" data-modal-target="set-global-var-modal">
<i class="lni lni-circle-plus mr-2 mt-1"></i>Create Global Variable
</button>
<!-- End Global Variable Functions -->
<br>
<!-- Delete Global Variable Functions -->
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-vars-modal" data-modal-target="delete-all-vars-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Variables
</button>
<!-- End Delete Global Variable Functions -->
<!-- Set Global Var Modal -->
<div id="set-global-var-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Set Global Variable</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="varname" name="varname"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<label for="varname"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Variable
Name</label>
</div>
<div class="relative mb-4">
<label for="vardata" name="vardata"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">
Variable Data</label>
<textarea id="vardata" name="vardata" rows="4"
class="block p-2.5 w-full text-sm text-white-900 bg-[#0f0f17] rounded-lg border border-gray-700 focus:ring-blue-500 focus:border-blue-500"
placeholder="" maxlength="1000" required></textarea>
</div>
</div>
<div class="flex items-center mb-4">
<input id="authed" name="authed" type="checkbox"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2"
checked>
<label for="authed"
class="ml-2 text-sm font-medium text-white-900">Authenticated</label>
</div>
<button name="genvar"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Set
Global Var</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Create Global Var Modal -->
<!-- Delete All Vars Modal -->
<div id="delete-all-vars-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to delete all of your
global variables. This can not be undone.
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
all of your global variables?</h3>
<form method="POST">
<button data-modal-hide="delete-all-vars-modal" name="delvars"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-vars-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Vars Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_vars" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Variable Name</th>
<th class="px-6 py-3">Variable Data</th>
<th class="px-6 py-3">Authenticated</th>
<th class="px-6 py-3">Actions</th>
</tr>
</thead>
</table>
</div>
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a
class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>

407
app/pages/webhooks.php Normal file
View File

@@ -0,0 +1,407 @@
<?php
if ($_SESSION['role'] == "Reseller") {
header("location: ./?page=reseller-licenses");
die();
}
if($role == "Manager" && !($permissions & 32)) {
misc\auditLog\send("Attempted (and failed) to view webhooks.");
dashboard\primary\error("You weren't granted permission to view this page.");
die();
}
if(!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
if (isset($_POST['genwebhook'])) {
if ($_SESSION['role'] == "tester") {
dashboard\primary\error("You must upgrade to developer or seller to use webhooks!");
} else {
$authed = misc\etc\sanitize($_POST['authed']) == NULL ? 0 : 1;
$resp = misc\webhook\add($_POST['webhookname'], $_POST['baselink'], $_POST['useragent'], $authed);
match($resp){
'invalid_url' => dashboard\primary\error("URL isn't a valid URL"),
'no_local' => dashboard\primary\error("URL can't be a local path! Must be a remote URL accessible by the open internet!"),
'failure' => dashboard\primary\error("Failed to add webhook!"),
'success' => dashboard\primary\success("Successfully added webhook!"),
'empty_webhookname' => dashboard\primary\error("Wehbook name can not be empty!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
}
if (isset($_POST['deletewebhook'])) {
$resp = misc\webhook\deleteSingular($_POST['deletewebhook']);
match($resp){
'failure' => dashboard\primary\error("Failed to delete webhook!"),
'success' => dashboard\primary\success("Successfully deleted webhook!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['delallwebhooks'])){
$resp = misc\webhook\deleteAll();
match($resp){
'failure' => dashboard\primary\error("Failed to delete all webhooks!"),
'success' => dashboard\primary\success("Successfully deleted all webhooks!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['editwebhook'])) {
$webhook = misc\etc\sanitize($_POST['editwebhook']);
$query = misc\mysql\query("SELECT * FROM `webhooks` WHERE `webid` = ? AND `app` = ?",[$webhook, $_SESSION['app']]);
if ($query->num_rows < 1) {
dashboard\primary\error("Webhook not Found!");
echo "<meta http-equiv='Refresh' Content='2'>";
return;
}
$row = mysqli_fetch_array($query->result);
$baselink = $row["baselink"];
$useragent = $row["useragent"];
echo '
<div id="edit-webhook-modal" tabindex="-1" aria-hidden="true"
class="fixed grid place-items-center h-screen bg-black bg-opacity-60 z-50 p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Edit Webhook</h3>
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="baselink" name="baselink"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="' . $baselink . '" required>
<label for="baselink"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Base URL:</label>
<input type="hidden" name="webhook" value="' . $webhook . '">
</div>
<div class="relative mb-4">
<input type="text" id="useragent" name="useragent"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" value="' . $useragent . '" required>
<label for="useragent"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">User-Agent:</label>
</div>
</div>
<button name="savewebhook"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center" value="' . $file . '">Save
Changes</button>
<button
class="w-full text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center" onClick="window.location.href=window.location.href">Cancel
</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Edit Account Modal -->';
}
if (isset($_POST['savewebhook'])) {
$webhook = misc\etc\sanitize($_POST['webhook']);
$baselink = misc\etc\sanitize($_POST['baselink']);
$useragent = misc\etc\sanitize($_POST['useragent']);
if (!filter_var($baselink, FILTER_VALIDATE_URL)) {
dashboard\primary\error("URL isn't a valid URL");
echo "<meta http-equiv='Refresh' Content='2'>";
return;
}
if(str_contains($baselink, "localhost") || str_contains($baselink, "127.0.0.1")) {
dashboard\primary\error("URL can't be a local path! Must be a remote URL accessible by the open internet");
echo "<meta http-equiv='Refresh' Content='2'>";
return;
}
misc\mysql\query("UPDATE `webhooks` SET `baselink` = ?,`useragent` = ? WHERE `webid` = ? AND `app` = ?",[$baselink, $useragent, $webhook, $_SESSION['app']]);
dashboard\primary\success("Successfully Updated Settings!");
misc\cache\purge('KeyAuthWebhook:' . $_SESSION['app'] . ':' . $webhook);
}
if (isset($_POST["selected"]) && isset($_POST["action"])) {
$selected = json_decode($_POST["selected"]);
if ($_POST["action"] == "delete") {
foreach ($selected as $webhook) {
$resp = misc\webhook\deleteSingular($webhook);
match($resp){
'failure' => dashboard\primary\error("Failed to delete webhook!"),
'success' => dashboard\primary\success("Successfully deleted webhook!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
}
else if ($_POST["action"] == "authEnable") {
foreach ($selected as $value) {
$query = misc\mysql\query("UPDATE `webhooks` SET `authed` = 1 WHERE `app` = ? AND `webid` = ?", [$_SESSION['app'], $value]);
if ($query->affected_rows != 0) {
misc\cache\purge('KeyAuthFile:' . ($secret ?? $_SESSION['app']) . ':' . $fileid);
dashboard\primary\success("Successfully updated webhooks!");
} else {
dashboard\primary\error("Failed to update webhooks");
}
}
}
else if ($_POST["action"] == "authDisable") {
foreach ($selected as $value) {
$query = misc\mysql\query("UPDATE `webhooks` SET `authed` = 0 WHERE `app` = ? AND `webid` = ?", [$_SESSION['app'], $value]);
if ($query->affected_rows != 0) {
misc\cache\purge('KeyAuthFile:' . ($secret ?? $_SESSION['app']) . ':' . $fileid);
dashboard\primary\success("Successfully updated webhooks!");
} else {
dashboard\primary\error("Failed to update webhooks");
}
}
}
else {
dashboard\primary\error("Invalid action");
}
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl ">Webhooks</h1>
<p class="text-xs text-gray-500">Send and receive secure requests. <a
href="https://keyauthdocs.apidog.io/api/features/webhook" target="_blank"
class="text-blue-600 hover:underline">Learn More</a>.</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Alert Box -->
<div id="alert-4" class="flex items-center p-4 mb-4 text-yellow-800 rounded-lg bg-[#09090d]"
role="alert">
<svg class="flex-shrink-0 w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
</svg>
<span class="sr-only">Info</span>
<div class="ml-3 text-sm font-medium text-yellow-500">
People often this mistake this for Discord webhooks. Please view our <a
href="https://keyauthdocs.apidog.io/api/features/webhook"
class="font-semibold underline hover:no-underline">Documentation</a> to learn how to
send Discord webhooks.
</div>
</div>
<!-- End Alert Box -->
<!-- Webhooks Functions -->
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="create-webhook-modal" data-modal-target="create-webhook-modal">
<i class="lni lni-circle-plus mr-2 mt-1"></i>Create Webhook
</button>
<!-- End Webhooks Functions -->
<br>
<!-- Delete Webhooks Functions -->
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-webhooks-modal" data-modal-target="delete-all-webhooks-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Webhooks
</button>
<button id="dropdownselection" data-dropdown-toggle="webhookdropdown"
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200 hidden"
type="button">Selection Options
</button>
<div id="webhookdropdown" class="z-10 hidden bg-[#09090d] divide-y divide-gray-100 rounded-lg shadow w-44">
<ul class="py-2 text-sm text-white">
<li>
<form method="post">
<input type="hidden" name="action" value="delete">
<input type="hidden" id="selected" name="selected">
<a href="#" onclick="this.parentNode.submit();" class="block px-4 py-2 focus:bold ml-2 hover:text-red-700">Delete Selected</a>
</form>
</li>
<li>
<form method="post">
<input type="hidden" name="action" value="authEnable">
<input type="hidden" id="selected" name="selected">
<a href="#" onclick="this.parentNode.submit();" class="block px-4 py-2 focus:bold ml-2 hover:text-red-700">Turn on authenticated</a>
</form>
</li>
<li>
<form method="post">
<input type="hidden" name="action" value="authDisable">
<input type="hidden" id="selected" name="selected">
<a href="#" onclick="this.parentNode.submit();" class="block px-4 py-2 focus:bold ml-2 hover:text-red-700">Turn off authenticated</a>
</form>
</li>
</ul>
</div>
<!-- End Delete Webhooks Functions -->
<!-- Create Create A Webhook Modal -->
<div id="create-webhook-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-blue-700 shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Generate A Webhook</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="webhookname" name="webhookname"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on">
<label for="webhookname"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Webhook
Name (optional)</label>
</div>
<div class="relative mb-4">
<input type="text" id="baselink" name="baselink"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<label for="baselink"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Webhook
Endpoint</label>
</div>
<div class="relative mb-4">
<input type="text" id="useragent" name="useragent"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on">
<label for="useragent"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">User
Agent (Default is KeyAuth)</label>
</div>
<div class="flex items-center">
<input checked id="authed" type="checkbox" name="authed"
class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 focus:ring-2 ">
<label for="authed"
class="ml-2 text-sm font-medium text-white-900 ">Authenticated</label>
</div>
</div>
<button type="submit" name="genwebhook"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Generate
Webhook</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Create A Webhook Modal -->
<!-- Delete All Webhooks Modal -->
<div id="delete-all-webhooks-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to delete all of your
webhooks. This can not be undone.
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
all of your webhooks?</h3>
<form method="POST">
<button data-modal-hide="delete-all-webhooks-modal" name="delallwebhooks"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-webhooks-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Webhooks Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_webhooks" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Select</th>
<th class="px-6 py-3">ID</th>
<th class="px-6 py-3">Endpoint</th>
<th class="px-6 py-3">User-Agent</th>
<th class="px-6 py-3">Authenticated</th>
<th class="px-6 py-3">Actions</th>
</tr>
</thead>
<tbody>
<?php
if ($_SESSION['app']) {
$query = misc\mysql\query("SELECT * FROM `webhooks` WHERE `app` = ?",[$_SESSION['app']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)) {
echo "<tr>";
echo '<td> <input type="checkbox" style="outline:none;"class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 checkbox" value="' . $row["webid"] .'">' . '</td>';
echo " <td>" . $row["webid"] . "</td>";
echo " <td><span class=\"blur-sm hover:blur-none\">" . $row["baselink"] . "</span></td>";
echo " <td>" . $row["useragent"] . "</td>";
echo " <td>" . (($row["authed"] ? 1 : 0) ? 'True' : 'False') . "</td>";
echo '<form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true" class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4" type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" style="margin-top:3px">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false" class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1" style="min-width:15rem">
<li>
<button name="deletewebhook" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row["webid"] . '">
Delete Webhook
</button>
</li>
<li>
<button name="editwebhook" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
value="' . $row["webid"] . '">
Edit Webhook
</button>
</li>
</ul>
</div>
</tr>
</td>
</form>';
}
}
}
?>
</tbody>
</table>
</div>
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a
class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>

219
app/pages/webloader.php Normal file
View File

@@ -0,0 +1,219 @@
<?php
if ($_SESSION['role'] != "seller") {
misc\auditLog\send("Attempted (and failed) to view webloader.");
dashboard\primary\error("Non-Sellers aren't allowed here.");
die();
}
if(!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
if (isset($_POST['addButton'])) {
$resp = misc\button\addButton($_POST['text'], $_POST['value']);
match($resp){
'success' => dashboard\primary\success("Successfully added button!"),
'failure' => dashboard\primary\error("Failed to add button!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['delButton'])) {
$resp = misc\button\deleteButton($_POST['delButton']);
match($resp){
'success' => dashboard\primary\success("Successfully deleted button!"),
'failure' => dashboard\primary\error("Failed to delete button!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST["selected"]) && isset($_POST["action"])) {
$selected = json_decode($_POST["selected"]);
if ($_POST["action"] == "delete"){
foreach ($selected as $buttons){
$resp = misc\button\deleteButton($buttons);
match($resp){
'success' => dashboard\primary\success("Successfully deleted button!"),
'failure' => dashboard\primary\error("Failed to delete button!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
} else {
dashboard\primary\error("Invalid action!");
}
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl ">Web Loader</h1>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Webloader Functions -->
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="create-button-modal" data-modal-target="create-button-modal">
<i class="lni lni-circle-plus mr-2 mt-1"></i>Create Button
</button>
<br>
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-buttons-modal" data-modal-target="delete-all-buttons-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Buttons
</button>
<button id="dropdownselection" data-dropdown-toggle="webloaderdropdown"
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200 hidden"
type="button">Selection Options
</button>
<div id="webloaderdropdown" class="z-10 hidden bg-[#09090d] divide-y divide-gray-100 rounded-lg shadow w-44">
<ul class="py-2 text-sm text-white">
<li>
<form method="post">
<input type="hidden" name="action" value="delete">
<input type="hidden" id="selected" name="selected">
<a href="#" onclick="this.parentNode.submit();" class="block px-4 py-2 focus:bold ml-2 hover:text-red-700">Delete Selected</a>
</form>
</li>
</ul>
</div>
<!-- End Webloader Functions -->
<!-- Create Button Modal -->
<div id="create-button-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<button type="button"
class="absolute top-3 right-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ml-auto inline-flex justify-center items-center"
data-modal-hide="create-button-modal">
<span class="sr-only">Close modal</span>
</button>
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Create Webloader Button</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="text" name="text"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<label for="text"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Name
</label>
</div>
<div class="relative mb-4">
<input type="text" id="value" name="value"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on" required>
<label for="value"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">Value</label>
</div>
</div>
<button type="submit" name="addButton"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Create
Webloader Button</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Create Button Modal -->
<!-- Delete All Buttons Modal -->
<div id="delete-all-buttons-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to delete all of
your webloader buttons. <b>This can
NOT be undone</b>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure
you want
to
delete your webloader buttons?</h3>
<form method="POST">
<button data-modal-hide="delete-all-buttons-modal" name="delallbuttons"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-buttons-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Buttons Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_webloader" class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">Select</th>
<th class="px-6 py-3">Button Text</th>
<th class="px-6 py-3">Button Value</th>
<th class="px-6 py-3">Actions</th>
</tr>
</thead>
<tbody>
<?php
if ($_SESSION['app']) {
$query = misc\mysql\query("SELECT * FROM `buttons` WHERE `app` = ?",[$_SESSION['app']]);
if ($query->num_rows > 0) {
while ($row = mysqli_fetch_array($query->result)) {
echo "<tr>";
echo '<td> <input type="checkbox" style="outline:none;"class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 checkbox" value="' . $row["value"] .'">' . '</td>';
echo " <td>" . $row["text"] . "</td>";
echo " <td>" . $row["value"] . "</td>";
echo '<form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true" class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4" type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" style="margin-top:3px">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false" class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1" style="min-width:15rem">
<li>
<button name="delButton" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row["value"] . '">
Delete Button
</button>
</li>
</ul>
</div>
</td></tr></form>';
}
}
}
?>
</tbody>
</table>
</div>
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a
class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>

144
app/pages/whitelists.php Normal file
View File

@@ -0,0 +1,144 @@
<?php
if ($_SESSION['role'] == "Reseller") {
header("location: ./?page=reseller-licenses");
die();
}
if ($role == "Manager" && !($permissions & 4096)) {
misc\auditLog\send("Attempted (and failed) to view whitelists.");
dashboard\primary\error("You weren't granted permission to view this page!");
die();
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("Application not selected");
die("Application not selected.");
}
if (isset($_POST['addwhite'])) {
$resp = misc\whitelist\addWhite($_POST['ip']);
match($resp){
'failure' => dashboard\primary\error("Failed to add whitelist"),
'success' => dashboard\primary\success("Successfully added whitelist"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['deletewhite'])){
$resp = misc\whitelist\deleteWhite($_POST['deletewhite']);
match($resp){
'failure' => dashboard\primary\error("Failed to delete whitelist"),
'success' => dashboard\primary\success("Successfully deleted whitelist"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (isset($_POST['delallwhites'])) {
$resp = misc\whitelist\deleteAll();
match($resp){
'failure' => dashboard\primary\error("Failed to delete all whitelists!"),
'success' => dashboard\primary\success("Successfully deleted all whitelists!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
?>
<div class="p-4 bg-[#09090d] block sm:flex items-center justify-between lg:mt-1.5">
<div class="mb-1 w-full bg-[#0f0f17] rounded-xl">
<div class="mb-4 p-4">
<?php require '../app/layout/breadcrumb.php'; ?>
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">Whitelists</h1>
<p class="text-xs text-gray-500">Allow access from certain IPs <a
href="https://keyauthdocs.apidog.io/sellerapi/whitelists/add-ip-to-whitelist" target="_blank"
class="text-blue-600 hover:underline">Learn More</a>.</p>
<br>
<div class="p-4 flex flex-col">
<div class="overflow-x-auto">
<!-- Whitelists Functions -->
<button
class="inline-flex text-white bg-blue-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="add-whitelist-modal" data-modal-target="add-whitelist-modal">
<i class="lni lni-circle-plus mr-2 mt-1"></i>Create Whitelist
</button>
<!-- End Whitelists Functions -->
<br>
<!-- Delete Whitelists Functions -->
<button
class="inline-flex text-white bg-red-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200"
data-modal-toggle="delete-all-whitelists-modal" data-modal-target="delete-all-whitelists-modal">
<i class="lni lni-trash-can mr-2 mt-1"></i>Delete All Whitelists
</button>
<!-- End Delete Blacklists Functions -->
<!-- Add To Whitelist Modal -->
<div id="add-whitelist-modal" tabindex="-1" aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<!-- Modal content -->
<div class="relative bg-[#0f0f17] rounded-lg border border-[#1d4ed8] shadow">
<div class="px-6 py-6 lg:px-8">
<h3 class="mb-4 text-xl font-medium text-white-900">Add Whitelist</h3>
<hr class="h-px mb-4 mt-4 bg-gray-700 border-0">
<form class="space-y-6" method="POST">
<div>
<div class="relative mb-4">
<input type="text" id="ip" name="ip"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-gray-700 appearance-none focus:ring-0 peer"
placeholder="" autocomplete="on" required>
<label for="ip"
class="absolute text-sm text-gray-400 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-[#0f0f17] px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 left-1">IP
</label>
</div>
</div>
<button type="submit" name="addwhite"
class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Whitelist</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Add Whitelist Modal -->
<!-- Delete All Whitelists Modal -->
<div id="delete-all-whitelists-modal" tabindex="-1"
class="fixed top-0 left-0 right-0 z-50 hidden p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-md max-h-full">
<div class="relative bg-[#0f0f17] border border-red-700 rounded-lg shadow">
<div class="p-6 text-center">
<div class="flex items-center p-4 mb-4 text-sm text-white border border-yellow-500 rounded-lg bg-[#0f0f17]"
role="alert">
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Notice!</span> You're about to delete all of your
Whitelists. Are you sure you want to continue?
</b>
</div>
</div>
<h3 class="mb-5 text-lg font-normal text-gray-200">Are you sure you want to delete
all of your Whitelists? This can not be undone.</h3>
<form method="POST">
<button data-modal-hide="delete-all-whitelists-modal" name="delallwhites"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Yes, I'm sure
</button>
<button data-modal-hide="delete-all-whitelists-modal" type="button"
class="inline-flex text-white bg-gray-700 hover:opacity-60 focus:ring-0 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 transition duration-200">No,
cancel</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Delete All Whitelists Modal -->
<!-- START TABLE -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg pt-5">
<table id="kt_datatable_whitelists"
class="w-full text-sm text-left text-white">
<thead>
<tr class="fw-bolder fs-6 text-blue-700 px-7">
<th class="px-6 py-3">IP</th>
<th class="px-6 py-3">Actions</th>
</tr>
</thead>
</table>
</div>
<p class="text-xs text-red-600">Dropdown actions in <b>RED</b> do not show a confirmation!<a class="text-blue-700"> Dropdown actions in <b>BLUE</b> will show a confirmation!</a></p>

View File

@@ -0,0 +1,127 @@
<?php
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);
global $databaseUsername;
$errorMsg = str_replace($databaseUsername, "REDACTED", $exception->getMessage());
die("Error: " . $errorMsg);
});
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("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
## Total number of records without filtering
$sel = misc\mysql\query("select count(1) as allcount from `keys` where app = ? and genby = ?", [$_SESSION['app'], $_SESSION['username']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecords = $records['allcount'];
$totalRecordwithFilter = $totalRecords;
if (!is_null($searchValue)) { // don't double query if no search value was provided
## Total number of record with filtering
$sel = misc\mysql\query("select count(1) as allcount from `keys` WHERE 1 and (`key` like ? or `note` like ? or `usedby` like ? ) and app = ? and genby = ?", ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app'], $_SESSION['username']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecordwithFilter = $records['allcount'];
}
// whitelist certain column names and sort orders to prevent SQL injection
if (!in_array($columnName, array("key", "gendate", "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 `usedby` like ? ) and app = ? and genby = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app'], $_SESSION['username']]);
}
else {
$query = misc\mysql\query("select * from `keys` WHERE app = ? and genby = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, [$_SESSION['app'], $_SESSION['username']]);
}
$data = array();
while ($row = mysqli_fetch_assoc($query->result)) {
$data[] = array(
"key" => $row['key'],
"gendate" => '<div id="' . $row['key'] . '-gendate"><script>document.getElementById("' . $row['key'] . '-gendate").textContent=convertTimestamp(' . $row["gendate"] . ');</script></div>',
"expires" => ($row["expires"] / 86400) . ' Day(s)',
"note" => $row['note'] ?? 'N/A',
"usedon" => (!is_null($row["usedon"])) ? '<div id="' . $row['key'] . '-usedon"><script>document.getElementById("' . $row['key'] . '-usedon").textContent=convertTimestamp(' . $row["usedon"] . ');</script></div>' : 'N/A',
"usedby" => ($row["usedby"] == $row['key']) ? 'Same as key' : $row["usedby"] ?? 'N/A',
"status" => '<label class="' . (($row['status'] == "Not Used") ? 'badge badge-light-success' : 'badge badge-light-danger') . '">' . $row['status'] . '</label>',
"actions" => '
<form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true" class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4" type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" style="margin-top:3px">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false" class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1" style="min-width:15rem">
<li>
<button type="button" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
onclick="delkey(\'' . $row["key"] . '\')">
Delete Key
</button>
</li>
<li>
<button type="button" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
onclick="bankey(\'' . $row["key"] . '\')">
Ban Key
</button>
</li>
<li>
<button class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
name="unbankey" value="' . $row['key'] . '">
Unban Key
</button>
</li>
</ul>
</div>
</td>
</tr>
</form>',
);
}
## Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data
);
die(json_encode($response));
}
die("Request not from datatables, aborted.");

143
app/reseller-user-fetch.php Normal file
View File

@@ -0,0 +1,143 @@
<?php
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);
global $databaseUsername;
$errorMsg = str_replace($databaseUsername, "REDACTED", $exception->getMessage());
die("Error: " . $errorMsg);
});
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("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
## Total number of records without filtering
$sel = misc\mysql\query("select count(1) as allcount from `users` where app = ? and owner = ?", [$_SESSION['app'], $_SESSION['username']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecords = $records['allcount'];
$totalRecordwithFilter = $totalRecords;
if (!is_null($searchValue)) { // don't double query if no search value was provided
## Total number of record with filtering
$sel = misc\mysql\query("select count(1) as allcount from `users` WHERE 1 and (`username` like ? or `hwid` like ? or `ip` like ? or `banned` like ? ) and app = ? and owner = ?", ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app'], $_SESSION['username']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecordwithFilter = $records['allcount'];
}
// whitelist certain column names and sort orders to prevent SQL injection
if (!in_array($columnName, array("username", "hwid", "ip", "createdate", "lastlogin", "banned"))) {
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 `users` WHERE (`username` like ? or `hwid` like ? or `ip` like ? or `banned` like ? ) and app = ? and owner = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app'], $_SESSION['username']]);
}
else {
$query = misc\mysql\query("select * from `users` WHERE app = ? and owner = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, [$_SESSION['app'], $_SESSION['username']]);
}
$data = array();
while ($row = mysqli_fetch_assoc($query->result)) {
## Add Extra Margin to buttons if value is 1 or 2, because datatables with ajax breaks it.
$MarginManager = "";
if ($query->num_rows < 2) {
$MarginManager = "margin-bottom: 80;";
} else {
$MarginManager = "margin-bottom: 0px;";
}
$data[] = array(
"username" => $row['username'],
"hwid" => $_SESSION['role'] == "Reseller" ? "REDACTED" : '<span class="blur-sm hover:blur-none">' . ($row['hwid'] ?? 'N/A') . '</span>',
"ip" => $_SESSION['role'] == "Reseller" ? "REDACTED" : '<span class="blur-sm hover:blur-none">' . ($row['ip'] ?? 'N/A') . '</span>',
"createdate" => '<div id="' . $row['username'] . '-createdate"><script>document.getElementById("' . $row['username'] . '-createdate").textContent=convertTimestamp(' . $row["createdate"] . ');</script></div>',
"lastlogin" => '<div id="' . $row['username'] . '-lastlogin"><script>document.getElementById("' . $row['username'] . '-lastlogin").textContent=convertTimestamp(' . $row["lastlogin"] . ');</script></div>',
"banned" => $row['banned'] ?? 'N/A',
"actions" => '
<form method="POST" style="' . $MarginManager . '">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true" class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4" type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" style="margin-top:3px">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false" class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1" style="min-width:15rem">
<li>
<button name="deleteuser" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
value="' . $row["username"] . '">
Delete User
</button>
</li>
<li>
<button name="resetuser" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row["username"] . '">
Reset User
</button>
</li>
<li>
<button type="button" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
onclick="banuser(\'' . $row["username"] . '\')">
Ban User
</button>
</li>
<li>
<button name="edituser" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
value="' . $row['username'] . '">
Edit User
</button>
</li>
</ul>
</div>
</td></tr></form>',
);
}
## Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data
);
die(json_encode($response));
}
die("Request not from datatables, aborted.");

118
app/session-fetch.php Normal file
View File

@@ -0,0 +1,118 @@
<?php
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);
global $databaseUsername;
$errorMsg = str_replace($databaseUsername, "REDACTED", $exception->getMessage());
die("Error: " . $errorMsg);
});
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if ($_SESSION['role'] == "Reseller") {
die("Resellers can't access this.");
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("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
## Total number of records without filtering
$sel = misc\mysql\query("select count(1) as allcount from `sessions` where app = ?", [$_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecords = $records['allcount'];
$totalRecordwithFilter = $totalRecords;
if (!is_null($searchValue)) { // don't double query if no search value was provided
## Total number of record with filtering
$sel = misc\mysql\query("select count(1) as allcount from `sessions` WHERE 1 and (`id` like ? or `credential` like ? or `ip` like ? ) and app = ?", ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecordwithFilter = $records['allcount'];
}
// whitelist certain column names and sort orders to prevent SQL injection
if (!in_array($columnName, array("id", "credential", "expiry", "validated", "ip"))) {
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 `sessions` WHERE (`id` like ? or `credential` like ? or `ip` like ? ) and app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
}
else {
$query = misc\mysql\query("select * from `sessions` WHERE app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, [$_SESSION['app']]);
}
$data = array();
while ($row = mysqli_fetch_assoc($query->result)) {
$data[] = array(
"id" => $row['id'],
"credential" => $row["credential"] ?? 'N/A',
"expiry" => '<div id="' . $row['id'] . '-expiry"><script>document.getElementById("' . $row['id'] . '-expiry").textContent=convertTimestamp(' . $row["expiry"] . ');</script></div>',
"validated" => ($row['validated'] ? 1 : 0) ? 'true' : 'false',
"ip" => ($_SESSION['role'] == "Manager") ? 'REDACTED' : '<span class="blur-sm hover:blur-none">' . ($row['ip'] ?? 'N/A') . '</span>',
"actions" =>
'<form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true" class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4" type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" style="margin-top:3px">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false" class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1" style="min-width:15rem">
<li>
<button name="kill" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row["id"] . '">
Kill Session
</button>
</li>
</ul>
</div>
</tr>
</td>
</tr>
</form>',
);
}
## Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data
);
die(json_encode($response));
}
die("Request not from datatables, aborted.");

119
app/token-fetch.php Normal file
View File

@@ -0,0 +1,119 @@
<?php
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);
global $databaseUsername;
$errorMsg = str_replace($databaseUsername, "REDACTED", $exception->getMessage());
die("Error: " . $errorMsg);
});
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if ($_SESSION['role'] == "Reseller") {
die("Resellers can't access this.");
}
if ($_SESSION['role'] == "Manager") {
die("Managers can't access this.");
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("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
## Total number of records without filtering
$sel = misc\mysql\query("SELECT count(1) AS allcount FROM `tokens` WHERE app = ?", [$_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecords = $records['allcount'];
$totalRecordwithFilter = $totalRecords;
if (!is_null($searchValue)) { // don't double query if no search value was provided
## Total number of record with filtering
$sel = misc\mysql\query("SELECT count(1) AS allcount FROM `tokens` WHERE 1 AND (`token` LIKE ? OR `assigned` LIKE ? OR `status` LIKE ? OR `reason` LIKE ? ) AND app = ?", ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecordwithFilter = $records['allcount'];
}
// whitelist certain column names and sort orders to prevent SQL injection
if (!in_array($columnName, array("app", "token", "assigned", "banned", "reason", "hash", "type", "status"))) {
die("Column name is not whitelisted.");
}
if (!in_array($columnSortOrder, array("desc", "asc"))) {
die("Column sort order is not whitelisted.");
}
## Fetch records
if (!is_null($searchValue)){
$query = misc\mysql\query("SELECT * FROM `tokens` WHERE (`token` LIKE ? OR `assigned` LIKE ? OR `status` LIKE ? or `reason` LIKE ?) AND `app` = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
} else {
$query = misc\mysql\query("SELECT * FROM `tokens` 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['banned']) {
$banBtns = '<button class="btn menu-link px-3" style="font-size:0.95rem;" name="unbankey" value="' . $row['key'] . '">Unban</button>';
} else {
$banBtns = '<a class="menu-link px-3" data-bs-toggle="modal" data-bs-target="#ban-key" onclick="bankey(\'' . $row["key"] . '\')">Ban</a>';
}
$MarginManager = "";
if ($totalRecordwithFilter < 2) {
$MarginManager = "margin-bottom: 20px;";
} else {
$MarginManager = "margin-bottom: 0px;";
}
$data[] = array(
"app" => $_SESSION['name'],
"token" => $row['token'],
"assigned" => $row['assigned'] ?? "N\A",
"banned" => '<label class="' . ($row['banned'] == 1 ? 'text-red-700' : 'text-green-700') . '">' . ($row['banned'] == 1 ? 'banned' : 'unbanned') . '</label>',
"reason" => is_null($row['reason']) ? 'N/A' : $row['reason'],
"hash" => is_null($row['hash']) ? 'N/A' : $row['reason'],
"type" => $row['type'],
"status" => $row['status'],
);
}
## Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data
);
die(json_encode($response));
}
die("Request not from datatables, aborted.");
?>

177
app/user-fetch.php Normal file
View File

@@ -0,0 +1,177 @@
<?php
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);
global $databaseUsername;
$errorMsg = str_replace($databaseUsername, "REDACTED", $exception->getMessage());
die("Error: " . $errorMsg);
});
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if ($_SESSION['role'] == "Reseller") {
die("Resellers can't access this.");
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("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
## Total number of records without filtering
$sel = misc\mysql\query("select count(1) as allcount from `sessions` where app = ?", [$_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecords = $records['allcount'];
$totalRecordwithFilter = $totalRecords;
if (!is_null($searchValue)) { // don't double query if no search value was provided
## Total number of record with filtering
$sel = misc\mysql\query("select count(1) as allcount from `sessions` WHERE 1 and (`id` like ? or `credential` like ? or `ip` like ? ) and app = ?", ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecordwithFilter = $records['allcount'];
}
## Total number of records without filtering
$sel = misc\mysql\query("select count(1) as allcount from `users` where app = ?", [$_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecords = $records['allcount'];
$totalRecordwithFilter = $totalRecords;
if (!is_null($searchValue)) { // don't double query if no search value was provided
## Total number of record with filtering
$sel = misc\mysql\query("select count(1) as allcount from `users` WHERE 1 and (`username` like ? or `hwid` like ? or `ip` like ? or `banned` like ? ) and app = ?", ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecordwithFilter = $records['allcount'];
}
// whitelist certain column names and sort orders to prevent SQL injection
if (!in_array($columnName, array("username", "hwid", "ip", "createdate", "lastlogin", "banned"))) {
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 `users` WHERE (`username` like ? or `hwid` like ? or `ip` like ? or `banned` like ? ) and app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
}
else {
$query = misc\mysql\query("select * from `users` WHERE app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, [$_SESSION['app']]);
}
$data = array();
while ($row = mysqli_fetch_assoc($query->result)) {
## If User is banned show only unban and if not show only ban.
$banBtns = "";
if ($row['banned'] ? true : false) {
$banned = $row['banned'];
$banBtns = '<button class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700" name="unbanuser" value="' . urlencode($row['username']) . '">Unban User</button>';
} else {
$banned = "N/A";
$banBtns = '<button class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700" type="button" onclick="banuser(\'' . urlencode($row["username"]) . '\')">Ban User</button>';
}
## Add Extra Margin to buttons if value is 1 or 2, because datatables with ajax breaks it.
$MarginManager = "";
if ($query->num_rows < 2) {
$MarginManager = "margin-bottom: 120px;";
} else {
$MarginManager = "margin-bottom: 0px;";
}
$data[] = array(
"checkbox" => '<input type="checkbox" style="outline:none;"class="w-4 h-4 text-blue-600 bg-[#0f0f17] border-gray-300 rounded focus:ring-blue-500 checkbox" value="' . $row["username"] .'">',
"username" => $row['username'],
"hwid" => ($_SESSION['role'] == "Manager" || $_SESSION['role'] == "Reseller") ? 'REDACTED' : '<span class="blur-sm hover:blur-none">' . ($row['hwid'] ?? 'N/A') . '</span>',
"ip" => ($_SESSION['role'] == "Manager" || $_SESSION['role'] == "Reseller") ? 'REDACTED' : '<span class="blur-sm hover:blur-none">' . ($row['ip'] ?? 'N/A') . '</span>',
"createdate" => '<div id="' . $row['username'] . '-createdate"><script>document.getElementById("' . $row['username'] . '-createdate").textContent=convertTimestamp(' . $row["createdate"] . ');</script></div>',
"lastlogin" => '<div id="' . $row['username'] . '-lastlogin"><script>document.getElementById("' . $row['username'] . '-lastlogin").textContent=convertTimestamp(' . $row["lastlogin"] . ');</script></div>',
"banned" => $banned,
"actions" => '<tr><form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true" class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4" type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" style="margin-top:3px">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false" class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1" style="min-width:15rem">
<li>
<button name="deleteuser" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . urlencode($row["username"]) . '">
Delete User
</button>
</li>
<li>
<button name="resetuser" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row["username"] . '">
Reset User HWID
</button>
</li>
<li>
' . $banBtns . '
</li>
<li>
<button name="pauseuser" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row['username'] . '">
Pause User
</button>
</li>
<li>
<button name="unpauseuser" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row['username'] . '">
Unpause User
</button>
</li>
<li>
<button name="edituser" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
value="' . urlencode($row['username']) . '">
Edit User
</button>
</li>
</ul>
</div>
</td>
</tr>
</form>'
);
}
## Response
$response = array(
"draw" => $draw,
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data
);
die(json_encode($response));
}
die("Request not from datatables, aborted.");

120
app/user-var-fetch.php Normal file
View File

@@ -0,0 +1,120 @@
<?php
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);
global $databaseUsername;
$errorMsg = str_replace($databaseUsername, "REDACTED", $exception->getMessage());
die("Error: " . $errorMsg);
});
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if ($_SESSION['role'] == "Reseller") {
die("Resellers can't access this.");
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("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
## Total number of records without filtering
$sel = misc\mysql\query("select count(1) as allcount from `uservars` where app = ?", [$_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecords = $records['allcount'];
$totalRecordwithFilter = $totalRecords;
if (!is_null($searchValue)) { // don't double query if no search value was provided
## Total number of record with filtering
$sel = misc\mysql\query("select count(1) as allcount from `uservars` WHERE 1 and (`name` like ? or `user` like ? ) and app = ?", ["%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecordwithFilter = $records['allcount'];
}
// whitelist certain column names and sort orders to prevent SQL injection
if (!in_array($columnName, array("name", "data", "user", "readOnly"))) {
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 `uservars` WHERE (`name` like ? or `user` like ? ) and app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, ["%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
}
else {
$query = misc\mysql\query("select * from `uservars` WHERE app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, [$_SESSION['app']]);
}
$data = array();
while ($row = mysqli_fetch_assoc($query->result)) {
$data[] = array(
"name" => $row["name"],
"data" => $row["data"],
"user" => $row["user"],
"readOnly" => $row["readOnly"] ? "True" : "False",
"actions" =>
'<form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true" class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4" type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" style="margin-top:3px">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false" class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1" style="min-width:15rem">
<li>
<button name="deletevar" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . $row["id"] . '">
Delete User Variable
</button>
</li>
<li>
<button name="editvar" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
value="' . $row["id"] . '">
Edit User Variable
</button>
</li>
</ul>
</div>
</td>
</tr>
</form>',
);
}
## Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data
);
die(json_encode($response));
}
die("Request not from datatables, aborted.");

132
app/var-fetch.php Normal file
View File

@@ -0,0 +1,132 @@
<?php
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);
global $databaseUsername;
$errorMsg = str_replace($databaseUsername, "REDACTED", $exception->getMessage());
die("Error: " . $errorMsg);
});
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if ($_SESSION['role'] == "Reseller") {
die("Resellers can't access this.");
}
if (!isset($_SESSION['app'])) {
dashboard\primary\error("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
## Total number of records without filtering
$sel = misc\mysql\query("select count(1) as allcount from `vars` where app = ?", [$_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecords = $records['allcount'];
$totalRecordwithFilter = $totalRecords;
if (!is_null($searchValue)) { // don't double query if no search value was provided
## Total number of record with filtering
$sel = misc\mysql\query("select count(1) as allcount from `vars` WHERE 1 and (`varid` like ? or `msg` like ? ) and app = ?", ["%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecordwithFilter = $records['allcount'];
}
## Total number of records without filtering
$sel = misc\mysql\query("select count(1) as allcount from `vars` where app = ?", [$_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecords = $records['allcount'];
$totalRecordwithFilter = $totalRecords;
if (!is_null($searchValue)) { // don't double query if no search value was provided
## Total number of record with filtering
$sel = misc\mysql\query("select count(1) as allcount from `vars` WHERE 1 and (`varid` like ? or `msg` like ? ) and app = ?", ["%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecordwithFilter = $records['allcount'];
}
// whitelist certain column names and sort orders to prevent SQL injection
if (!in_array($columnName, array("varid", "msg", "authed"))) {
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 `vars` WHERE (`varid` like ? or `msg` like ? ) and app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, ["%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
}
else {
$query = misc\mysql\query("select * from `vars` WHERE app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, [$_SESSION['app']]);
}
$data = array();
while ($row = mysqli_fetch_assoc($query->result)) {
$data[] = array(
"varid" => $row["varid"],
"msg" => substr($row["msg"], 0, 150),
"authed" => $row["authed"] ? "True" : "False",
"actions" =>
'<form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true" class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4" type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" style="margin-top:3px">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false" class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1" style="min-width:15rem">
<li>
<button name="deletevar" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700"
value="' . misc\etc\sanitize($row["varid"]) . '">
Delete Global Variable
</button>
</li>
<li>
<button name="editvar" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-blue-700"
value="' . misc\etc\sanitize($row["varid"]) . '">
Edit Global Variable
</button>
</li>
</ul>
</div>
</td>
</tr>
</form>',
);
}
## Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data
);
die(json_encode($response));
}
die("Request not from datatables, aborted.");

110
app/white-fetch.php Normal file
View File

@@ -0,0 +1,110 @@
<?php
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);
global $databaseUsername;
$errorMsg = str_replace($databaseUsername, "REDACTED", $exception->getMessage());
die("Error: " . $errorMsg);
});
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if ($_SESSION['role'] == "Reseller") {
die("Resellers can't access this.");
}
if (!isset($_SESSION['app'])) {
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']) -1; // 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
## Total number of records without filtering
$sel = misc\mysql\query("select count(1) as allcount from `whitelist` where app = ?", [$_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecords = $records['allcount'];
$totalRecordwithFilter = $totalRecords;
if (!is_null($searchValue)) { // don't double query if no search value was provided
## Total number of record with filtering
$sel = misc\mysql\query("select count(1) as allcount from `whitelist` WHERE 1 and (`ip` like ?) and app = ?", ["%" . $searchValue . "%", $_SESSION['app']]);
$records = mysqli_fetch_assoc($sel->result);
$totalRecordwithFilter = $records['allcount'];
}
// whitelist certain column names and sort orders to prevent SQL injection
if (!in_array($columnName, array("ip"))) {
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 `whitelist` WHERE (`ip` like ?) and app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
}
else {
$query = misc\mysql\query("select * from `whitelist` WHERE app = ? order by `" . $columnName . "` " . $columnSortOrder . " limit " . $row . "," . $rowperpage, [$_SESSION['app']]);
}
$data = array();
while ($row = mysqli_fetch_assoc($query->result)) {
$data[] = array(
"ip" => '<span class="blur-sm hover:blur-none">' . ($row["ip"]) . '</span>',
"actions" =>
'<form method="POST">
<td>
<div x-data="{ open: false }" class="z-0">
<button x-on:click="open = true" class="flex items-center border border-gray-700 rounded-lg focus:opacity-60 text-white focus:text-white font-semibold rounded focus:outline-none focus:shadow-inner py-2 px-4" type="button">
<span class="mr-1">Actions</span>
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" style="margin-top:3px">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
</svg>
</button>
<ul x-show="open" x-on:click.away="open = false" class="bg-[#09090d] text-white rounded shadow-lg absolute py-2 mt-1" style="min-width:15rem">
<li>
<button name="deletewhite" class="block hover:opacity-60 whitespace-no-wrap py-2 px-4 hover:text-red-700" value="' . ($row["ip"]) . '">
Delete Whitelist
</button>
</li>
</ul>
</div>
</td>
</form>',
);
}
## Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data
);
die(json_encode($response));
}
die("Request not from datatables, aborted.");

View File

@@ -0,0 +1,174 @@
<?php
/**
* PHP Class for handling Google Authenticator 2-factor authentication
*
* @author Michael Kliewe
* @copyright 2019 Michael Kliewe
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
*
*/
class GoogleAuthenticator
{
protected $_codeLength = 6;
/**
* Create new secret.
* 40 characters, randomly chosen from the allowed base32 characters.
*
* @param int $secretLength
* @return string
*/
public function createSecret($secretLength = 40)
{
$validChars = $this->_getBase32LookupTable();
unset($validChars[32]);
$secret = '';
for ($i = 0; $i < $secretLength; $i++) {
$secret .= $validChars[array_rand($validChars)];
}
return $secret;
}
/**
* Calculate the code, with given secret and point in time
*
* @param string $secret
* @param int|null $timeSlice
* @return string
*/
public function getCode($secret, $timeSlice = null)
{
if ($timeSlice === null) {
$timeSlice = floor(time() / 30);
}
$secretkey = $this->_base32Decode($secret);
// Pack time into binary string
$time = chr(0).chr(0).chr(0).chr(0).pack('N*', $timeSlice);
// Hash it with users secret key
$hm = hash_hmac('SHA1', $time, $secretkey, true);
// Use last nipple of result as index/offset
$offset = ord(substr($hm, -1)) & 0x0F;
// grab 4 bytes of the result
$hashpart = substr($hm, $offset, 4);
// Unpak binary value
$value = unpack('N', $hashpart);
$value = $value[1];
// Only 32 bits
$value = $value & 0x7FFFFFFF;
$modulo = pow(10, $this->_codeLength);
return str_pad($value % $modulo, $this->_codeLength, '0', STR_PAD_LEFT);
}
/**
* Get QR-Code URL for image, from google charts
*
* @param string $name
* @param string $secret
* @param string $title
* @return string
*/
public function getQRCodeGoogleUrl($name, $secret, $title = null) {
$urlencoded = urlencode('otpauth://totp/'.$name.'?secret='.$secret.'');
if(isset($title)) {
$urlencoded .= urlencode('&issuer='.urlencode($title));
}
return 'https://quickchart.io/qr?text='.$urlencoded.'&size=200&centerImageUrl=https%3A%2F%2Fcdn.keyauth.cc%2Fassets%2Fimg%2Ffavicon.png';
}
/**
* Check if the code is correct. This will accept codes starting from $discrepancy*30sec ago to $discrepancy*30sec from now
*
* @param string $secret
* @param string $code
* @param int $discrepancy This is the allowed time drift in 30 second units (8 means 4 minutes before or after)
* @param int|null $currentTimeSlice time slice if we want use other that time()
* @return bool
*/
public function verifyCode($secret, $code, $discrepancy = 1, $currentTimeSlice = null)
{
if ($currentTimeSlice === null) {
$currentTimeSlice = floor(time() / 30);
}
for ($i = -$discrepancy; $i <= $discrepancy; $i++) {
$calculatedCode = $this->getCode($secret, $currentTimeSlice + $i);
if ($calculatedCode == $code ) {
return true;
}
}
return false;
}
/**
* Set the code length, should be >=6
*
* @param int $length
* @return GoogleAuthenticator
*/
public function setCodeLength($length)
{
$this->_codeLength = $length;
return $this;
}
/**
* Helper class to decode base32
*
* @param $secret
* @return bool|string
*/
protected function _base32Decode($secret)
{
if (empty($secret)) return '';
$base32chars = $this->_getBase32LookupTable();
$base32charsFlipped = array_flip($base32chars);
$paddingCharCount = substr_count($secret, $base32chars[32]);
$allowedValues = array(6, 4, 3, 1, 0);
if (!in_array($paddingCharCount, $allowedValues)) return false;
for ($i = 0; $i < 4; $i++){
if ($paddingCharCount == $allowedValues[$i] &&
substr($secret, -($allowedValues[$i])) != str_repeat($base32chars[32], $allowedValues[$i])) return false;
}
$secret = str_replace('=','', $secret);
$secret = str_split($secret);
$binaryString = "";
for ($i = 0; $i < count($secret); $i = $i+8) {
$x = "";
if (!in_array($secret[$i], $base32chars)) return false;
for ($j = 0; $j < 8; $j++) {
$x .= str_pad(base_convert(@$base32charsFlipped[@$secret[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);
}
$eightBits = str_split($x, 8);
for ($z = 0; $z < count($eightBits); $z++) {
$binaryString .= ( ($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48 ) ? $y:"";
}
}
return $binaryString;
}
/**
* Get array with all 32 characters for decoding from/encoding to base32
*
* @return array
*/
protected function _getBase32LookupTable()
{
return array(
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 7
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 15
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 23
'Y', 'Z', '2', '3', '4', '5', '6', '7', // 31
'=' // padding char
);
}
}

449
discord/index.html Normal file
View File

@@ -0,0 +1,449 @@
<!DOCTYPE html>
<html lang="en" class="bg-[#09090d] text-white overflow-x-hidden">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="KeyAuth - Open Source Auth">
<meta content="Secure your software against piracy, an issue causing $422 million in losses annually - Fair pricing & Features not seen in competitors" name="description" />
<meta content="KeyAuth" name="author" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="KeyAuth, Cloud Authentication, Key Authentication,Authentication, API authentication,Security, Encryption authentication, Authenticated encryption, Cybersecurity, Developer, SaaS, Software Licensing, Licensing" />
<meta property="og:description" content="Secure your software against piracy, an issue causing $422 million in losses annually - Fair pricing & Features not seen in competitors" />
<meta property="og:image" content="https://cdn.keyauth.cc/front/assets/img/favicon.png" />
<meta property="og:site_name" content="KeyAuth | Secure your software from piracy." />
<link rel="shortcut icon" type="image/jpg" href="https://cdn.keyauth.cc/front/assets/img/favicon.png">
<!-- Schema.org markup for Google+ -->
<meta itemprop="name" content="KeyAuth - Open Source Auth">
<meta itemprop="description" content="Secure your software against piracy, an issue causing $422 million in losses annually - Fair pricing & Features not seen in competitors">
<meta itemprop="image" content="https://cdn.keyauth.cc/front/assets/img/favicon.png">
<!-- Twitter Card data -->
<meta name="twitter:card" content="product">
<meta name="twitter:site" content="@keyauth">
<meta name="twitter:title" content="KeyAuth - Open Source Auth">
<meta name="twitter:description" content="Secure your software against piracy, an issue causing $422 million in losses annually - Fair pricing & Features not seen in competitors">
<meta name="twitter:creator" content="@keyauth">
<meta name="twitter:image" content="https://cdn.keyauth.cc/front/assets/img/favicon.png">
<!-- Open Graph data -->
<meta property="og:title" content="KeyAuth - Open Source Auth" />
<meta property="og:type" content="website" />
<meta property="og:url" content="./" />
<meta name="apple-itunes-app" content="app-id=6503321465">
<title>KeyAuth - Discord Support</title>
<!-- Canonical SEO -->
<link rel="canonical" href="https://keyauth.cc" />
<link rel="stylesheet" href="https://unpkg.com/flowbite@1.8.1/dist/flowbite.min.css" />
<script src="https://unpkg.com/flowbite@1.8.1/dist/flowbite.js"></script>
<script src="https://cdn.tailwindcss.com/"></script>
<link rel="stylesheet" href="https://cdn.keyauth.cc/v3/scripts/animate.min.css" />
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
blue: {
"50": "#eff6ff",
"100": "#dbeafe",
"200": "#bfdbfe",
"300": "#93c5fd",
"400": "#60a5fa",
"500": "#3b82f6",
"600": "#2563eb",
"700": "#1d4ed8",
"800": "#1e40af",
"900": "#1e3a8a",
"950": "#172554"
}
}
},
fontFamily: {
'body': [
'Inter',
'ui-sans-serif',
'system-ui',
'-apple-system',
'system-ui',
'Segoe UI',
'Roboto',
'Helvetica Neue',
'Arial',
'Noto Sans',
'sans-serif',
'Apple Color Emoji',
'Segoe UI Emoji',
'Segoe UI Symbol',
'Noto Color Emoji'
],
'sans': [
'Inter',
'ui-sans-serif',
'system-ui',
'-apple-system',
'system-ui',
'Segoe UI',
'Roboto',
'Helvetica Neue',
'Arial',
'Noto Sans',
'sans-serif',
'Apple Color Emoji',
'Segoe UI Emoji',
'Segoe UI Symbol',
'Noto Color Emoji'
]
}
}
}
</script>
<style>
.hidden_l {
opacity: 0;
transform: translateY(20px);
}
</style>
</head>
<body class="bg-[#09090d] text-white">
<header>
<nav class="border-[#0f0f17] px-4 lg:px-6 py-2.5 mb-14">
<div class="flex flex-wrap justify-between items-center mx-auto max-w-screen-xl">
<a href="../" class="flex items-center">
<img src="https://cdn.keyauth.cc/v2/assets/media/logos/logo-1-dark.png" class="mr-3 h-12 mt-2" alt="KeyAuth Logo" />
</a>
<div class="flex items-center lg:order-2">
<a href="../login" class="text-white focus:ring-0 font-medium rounded-lg text-sm px-4 py-2 lg:px-5 lg:py-2.5 mr-2 hover:opacity-60 transition duration-200 focus:outline-none focus:ring-gray-800">
Client Area
</a>
<a href="../register" class="text-white focus:ring-0 font-medium rounded-lg text-sm px-4 py-2 lg:px-5 lg:py-2.5 mr-2 bg-blue-600 hover:opacity-80 focus:outline-none focus:ring-blue-800 transition duration-200">
Onboard Now
</a>
<button data-collapse-toggle="mmenu" type="button" class="inline-flex items-center p-2 ml-1 text-sm text-gray-500 rounded-lg lg:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 " aria-controls="mmenu" aria-expanded="false">
<span class="sr-only">Open main menu</span>
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z" clip-rule="evenodd"></path>
</svg>
<svg class="hidden w-6 h-6" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path>
</svg>
</button>
</div>
<div class="hidden justify-between items-center w-full lg:flex lg:w-auto lg:order-1" id="mmenu">
<ul class="flex flex-col mt-4 font-medium lg:flex-row lg:space-x-8 lg:mt-0">
<li>
<a href="../" class="block py-2 pr-4 pl-3 border-b lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700 hover:text-white lg:hover:bg-transparent border-gray-700 transition duration-200" aria-current="page">Home</a>
</li>
<li>
<a href="../#features" class="block py-2 pr-4 pl-3 border-b lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700 hover:text-white lg:hover:bg-transparent border-gray-700 transition duration-200">Features</a>
</li>
<li>
<button id="mm-button" data-dropdown-toggle="mm" class="flex justify-between items-center py-2 pr-4 pl-3 w-full font-medium border-b lg:w-auto lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700hover:text-white lg:hover:bg-transparent border-gray-700 hover:text-white transition duration-200">Insights
<svg class="ml-1 w-5 h-5 lg:w-4 lg:h-4" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path>
</svg></button>
<div id="mm" class="grid hidden absolute z-10 w-full border shadow-md border-[#0f0f17] lg:rounded-lg lg:w-auto lg:grid-cols-3 bg-[#0f0f17]">
<div class="p-2 bg-[#09090d] lg:rounded-lg text-white lg:col-span-2">
<ul>
<li>
<a href="https://youtube.com/keyauth" target="_blank" class="flex items-center p-3 rounded-lg hover:bg-[#0f0f17]">
<div class="p-2 mr-4 rounded-lg shadow bg-[#0f0f17]">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M21.593 7.203a2.506 2.506 0 0 0-1.762-1.766c-1.566-.43-7.83-.437-7.83-.437s-6.265-.007-7.832.404a2.56 2.56 0 0 0-1.766 1.778c-.413 1.566-.417 4.814-.417 4.814s-.004 3.264.406 4.814c.23.857.905 1.534 1.763 1.765 1.582.43 7.83.437 7.83.437s6.265.007 7.831-.403a2.515 2.515 0 0 0 1.767-1.763c.414-1.565.417-4.812.417-4.812s.02-3.265-.407-4.831ZM9.996 15.005l.005-6 5.207 3.005-5.212 2.995Z"></path>
</svg>
</div>
<div>
<div class="font-semibold">
Explore Our YouTube Channel
</div>
<div class="text-sm font-light text-gray-400">Watch Feature Showcases and Updates on YouTube.</div>
</div>
</a>
</li>
<li>
<a href="https://t.me/keyauth" target="_blank" class="flex items-center p-3 rounded-lg hover:bg-[#0f0f17]">
<div class="p-2 mr-4 rounded-lg shadow bg-[#0f0f17]">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="m20.665 3.72-17.73 6.837c-1.21.486-1.203 1.16-.222 1.462l4.552 1.42 10.532-6.645c.498-.303.953-.14.579.192l-8.533 7.7H9.84l.002.002-.314 4.692c.46 0 .663-.211.92-.46l2.212-2.15 4.599 3.397c.848.467 1.457.227 1.668-.785l3.019-14.228c.309-1.24-.473-1.8-1.282-1.434Z"></path>
</svg>
</div>
<div>
<div class="font-semibold">
Connect on Our Telegram Platform
</div>
<div class="text-sm font-light text-gray-400">Connect and Communicate on Telegram.</div>
</div>
</a>
</li>
<li>
<a href="https://github.com/keyauth" target="_blank" class="flex items-center p-3 rounded-lg hover:bg-[#0f0f17]">
<div class="p-2 mr-4 rounded-lg shadow bg-[#0f0f17]">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M12.026 2a9.973 9.973 0 0 0-9.974 9.974c0 4.406 2.857 8.145 6.82 9.465.5.09.68-.217.68-.481 0-.237-.008-.865-.011-1.696-2.775.602-3.361-1.338-3.361-1.338-.452-1.152-1.107-1.459-1.107-1.459-.905-.619.069-.605.069-.605 1.002.07 1.527 1.028 1.527 1.028.89 1.524 2.336 1.084 2.902.829.09-.645.35-1.085.635-1.334-2.214-.251-4.542-1.107-4.542-4.93 0-1.087.389-1.979 1.024-2.675-.101-.253-.446-1.268.099-2.64 0 0 .837-.269 2.742 1.021a9.582 9.582 0 0 1 2.496-.336 9.555 9.555 0 0 1 2.496.336c1.906-1.291 2.742-1.021 2.742-1.021.545 1.372.203 2.387.099 2.64.64.696 1.024 1.587 1.024 2.675 0 3.833-2.33 4.675-4.552 4.922.355.308.675.916.675 1.846 0 1.334-.012 2.41-.012 2.737 0 .267.178.577.687.479C19.146 20.115 22 16.379 22 11.974 22 6.465 17.535 2 12.026 2Z" clip-rule="evenodd"></path>
</svg>
</div>
<div>
<div class="font-semibold">
Explore Our GitHub Repositories
</div>
<div class="text-sm font-light text-gray-400">Explore Official Examples on GitHub.</div>
</div>
</a>
</li>
<li>
<a href="https://twitter.com/KeyAuth" target="_blank" class="flex items-center p-3 rounded-lg hover:bg-[#0f0f17]">
<div class="p-2 mr-4 rounded-lg shadow bg-[#0f0f17]">
<svg class="w-5 h-5" fill="currentColor" version="1.1" id="svg5" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1668.56 1221.19" style="enable-background:new 0 0 1668.56 1221.19;" xml:space="preserve">
<g id="layer1" transform="translate(52.390088,-25.058597)">
<path id="path1009" d="M283.94,167.31l386.39,516.64L281.5,1104h87.51l340.42-367.76L984.48,1104h297.8L874.15,558.3l361.92-390.99 h-87.51l-313.51,338.7l-253.31-338.7H283.94z M412.63,231.77h136.81l604.13,807.76h-136.81L412.63,231.77z" />
</g>
</svg>
</div>
<div>
<div class="font-semibold">
Follow Us on X / Twitter
</div>
<div class="text-sm font-light text-gray-400">Stay Informed with the Latest on X / Twitter.</div>
</div>
</a>
</li>
</ul>
</div>
<div class="py-5 px-5 lg:rounded-lg lg:col-span-1 bg-[#0f0f17]">
<h3 class="mb-4 text-sm font-semibold text-white">Explore Our Examples</h3>
<ul class="space-y-4 text-sm text-gray-400">
<li>
<a href="https://github.com/KeyAuth/KeyAuth-CPP-Example" class="hover:text-blue-500" target="_blank">
C++
</a>
</li>
<li>
<a href="https://github.com/KeyAuth/KeyAuth-CSHARP-Example" class="hover:text-blue-500" target="_blank">
C# (CSharp)
</a>
</li>
<li>
<a href="https://github.com/mazkdevf/KeyAuth-JS-Example" class="hover:text-blue-500" target="_blank">
JavaScript
</a>
</li>
<li>
<a href="https://github.com/KeyAuth/KeyAuth-Python-Example" class="hover:text-blue-500" target="_blank">
Python
</a>
</li>
<li>
<a href="https://github.com/KeyAuth/KeyAuth-PHP-Example" class="hover:text-blue-500" target="_blank">
PHP
</a>
</li>
<li>
<a href="https://github.com/KeyAuth/KeyAuth-Rust-Example" class="hover:text-blue-500" target="_blank">
Rust
</a>
</li>
<li>
<a href="https://github.com/KeyAuth-Archive/KeyAuth-JAVA-api" class="hover:text-blue-500" target="_blank">
Java
</a>
</li>
<li>
<a href="https://github.com/mazkdevf/KeyAuth-Ruby-Example" class="hover:text-blue-500" target="_blank">
Ruby
</a>
</li>
</ul>
</div>
</div>
</li>
<li>
<a href="../#plans" class="block py-2 pr-4 pl-3 border-b lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700 hover:text-white lg:hover:bg-transparent border-gray-700 transition duration-200">
Plans
</a>
</li>
<li>
<a href="../#team" class="block py-2 pr-4 pl-3 border-b lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700 hover:text-white lg:hover:bg-transparent border-gray-700 transition duration-200">
Our Team
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<section class="flex items-center justify-center bg-[#09090d] text-white">
<div class="bg-[#1a1a1d] rounded-lg p-8 shadow-md w-96 text-center">
<p>Please click <span class="bg-gray-800 text-white rounded-lg p-1 font-mono">Message our Support</span> below.</p>
<br>
<p>After your message, we will help you ASAP 🙂 patience, we are not awake all the time..</p>
<br>
<p><i>You can chat and see announcements <b><u><a class="text-blue-500" href="https://t.me/KeyAuth" target="_blank">here on Telegram</a></u></b>.</i></p>
<br>
<a href="https://discord.com/oauth2/authorize?client_id=1235739935735025754&response_type=code&redirect_uri=https%3A%2F%2Fkeyauth.cc%2Fsupport-link%2F&integration_type=1&scope=identify+applications.commands" class="w-full bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded flex items-center justify-center">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-5 h-5 mr-2">
<path d="M12 2a10 10 0 1010 10A10.011 10.011 0 0012 2zm5.293 9.293l-5.293 5.293-5.293-5.293 1.414-1.414L11 12.586V6h2v6.586l3.293-3.293z"/>
</svg>
Message our Support
</a>
</div>
</section>
<footer class="mt-32">
<div class="p-4 py-6 mx-auto max-w-screen-xl md:p-8 lg:-10 pt-32 md:pt-0">
<div class="grid grid-cols-2 gap-8 lg:grid-cols-6">
<div class="col-span-2">
<a href="../" class="flex items-center mb-2 text-2xl font-semibold text-white lg:mb-0">
KeyAuth LLC
</a>
<p class="my-4 font-light text-gray-400">
KeyAuth is a game-changing, affordable and easy to use licensing solution for your software.
</p>
<ul class="flex mt-5 space-x-6">
<li>
<a target="_blank" href="https://youtube.com/keyauth" class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M21.593 7.203a2.506 2.506 0 0 0-1.762-1.766c-1.566-.43-7.83-.437-7.83-.437s-6.265-.007-7.832.404a2.56 2.56 0 0 0-1.766 1.778c-.413 1.566-.417 4.814-.417 4.814s-.004 3.264.406 4.814c.23.857.905 1.534 1.763 1.765 1.582.43 7.83.437 7.83.437s6.265.007 7.831-.403a2.515 2.515 0 0 0 1.767-1.763c.414-1.565.417-4.812.417-4.812s.02-3.265-.407-4.831ZM9.996 15.005l.005-6 5.207 3.005-5.212 2.995Z"></path>
</svg>
</a>
</li>
<li>
<a target="_blank" href="https://github.com/KeyAuth/" class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M12.026 2a9.973 9.973 0 0 0-9.974 9.974c0 4.406 2.857 8.145 6.82 9.465.5.09.68-.217.68-.481 0-.237-.008-.865-.011-1.696-2.775.602-3.361-1.338-3.361-1.338-.452-1.152-1.107-1.459-1.107-1.459-.905-.619.069-.605.069-.605 1.002.07 1.527 1.028 1.527 1.028.89 1.524 2.336 1.084 2.902.829.09-.645.35-1.085.635-1.334-2.214-.251-4.542-1.107-4.542-4.93 0-1.087.389-1.979 1.024-2.675-.101-.253-.446-1.268.099-2.64 0 0 .837-.269 2.742 1.021a9.582 9.582 0 0 1 2.496-.336 9.555 9.555 0 0 1 2.496.336c1.906-1.291 2.742-1.021 2.742-1.021.545 1.372.203 2.387.099 2.64.64.696 1.024 1.587 1.024 2.675 0 3.833-2.33 4.675-4.552 4.922.355.308.675.916.675 1.846 0 1.334-.012 2.41-.012 2.737 0 .267.178.577.687.479C19.146 20.115 22 16.379 22 11.974 22 6.465 17.535 2 12.026 2Z" clip-rule="evenodd"></path>
</svg>
</a>
</li>
<li>
<a target="_blank" href="https://twitter.com/KeyAuth" class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M19.633 7.994c.013.175.013.349.013.523 0 5.325-4.053 11.46-11.46 11.46A11.38 11.38 0 0 1 2 18.169c.324.037.636.05.973.05a8.07 8.07 0 0 0 5.001-1.721 4.036 4.036 0 0 1-3.767-2.793c.249.037.499.062.761.062.361 0 .724-.05 1.061-.137a4.027 4.027 0 0 1-3.23-3.953v-.05a4.05 4.05 0 0 0 1.82.51 4.022 4.022 0 0 1-1.796-3.353c0-.748.199-1.434.548-2.032a11.457 11.457 0 0 0 8.306 4.215c-.062-.3-.1-.611-.1-.923a4.024 4.024 0 0 1 4.028-4.028c1.16 0 2.207.486 2.943 1.272a7.957 7.957 0 0 0 2.556-.973c-.3.93-.93 1.72-1.771 2.22a8.074 8.074 0 0 0 2.319-.624 8.646 8.646 0 0 1-2.019 2.083Z"></path>
</svg>
</a>
</li>
<li>
<a target="_blank" href="#" class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M11.999 7.375a4.624 4.624 0 1 0 0 9.248 4.624 4.624 0 0 0 0-9.248Zm0 7.627a3.004 3.004 0 1 1 0-6.008 3.004 3.004 0 0 1 0 6.008Z"></path>
<path d="M16.805 8.289a1.078 1.078 0 1 0 0-2.156 1.078 1.078 0 0 0 0 2.156Z"></path>
<path d="M20.533 6.114A4.605 4.605 0 0 0 17.9 3.482a6.607 6.607 0 0 0-2.186-.42c-.963-.042-1.268-.054-3.71-.054s-2.755 0-3.71.054a6.554 6.554 0 0 0-2.184.42 4.6 4.6 0 0 0-2.633 2.632A6.585 6.585 0 0 0 3.058 8.3c-.043.962-.056 1.267-.056 3.71 0 2.442 0 2.753.056 3.71.015.748.156 1.486.419 2.187a4.61 4.61 0 0 0 2.634 2.632 6.583 6.583 0 0 0 2.185.45c.963.042 1.268.055 3.71.055s2.755 0 3.71-.055a6.616 6.616 0 0 0 2.186-.42 4.613 4.613 0 0 0 2.633-2.632c.263-.7.404-1.438.419-2.186.043-.962.056-1.267.056-3.71s0-2.753-.056-3.71a6.583 6.583 0 0 0-.421-2.217Zm-1.218 9.532a5.046 5.046 0 0 1-.311 1.688 2.987 2.987 0 0 1-1.712 1.71c-.535.2-1.1.305-1.67.312-.95.044-1.218.055-3.654.055-2.438 0-2.687 0-3.655-.055a4.961 4.961 0 0 1-1.67-.311 2.985 2.985 0 0 1-1.718-1.711 5.08 5.08 0 0 1-.311-1.67c-.043-.95-.053-1.217-.053-3.653 0-2.437 0-2.686.053-3.655a5.038 5.038 0 0 1 .311-1.687c.305-.79.93-1.41 1.719-1.712a5.01 5.01 0 0 1 1.669-.311c.95-.043 1.218-.055 3.655-.055s2.687 0 3.654.055a4.96 4.96 0 0 1 1.67.31 2.99 2.99 0 0 1 1.712 1.713 5.06 5.06 0 0 1 .311 1.669c.043.95.054 1.218.054 3.655 0 2.436 0 2.698-.043 3.654h-.011v-.001Z"></path>
</svg>
</a>
</li>
<li>
<a target="_blank" href="https://www.tiktok.com/@keyauth" class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-5.2 1.74 2.89 2.89 0 0 1 2.31-4.64c.298-.002.595.042.88.13V9.4A6.33 6.33 0 0 0 5 20.1a6.34 6.34 0 0 0 10.86-4.43v-7a8.16 8.16 0 0 0 4.77 1.52v-3.4a4.85 4.85 0 0 1-1-.1h-.04Z"></path>
</svg>
</a>
</li>
</ul>
</div>
<div class="lg:mx-auto">
<h3 class="mb-6 text-sm font-semibold uppercase text-white">Links</h3>
<ul class="text-gray-500 ">
<li class="mb-4">
<a href="https://www.youtube.com/keyauth" target="_blank" class="hover:underline">Youtube</a>
</li>
<li class="mb-4">
<a href="https://github.com/keyauth" target="_blank" class="hover:underline">GitHub</a>
</li>
<li class="mb-4">
<a href="https://keyauthdocs.apidog.io" target="_blank" class="hover:underline">Documentation</a>
</li>
</ul>
</div>
<div class="lg:mx-auto">
<h2 class="mb-6 text-sm font-semibold uppercase text-white">
Most Used Examples
</h2>
<ul class="text-gray-500 ">
<li class="mb-4">
<a target="_blank" href="https://github.com/KeyAuth/KeyAuth-CPP-Example" class="hover:underline">
C++ <span class="text-xs">(CPP)</span>
</a>
</li>
<li class="mb-4">
<a target="_blank" href="https://github.com/KeyAuth/KeyAuth-CSHARP-Example" class="hover:underline">C#
<span class="text-xs">(CSharp)</span></a>
</li>
<li class="mb-4">
<a target="_blank" href="https://github.com/mazkdevf/KeyAuth-JS-Example" class="hover:underline">JavaScript
<span class="text-xs">(JS)</span></a>
</li>
<li class="mb-4">
<a target="_blank" href="https://github.com/KeyAuth/KeyAuth-Python-Example" class="hover:underline">Python
<span class="text-xs">(PY)</span></a>
</li>
</ul>
</div>
<div class="lg:mx-auto">
<h2 class="mb-6 text-sm font-semibold uppercase text-white">Other & Support</h2>
<ul class="text-gray-500 ">
<li class="mb-4">
<a target="_blank" href="https://chatting.page/gjqkqirygnfslvce2m5eycuo7tfxrhxl" class="hover:underline">
Support Center
</a>
</li>
<li class="mb-4">
<a target="_blank" href="../free-trial/" class="hover:underline">
Demo Accounts
</a>
</li>
<li class="mb-4">
<a target="_blank" href="https://t.me/keyauth" class="hover:underline">
Telegram
</a>
</li>
</ul>
</div>
<div class="lg:mx-auto">
<h2 class="mb-6 text-sm font-semibold uppercase text-white">Legal</h2>
<ul class="text-gray-500 ">
<li class="mb-4">
<a target="_blank" href="../terms" class="hover:underline">Terms of Service</a>
</li>
<li class="mb-4">
<a target="_blank" href="../privacy" class="hover:underline">Privacy Policy</a>
</li>
<li class="mb-4">
<a target="_blank" href="https://github.com/KeyAuth/KeyAuth-Source-Code/blob/main/LICENSE" class="hover:underline">Licensing</a>
</li>
<li class="mb-4">
<a target="_blank" href="../gdpr" class="hover:underline">GDPR</a>
</li>
</ul>
</div>
</div>
<hr class="my-6 border-[#0f0f17] sm:mx-auto lg:my-8">
<span class="block mb-6 text-sm text-gray-400 lg:mb-0 text-center">
Copyright © 2020 - <script>document.write(new Date().getFullYear())</script> KeyAuth LLC. All Rights Reserved.
</span>
</div>
</footer>
<!-- jqeury -->
<script src="https://cdn.keyauth.cc/v3/scripts/jquery.min.js"></script>
<!--Flowbite JS-->
<script src="https://cdn.keyauth.cc/v3/dist/flowbite.js"></script>
</body>
</html>

3
docs/index.php Normal file
View File

@@ -0,0 +1,3 @@
<?php
header("Location: https://keyauthdocs.apidog.io");
exit();

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

469
free-trial/index.html Normal file
View File

@@ -0,0 +1,469 @@
<!DOCTYPE html>
<html lang="en" class="bg-[#09090d] text-white overflow-x-hidden">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="KeyAuth - Open Source Auth">
<meta
content="Secure your software against piracy, an issue causing $422 million in losses annually - Fair pricing & Features not seen in competitors"
name="description" />
<meta content="KeyAuth" name="author" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords"
content="KeyAuth, Cloud Authentication, Key Authentication,Authentication, API authentication,Security, Encryption authentication, Authenticated encryption, Cybersecurity, Developer, SaaS, Software Licensing, Licensing" />
<meta property="og:description"
content="Secure your software against piracy, an issue causing $422 million in losses annually - Fair pricing & Features not seen in competitors" />
<meta property="og:image" content="https://cdn.keyauth.cc/front/assets/img/favicon.png" />
<meta property="og:site_name" content="KeyAuth | Secure your software from piracy." />
<link rel="shortcut icon" type="image/jpg" href="https://cdn.keyauth.cc/front/assets/img/favicon.png">
<!-- Schema.org markup for Google+ -->
<meta itemprop="name" content="KeyAuth - Open Source Auth">
<meta itemprop="description"
content="Secure your software against piracy, an issue causing $422 million in losses annually - Fair pricing & Features not seen in competitors">
<meta itemprop="image" content="https://cdn.keyauth.cc/front/assets/img/favicon.png">
<!-- Twitter Card data -->
<meta name="twitter:card" content="product">
<meta name="twitter:site" content="@keyauth">
<meta name="twitter:title" content="KeyAuth - Open Source Auth">
<meta name="twitter:description"
content="Secure your software against piracy, an issue causing $422 million in losses annually - Fair pricing & Features not seen in competitors">
<meta name="twitter:creator" content="@keyauth">
<meta name="twitter:image" content="https://cdn.keyauth.cc/front/assets/img/favicon.png">
<!-- Open Graph data -->
<meta property="og:title" content="KeyAuth - Open Source Auth" />
<meta property="og:type" content="website" />
<meta property="og:url" content="./" />
<meta name="apple-itunes-app" content="app-id=6503321465">
<title>KeyAuth - Free Trial</title>
<!-- Canonical SEO -->
<link rel="canonical" href="https://keyauth.cc" />
<link rel="stylesheet" href="https://cdn.keyauth.cc/v3/scripts/animate.min.css" />
<link rel="stylesheet" href="https://cdn.keyauth.cc/v3/dist/output.css">
</head>
<body>
<header>
<nav class="border-gray-200 px-4 lg:px-6 py-2.5 mb-14">
<div class="flex flex-wrap justify-between items-center mx-auto max-w-screen-xl">
<a href="../" class="flex items-center">
<img src="https://cdn.keyauth.cc/v2/assets/media/logos/logo-1-dark.png" class="mr-3 h-12 mt-2"
alt="KeyAuth Logo" />
</a>
<div class="flex items-center lg:order-2">
<a href="../login"
class="text-white focus:ring-0 font-medium rounded-lg text-sm px-4 py-2 lg:px-5 lg:py-2.5 mr-2 hover:opacity-60 transition duration-200 focus:outline-none focus:ring-gray-800">
Client Area
</a>
<a href="../register"
class="text-white focus:ring-0 font-medium rounded-lg text-sm px-4 py-2 lg:px-5 lg:py-2.5 mr-2 bg-blue-600 hover:opacity-80 focus:outline-none focus:ring-blue-800 transition duration-200">
Onboard Now
</a>
<button data-collapse-toggle="mmenu" type="button"
class="inline-flex items-center p-2 ml-1 text-sm text-gray-500 rounded-lg lg:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 "
aria-controls="mmenu" aria-expanded="false">
<span class="sr-only">Open main menu</span>
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
clip-rule="evenodd"></path>
</svg>
<svg class="hidden w-6 h-6" fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clip-rule="evenodd"></path>
</svg>
</button>
</div>
<div class="hidden justify-between items-center w-full lg:flex lg:w-auto lg:order-1" id="mmenu">
<ul class="flex flex-col mt-4 font-medium lg:flex-row lg:space-x-8 lg:mt-0">
<li>
<a href="../"
class="block py-2 pr-4 pl-3 border-b lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700 hover:text-white lg:hover:bg-transparent border-gray-700 transition duration-200"
aria-current="page">Home</a>
</li>
<li>
<a href="../#features"
class="block py-2 pr-4 pl-3 border-b lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700 hover:text-white lg:hover:bg-transparent border-gray-700 transition duration-200">Features</a>
</li>
<li>
<button id="mm-button" data-dropdown-toggle="mm"
class="flex justify-between items-center py-2 pr-4 pl-3 w-full font-medium border-b lg:w-auto lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700hover:text-white lg:hover:bg-transparent border-gray-700 hover:text-white transition duration-200">Insights
<svg class="ml-1 w-5 h-5 lg:w-4 lg:h-4" fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
clip-rule="evenodd"></path>
</svg></button>
<div id="mm"
class="grid hidden absolute z-10 w-full border shadow-md border-[#0f0f17] lg:rounded-lg lg:w-auto lg:grid-cols-3 bg-[#0f0f17]">
<div class="p-2 bg-[#09090d] lg:rounded-lg text-white lg:col-span-2">
<ul>
<li>
<a href="https://youtube.com/keyauth" target="_blank"
class="flex items-center p-3 rounded-lg hover:bg-[#0f0f17]">
<div class="p-2 mr-4 rounded-lg shadow bg-[#0f0f17]">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M21.593 7.203a2.506 2.506 0 0 0-1.762-1.766c-1.566-.43-7.83-.437-7.83-.437s-6.265-.007-7.832.404a2.56 2.56 0 0 0-1.766 1.778c-.413 1.566-.417 4.814-.417 4.814s-.004 3.264.406 4.814c.23.857.905 1.534 1.763 1.765 1.582.43 7.83.437 7.83.437s6.265.007 7.831-.403a2.515 2.515 0 0 0 1.767-1.763c.414-1.565.417-4.812.417-4.812s.02-3.265-.407-4.831ZM9.996 15.005l.005-6 5.207 3.005-5.212 2.995Z">
</path>
</svg>
</div>
<div>
<div class="font-semibold">
Explore Our YouTube Channel
</div>
<div class="text-sm font-light text-gray-400">Watch Feature
Showcases and Updates on YouTube.</div>
</div>
</a>
</li>
<li>
<a href="https://t.me/keyauth" target="_blank"
class="flex items-center p-3 rounded-lg hover:bg-[#0f0f17]">
<div class="p-2 mr-4 rounded-lg shadow bg-[#0f0f17]">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="m20.665 3.72-17.73 6.837c-1.21.486-1.203 1.16-.222 1.462l4.552 1.42 10.532-6.645c.498-.303.953-.14.579.192l-8.533 7.7H9.84l.002.002-.314 4.692c.46 0 .663-.211.92-.46l2.212-2.15 4.599 3.397c.848.467 1.457.227 1.668-.785l3.019-14.228c.309-1.24-.473-1.8-1.282-1.434Z">
</path>
</svg>
</div>
<div>
<div class="font-semibold">
Connect on Our Telegram Platform
</div>
<div class="text-sm font-light text-gray-400">Connect and
Communicate on Telegram.</div>
</div>
</a>
</li>
<li>
<a href="https://github.com/keyauth" target="_blank"
class="flex items-center p-3 rounded-lg hover:bg-[#0f0f17]">
<div class="p-2 mr-4 rounded-lg shadow bg-[#0f0f17]">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M12.026 2a9.973 9.973 0 0 0-9.974 9.974c0 4.406 2.857 8.145 6.82 9.465.5.09.68-.217.68-.481 0-.237-.008-.865-.011-1.696-2.775.602-3.361-1.338-3.361-1.338-.452-1.152-1.107-1.459-1.107-1.459-.905-.619.069-.605.069-.605 1.002.07 1.527 1.028 1.527 1.028.89 1.524 2.336 1.084 2.902.829.09-.645.35-1.085.635-1.334-2.214-.251-4.542-1.107-4.542-4.93 0-1.087.389-1.979 1.024-2.675-.101-.253-.446-1.268.099-2.64 0 0 .837-.269 2.742 1.021a9.582 9.582 0 0 1 2.496-.336 9.555 9.555 0 0 1 2.496.336c1.906-1.291 2.742-1.021 2.742-1.021.545 1.372.203 2.387.099 2.64.64.696 1.024 1.587 1.024 2.675 0 3.833-2.33 4.675-4.552 4.922.355.308.675.916.675 1.846 0 1.334-.012 2.41-.012 2.737 0 .267.178.577.687.479C19.146 20.115 22 16.379 22 11.974 22 6.465 17.535 2 12.026 2Z"
clip-rule="evenodd"></path>
</svg>
</div>
<div>
<div class="font-semibold">
Explore Our GitHub Repositories
</div>
<div class="text-sm font-light text-gray-400">Explore Official
Examples on GitHub.</div>
</div>
</a>
</li>
<li>
<a href="https://twitter.com/KeyAuth" target="_blank"
class="flex items-center p-3 rounded-lg hover:bg-[#0f0f17]">
<div class="p-2 mr-4 rounded-lg shadow bg-[#0f0f17]">
<svg class="w-5 h-5" fill="currentColor" version="1.1" id="svg5"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 1668.56 1221.19"
style="enable-background:new 0 0 1668.56 1221.19;"
xml:space="preserve">
<g id="layer1" transform="translate(52.390088,-25.058597)">
<path id="path1009"
d="M283.94,167.31l386.39,516.64L281.5,1104h87.51l340.42-367.76L984.48,1104h297.8L874.15,558.3l361.92-390.99
h-87.51l-313.51,338.7l-253.31-338.7H283.94z M412.63,231.77h136.81l604.13,807.76h-136.81L412.63,231.77z" />
</g>
</svg>
</div>
<div>
<div class="font-semibold">
Follow Us on X / Twitter
</div>
<div class="text-sm font-light text-gray-400">Stay Informed with the
Latest on X / Twitter.</div>
</div>
</a>
</li>
</ul>
</div>
<div class="py-5 px-5 lg:rounded-lg lg:col-span-1 bg-[#0f0f17]">
<h3 class="mb-4 text-sm font-semibold text-white">Explore Our Examples</h3>
<ul class="space-y-4 text-sm text-gray-400">
<li>
<a href="https://github.com/KeyAuth/KeyAuth-CPP-Example"
class="hover:text-blue-500" target="_blank">
C++
</a>
</li>
<li>
<a href="https://github.com/KeyAuth/KeyAuth-CSHARP-Example"
class="hover:text-blue-500" target="_blank">
C# (CSharp)
</a>
</li>
<li>
<a href="https://github.com/mazkdevf/KeyAuth-JS-Example"
class="hover:text-blue-500" target="_blank">
JavaScript
</a>
</li>
<li>
<a href="https://github.com/KeyAuth/KeyAuth-Python-Example"
class="hover:text-blue-500" target="_blank">
Python
</a>
</li>
<li>
<a href="https://github.com/KeyAuth/KeyAuth-PHP-Example"
class="hover:text-blue-500" target="_blank">
PHP
</a>
</li>
<li>
<a href="https://github.com/KeyAuth/KeyAuth-Rust-Example"
class="hover:text-blue-500" target="_blank">
Rust
</a>
</li>
<li>
<a href="https://github.com/KeyAuth-Archive/KeyAuth-JAVA-api"
class="hover:text-blue-500" target="_blank">
Java
</a>
</li>
<li>
<a href="https://github.com/mazkdevf/KeyAuth-Ruby-Example"
class="hover:text-blue-500" target="_blank">
Ruby
</a>
</li>
</ul>
</div>
</div>
</li>
<li>
<a href="../#plans"
class="block py-2 pr-4 pl-3 border-b lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700 hover:text-white lg:hover:bg-transparent border-gray-700 transition duration-200">
Plans
</a>
</li>
<li>
<a href="../#team"
class="block py-2 pr-4 pl-3 border-b lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700 hover:text-white lg:hover:bg-transparent border-gray-700 transition duration-200">
Our Team
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<section class="mb-8 -mt-8">
<div class="py-8 px-4 mx-auto max-w-screen-xl sm:py-16 lg:px-6">
<div class="">
<h2 class="mb-4 text-3xl tracking-tight font-extrabold leading-tight text-white">Free trial - demo
accounts</h2>
<p class="mb-6 font-light text-gray-400 md:text-lg">
You can use these demo accounts to try out paid features before purchase.<br><br>The data on these
accounts are <b><u>wiped after 7 days automatically</u></b>. Don't store anything important on
them.<br><br>Account logs for these accounts have been turned off, and account settings is disabled
as well. These accounts are safe to login to.
</p>
<h2 class="text-xl text-blue-700 font-extrabold">Seller account</h2>
<p><b>Username:</b> <code>demoseller</code><br><b>Password:</b> <code>Ge24V@fe234</code></p><br>
<h2 class="text-xl text-green-500 font-extrabold">Developer account</h2>
<p><b>Username:</b> <code>demodeveloper</code><br><b>Password:</b> <code>Ge54o@bt844</code></p>
</div>
</div>
</section>
<footer>
<div class="p-4 py-6 mx-auto max-w-screen-xl md:p-8 lg:-10 pt-32 md:pt-0">
<div class="grid grid-cols-2 gap-8 lg:grid-cols-6">
<div class="col-span-2">
<a href="../" class="flex items-center mb-2 text-2xl font-semibold text-white lg:mb-0">
KeyAuth LLC
</a>
<p class="my-4 font-light text-gray-400">
KeyAuth is a game-changing, affordable and easy to use licensing solution for your software.
</p>
<ul class="flex mt-5 space-x-6">
<li>
<a target="_blank" href="https://youtube.com/keyauth"
class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M21.593 7.203a2.506 2.506 0 0 0-1.762-1.766c-1.566-.43-7.83-.437-7.83-.437s-6.265-.007-7.832.404a2.56 2.56 0 0 0-1.766 1.778c-.413 1.566-.417 4.814-.417 4.814s-.004 3.264.406 4.814c.23.857.905 1.534 1.763 1.765 1.582.43 7.83.437 7.83.437s6.265.007 7.831-.403a2.515 2.515 0 0 0 1.767-1.763c.414-1.565.417-4.812.417-4.812s.02-3.265-.407-4.831ZM9.996 15.005l.005-6 5.207 3.005-5.212 2.995Z">
</path>
</svg>
</a>
</li>
<li>
<a target="_blank" href="https://github.com/KeyAuth/"
class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M12.026 2a9.973 9.973 0 0 0-9.974 9.974c0 4.406 2.857 8.145 6.82 9.465.5.09.68-.217.68-.481 0-.237-.008-.865-.011-1.696-2.775.602-3.361-1.338-3.361-1.338-.452-1.152-1.107-1.459-1.107-1.459-.905-.619.069-.605.069-.605 1.002.07 1.527 1.028 1.527 1.028.89 1.524 2.336 1.084 2.902.829.09-.645.35-1.085.635-1.334-2.214-.251-4.542-1.107-4.542-4.93 0-1.087.389-1.979 1.024-2.675-.101-.253-.446-1.268.099-2.64 0 0 .837-.269 2.742 1.021a9.582 9.582 0 0 1 2.496-.336 9.555 9.555 0 0 1 2.496.336c1.906-1.291 2.742-1.021 2.742-1.021.545 1.372.203 2.387.099 2.64.64.696 1.024 1.587 1.024 2.675 0 3.833-2.33 4.675-4.552 4.922.355.308.675.916.675 1.846 0 1.334-.012 2.41-.012 2.737 0 .267.178.577.687.479C19.146 20.115 22 16.379 22 11.974 22 6.465 17.535 2 12.026 2Z"
clip-rule="evenodd"></path>
</svg>
</a>
</li>
<li>
<a target="_blank" href="https://twitter.com/KeyAuth"
class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M19.633 7.994c.013.175.013.349.013.523 0 5.325-4.053 11.46-11.46 11.46A11.38 11.38 0 0 1 2 18.169c.324.037.636.05.973.05a8.07 8.07 0 0 0 5.001-1.721 4.036 4.036 0 0 1-3.767-2.793c.249.037.499.062.761.062.361 0 .724-.05 1.061-.137a4.027 4.027 0 0 1-3.23-3.953v-.05a4.05 4.05 0 0 0 1.82.51 4.022 4.022 0 0 1-1.796-3.353c0-.748.199-1.434.548-2.032a11.457 11.457 0 0 0 8.306 4.215c-.062-.3-.1-.611-.1-.923a4.024 4.024 0 0 1 4.028-4.028c1.16 0 2.207.486 2.943 1.272a7.957 7.957 0 0 0 2.556-.973c-.3.93-.93 1.72-1.771 2.22a8.074 8.074 0 0 0 2.319-.624 8.646 8.646 0 0 1-2.019 2.083Z">
</path>
</svg>
</a>
</li>
<li>
<a target="_blank" href="#" class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M11.999 7.375a4.624 4.624 0 1 0 0 9.248 4.624 4.624 0 0 0 0-9.248Zm0 7.627a3.004 3.004 0 1 1 0-6.008 3.004 3.004 0 0 1 0 6.008Z">
</path>
<path d="M16.805 8.289a1.078 1.078 0 1 0 0-2.156 1.078 1.078 0 0 0 0 2.156Z"></path>
<path
d="M20.533 6.114A4.605 4.605 0 0 0 17.9 3.482a6.607 6.607 0 0 0-2.186-.42c-.963-.042-1.268-.054-3.71-.054s-2.755 0-3.71.054a6.554 6.554 0 0 0-2.184.42 4.6 4.6 0 0 0-2.633 2.632A6.585 6.585 0 0 0 3.058 8.3c-.043.962-.056 1.267-.056 3.71 0 2.442 0 2.753.056 3.71.015.748.156 1.486.419 2.187a4.61 4.61 0 0 0 2.634 2.632 6.583 6.583 0 0 0 2.185.45c.963.042 1.268.055 3.71.055s2.755 0 3.71-.055a6.616 6.616 0 0 0 2.186-.42 4.613 4.613 0 0 0 2.633-2.632c.263-.7.404-1.438.419-2.186.043-.962.056-1.267.056-3.71s0-2.753-.056-3.71a6.583 6.583 0 0 0-.421-2.217Zm-1.218 9.532a5.046 5.046 0 0 1-.311 1.688 2.987 2.987 0 0 1-1.712 1.71c-.535.2-1.1.305-1.67.312-.95.044-1.218.055-3.654.055-2.438 0-2.687 0-3.655-.055a4.961 4.961 0 0 1-1.67-.311 2.985 2.985 0 0 1-1.718-1.711 5.08 5.08 0 0 1-.311-1.67c-.043-.95-.053-1.217-.053-3.653 0-2.437 0-2.686.053-3.655a5.038 5.038 0 0 1 .311-1.687c.305-.79.93-1.41 1.719-1.712a5.01 5.01 0 0 1 1.669-.311c.95-.043 1.218-.055 3.655-.055s2.687 0 3.654.055a4.96 4.96 0 0 1 1.67.31 2.99 2.99 0 0 1 1.712 1.713 5.06 5.06 0 0 1 .311 1.669c.043.95.054 1.218.054 3.655 0 2.436 0 2.698-.043 3.654h-.011v-.001Z">
</path>
</svg>
</a>
</li>
<li>
<a target="_blank" href="https://www.tiktok.com/@keyauth"
class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-5.2 1.74 2.89 2.89 0 0 1 2.31-4.64c.298-.002.595.042.88.13V9.4A6.33 6.33 0 0 0 5 20.1a6.34 6.34 0 0 0 10.86-4.43v-7a8.16 8.16 0 0 0 4.77 1.52v-3.4a4.85 4.85 0 0 1-1-.1h-.04Z">
</path>
</svg>
</a>
</li>
</ul>
</div>
<div class="lg:mx-auto">
<h3 class="mb-6 text-sm font-semibold uppercase text-white">Links</h3>
<ul class="text-gray-500 ">
<li class="mb-4">
<a href="https://www.youtube.com/keyauth" target="_blank"
class="hover:underline">Youtube</a>
</li>
<li class="mb-4">
<a href="https://github.com/keyauth" target="_blank" class="hover:underline">GitHub</a>
</li>
<li class="mb-4">
<a href="https://keyauthdocs.apidog.io" target="_blank"
class="hover:underline">Documentation</a>
</li>
</ul>
</div>
<div class="lg:mx-auto">
<h2 class="mb-6 text-sm font-semibold uppercase text-white">
Most Used Examples
</h2>
<ul class="text-gray-500 ">
<li class="mb-4">
<a target="_blank" href="https://github.com/KeyAuth/KeyAuth-CPP-Example"
class="hover:underline">
C++ <span class="text-xs">(CPP)</span>
</a>
</li>
<li class="mb-4">
<a target="_blank" href="https://github.com/KeyAuth/KeyAuth-CSHARP-Example"
class="hover:underline">C# <span class="text-xs">(CSharp)</span></a>
</li>
<li class="mb-4">
<a target="_blank" href="https://github.com/mazkdevf/KeyAuth-JS-Example"
class="hover:underline">JavaScript <span class="text-xs">(JS)</span></a>
</li>
<li class="mb-4">
<a target="_blank" href="https://github.com/KeyAuth/KeyAuth-Python-Example"
class="hover:underline">Python <span class="text-xs">(PY)</span></a>
</li>
</ul>
</div>
<div class="lg:mx-auto">
<h2 class="mb-6 text-sm font-semibold uppercase text-white">Other & Support</h2>
<ul class="text-gray-500 ">
<li class="mb-4">
<a target="_blank" href="https://chatting.page/gjqkqirygnfslvce2m5eycuo7tfxrhxl" class="hover:underline">
Support Center
</a>
</li>
<li class="mb-4">
<a target="_blank" href="../free-trial/" class="hover:underline">
Demo Accounts
</a>
</li>
<li class="mb-4">
<a target="_blank" href="https://t.me/keyauth" class="hover:underline">
Telegram
</a>
</li>
</ul>
</div>
<div class="lg:mx-auto">
<h2 class="mb-6 text-sm font-semibold uppercase text-white">Legal</h2>
<ul class="text-gray-500 ">
<li class="mb-4">
<a target="_blank" href="../terms" class="hover:underline">Terms of Service</a>
</li>
<li class="mb-4">
<a target="_blank" href="../privacy" class="hover:underline">Privacy Policy</a>
</li>
<li class="mb-4">
<a target="_blank" href="https://github.com/KeyAuth/KeyAuth-Source-Code/blob/main/LICENSE"
class="hover:underline">Licensing</a>
</li>
<li class="mb-4">
<a target="_blank" href="../gdpr" class="hover:underline">GDPR</a>
</li>
</ul>
</div>
</div>
<hr class="my-6 border-[#0f0f17] sm:mx-auto lg:my-8">
<span class="block mb-6 text-sm text-gray-400 lg:mb-0 text-center">Copyright © 2020 - <script>document.write(new Date().getFullYear())</script> KeyAuth LLC. All Rights Reserved.
</span>
</div>
</footer>
<!-- jqeury -->
<script src="https://cdn.keyauth.cc/v3/scripts/jquery.min.js"></script>
<!--Flowbite JS-->
<script src="https://cdn.keyauth.cc/v3/dist/flowbite.js"></script>
</body>
</html>

487
gdpr/index.html Normal file
View File

@@ -0,0 +1,487 @@
<!DOCTYPE html>
<html lang="en" class="bg-[#09090d] text-white overflow-x-hidden">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="KeyAuth - Open Source Auth">
<meta
content="Secure your software against piracy, an issue causing $422 million in losses annually - Fair pricing & Features not seen in competitors"
name="description" />
<meta content="KeyAuth" name="author" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords"
content="KeyAuth, Cloud Authentication, Key Authentication,Authentication, API authentication,Security, Encryption authentication, Authenticated encryption, Cybersecurity, Developer, SaaS, Software Licensing, Licensing" />
<meta property="og:description"
content="Secure your software against piracy, an issue causing $422 million in losses annually - Fair pricing & Features not seen in competitors" />
<meta property="og:image" content="https://cdn.keyauth.cc/front/assets/img/favicon.png" />
<meta property="og:site_name" content="KeyAuth | Secure your software from piracy." />
<link rel="shortcut icon" type="image/jpg" href="https://cdn.keyauth.cc/front/assets/img/favicon.png">
<!-- Schema.org markup for Google+ -->
<meta itemprop="name" content="KeyAuth - Open Source Auth">
<meta itemprop="description"
content="Secure your software against piracy, an issue causing $422 million in losses annually - Fair pricing & Features not seen in competitors">
<meta itemprop="image" content="https://cdn.keyauth.cc/front/assets/img/favicon.png">
<!-- Twitter Card data -->
<meta name="twitter:card" content="product">
<meta name="twitter:site" content="@keyauth">
<meta name="twitter:title" content="KeyAuth - Open Source Auth">
<meta name="twitter:description"
content="Secure your software against piracy, an issue causing $422 million in losses annually - Fair pricing & Features not seen in competitors">
<meta name="twitter:creator" content="@keyauth">
<meta name="twitter:image" content="https://cdn.keyauth.cc/front/assets/img/favicon.png">
<!-- Open Graph data -->
<meta property="og:title" content="KeyAuth - Open Source Auth" />
<meta property="og:type" content="website" />
<meta property="og:url" content="./" />
<meta name="apple-itunes-app" content="app-id=6503321465">
<title>KeyAuth - GDPR</title>
<!-- Canonical SEO -->
<link rel="canonical" href="https://keyauth.cc" />
<link rel="stylesheet" href="https://cdn.keyauth.cc/v3/scripts/animate.min.css" />
<link rel="stylesheet" href="https://cdn.keyauth.cc/v3/dist/output.css">
</head>
<body>
<header>
<nav class="border-gray-200 px-4 lg:px-6 py-2.5 mb-14">
<div class="flex flex-wrap justify-between items-center mx-auto max-w-screen-xl">
<a href="../" class="flex items-center">
<img src="https://cdn.keyauth.cc/v2/assets/media/logos/logo-1-dark.png" class="mr-3 h-12 mt-2"
alt="KeyAuth Logo" />
</a>
<div class="flex items-center lg:order-2">
<a href="../login"
class="text-white focus:ring-0 font-medium rounded-lg text-sm px-4 py-2 lg:px-5 lg:py-2.5 mr-2 hover:opacity-60 transition duration-200 focus:outline-none focus:ring-gray-800">
Client Area
</a>
<a href="../register"
class="text-white focus:ring-0 font-medium rounded-lg text-sm px-4 py-2 lg:px-5 lg:py-2.5 mr-2 bg-blue-600 hover:opacity-80 focus:outline-none focus:ring-blue-800 transition duration-200">
Onboard Now
</a>
<button data-collapse-toggle="mmenu" type="button"
class="inline-flex items-center p-2 ml-1 text-sm text-gray-500 rounded-lg lg:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 "
aria-controls="mmenu" aria-expanded="false">
<span class="sr-only">Open main menu</span>
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
clip-rule="evenodd"></path>
</svg>
<svg class="hidden w-6 h-6" fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clip-rule="evenodd"></path>
</svg>
</button>
</div>
<div class="hidden justify-between items-center w-full lg:flex lg:w-auto lg:order-1" id="mmenu">
<ul class="flex flex-col mt-4 font-medium lg:flex-row lg:space-x-8 lg:mt-0">
<li>
<a href="../"
class="block py-2 pr-4 pl-3 border-b lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700 hover:text-white lg:hover:bg-transparent border-gray-700 transition duration-200"
aria-current="page">Home</a>
</li>
<li>
<a href="#features"
class="block py-2 pr-4 pl-3 border-b lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700 hover:text-white lg:hover:bg-transparent border-gray-700 transition duration-200">Features</a>
</li>
<li>
<button id="mm-button" data-dropdown-toggle="mm"
class="flex justify-between items-center py-2 pr-4 pl-3 w-full font-medium border-b lg:w-auto lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700hover:text-white lg:hover:bg-transparent border-gray-700 hover:text-white transition duration-200">Insights
<svg class="ml-1 w-5 h-5 lg:w-4 lg:h-4" fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
clip-rule="evenodd"></path>
</svg></button>
<div id="mm"
class="grid hidden absolute z-10 w-full border shadow-md border-[#0f0f17] lg:rounded-lg lg:w-auto lg:grid-cols-3 bg-[#0f0f17]">
<div class="p-2 bg-[#09090d] lg:rounded-lg text-white lg:col-span-2">
<ul>
<li>
<a href="https://youtube.com/keyauth" target="_blank"
class="flex items-center p-3 rounded-lg hover:bg-[#0f0f17]">
<div class="p-2 mr-4 rounded-lg shadow bg-[#0f0f17]">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M21.593 7.203a2.506 2.506 0 0 0-1.762-1.766c-1.566-.43-7.83-.437-7.83-.437s-6.265-.007-7.832.404a2.56 2.56 0 0 0-1.766 1.778c-.413 1.566-.417 4.814-.417 4.814s-.004 3.264.406 4.814c.23.857.905 1.534 1.763 1.765 1.582.43 7.83.437 7.83.437s6.265.007 7.831-.403a2.515 2.515 0 0 0 1.767-1.763c.414-1.565.417-4.812.417-4.812s.02-3.265-.407-4.831ZM9.996 15.005l.005-6 5.207 3.005-5.212 2.995Z">
</path>
</svg>
</div>
<div>
<div class="font-semibold">
Explore Our YouTube Channel
</div>
<div class="text-sm font-light text-gray-400">Watch Feature
Showcases and Updates on YouTube.</div>
</div>
</a>
</li>
<li>
<a href="https://t.me/keyauth" target="_blank"
class="flex items-center p-3 rounded-lg hover:bg-[#0f0f17]">
<div class="p-2 mr-4 rounded-lg shadow bg-[#0f0f17]">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="m20.665 3.72-17.73 6.837c-1.21.486-1.203 1.16-.222 1.462l4.552 1.42 10.532-6.645c.498-.303.953-.14.579.192l-8.533 7.7H9.84l.002.002-.314 4.692c.46 0 .663-.211.92-.46l2.212-2.15 4.599 3.397c.848.467 1.457.227 1.668-.785l3.019-14.228c.309-1.24-.473-1.8-1.282-1.434Z">
</path>
</svg>
</div>
<div>
<div class="font-semibold">
Connect on Our Telegram Platform
</div>
<div class="text-sm font-light text-gray-400">Connect and
Communicate on Telegram.</div>
</div>
</a>
</li>
<li>
<a href="https://github.com/keyauth" target="_blank"
class="flex items-center p-3 rounded-lg hover:bg-[#0f0f17]">
<div class="p-2 mr-4 rounded-lg shadow bg-[#0f0f17]">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M12.026 2a9.973 9.973 0 0 0-9.974 9.974c0 4.406 2.857 8.145 6.82 9.465.5.09.68-.217.68-.481 0-.237-.008-.865-.011-1.696-2.775.602-3.361-1.338-3.361-1.338-.452-1.152-1.107-1.459-1.107-1.459-.905-.619.069-.605.069-.605 1.002.07 1.527 1.028 1.527 1.028.89 1.524 2.336 1.084 2.902.829.09-.645.35-1.085.635-1.334-2.214-.251-4.542-1.107-4.542-4.93 0-1.087.389-1.979 1.024-2.675-.101-.253-.446-1.268.099-2.64 0 0 .837-.269 2.742 1.021a9.582 9.582 0 0 1 2.496-.336 9.555 9.555 0 0 1 2.496.336c1.906-1.291 2.742-1.021 2.742-1.021.545 1.372.203 2.387.099 2.64.64.696 1.024 1.587 1.024 2.675 0 3.833-2.33 4.675-4.552 4.922.355.308.675.916.675 1.846 0 1.334-.012 2.41-.012 2.737 0 .267.178.577.687.479C19.146 20.115 22 16.379 22 11.974 22 6.465 17.535 2 12.026 2Z"
clip-rule="evenodd"></path>
</svg>
</div>
<div>
<div class="font-semibold">
Explore Our GitHub Repositories
</div>
<div class="text-sm font-light text-gray-400">Explore Official
Examples on GitHub.</div>
</div>
</a>
</li>
<li>
<a href="https://twitter.com/KeyAuth" target="_blank"
class="flex items-center p-3 rounded-lg hover:bg-[#0f0f17]">
<div class="p-2 mr-4 rounded-lg shadow bg-[#0f0f17]">
<svg class="w-5 h-5" fill="currentColor" version="1.1" id="svg5"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 1668.56 1221.19"
style="enable-background:new 0 0 1668.56 1221.19;"
xml:space="preserve">
<g id="layer1" transform="translate(52.390088,-25.058597)">
<path id="path1009"
d="M283.94,167.31l386.39,516.64L281.5,1104h87.51l340.42-367.76L984.48,1104h297.8L874.15,558.3l361.92-390.99
h-87.51l-313.51,338.7l-253.31-338.7H283.94z M412.63,231.77h136.81l604.13,807.76h-136.81L412.63,231.77z" />
</g>
</svg>
</div>
<div>
<div class="font-semibold">
Follow Us on X / Twitter
</div>
<div class="text-sm font-light text-gray-400">Stay Informed with the
Latest on X / Twitter.</div>
</div>
</a>
</li>
</ul>
</div>
<div class="py-5 px-5 lg:rounded-lg lg:col-span-1 bg-[#0f0f17]">
<h3 class="mb-4 text-sm font-semibold text-white">Explore Our Examples</h3>
<ul class="space-y-4 text-sm text-gray-400">
<li>
<a href="https://github.com/KeyAuth/KeyAuth-CPP-Example"
class="hover:text-blue-500" target="_blank">
C++
</a>
</li>
<li>
<a href="https://github.com/KeyAuth/KeyAuth-CSHARP-Example"
class="hover:text-blue-500" target="_blank">
C# (CSharp)
</a>
</li>
<li>
<a href="https://github.com/mazkdevf/KeyAuth-JS-Example"
class="hover:text-blue-500" target="_blank">
JavaScript
</a>
</li>
<li>
<a href="https://github.com/KeyAuth/KeyAuth-Python-Example"
class="hover:text-blue-500" target="_blank">
Python
</a>
</li>
<li>
<a href="https://github.com/KeyAuth/KeyAuth-PHP-Example"
class="hover:text-blue-500" target="_blank">
PHP
</a>
</li>
<li>
<a href="https://github.com/KeyAuth/KeyAuth-Rust-Example"
class="hover:text-blue-500" target="_blank">
Rust
</a>
</li>
<li>
<a href="https://github.com/KeyAuth-Archive/KeyAuth-JAVA-api"
class="hover:text-blue-500" target="_blank">
Java
</a>
</li>
<li>
<a href="https://github.com/mazkdevf/KeyAuth-Ruby-Example"
class="hover:text-blue-500" target="_blank">
Ruby
</a>
</li>
</ul>
</div>
</div>
</li>
<li>
<a href="#plans"
class="block py-2 pr-4 pl-3 border-b lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700 hover:text-white lg:hover:bg-transparent border-gray-700 transition duration-200">
Plans
</a>
</li>
<li>
<a href="#team"
class="block py-2 pr-4 pl-3 border-b lg:hover:bg-transparent lg:border-0 lg:p-0 text-gray-400 hover:bg-gray-700 hover:text-white lg:hover:bg-transparent border-gray-700 transition duration-200">
Our Team
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<section class="">
<div class="py-8 px-4 mx-auto max-w-screen-xl sm:py-16 lg:px-6">
<div class="">
<h2 class="mb-4 text-3xl tracking-tight font-extrabold leading-tight text-white">GDPR - How to delete
KeyAuth Account?</h2>
<p class="mb-6 font-light text-gray-400 md:text-lg">While we're not beholden to the GDPR laws, we do
believe privacy should be a fundamental human
right.<br><br>You can delete your account at <a href="https://keyauth.cc/deleteAccount/"
target="_blank" class="text-blue-600 hover:underline">https://keyauth.cc/deleteAccount/</a>. It does not require any intervention from
us. Just
enter your email (which we only stored hashed with SHA1😊) and you'll be emailed a link to confirm
the
deletion of your account.</p>
<script
src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2FKeyAuth%2FKeyAuth-Source-Code%2Fblob%2F36554b3d26d917a223df08ca0b6d5539b9341d3c%2Fregister%2Findex.php%23L310-L313&style=a11y-dark&type=code&showBorder=on&showLineNumbers=on&showFileMeta=on&showFullPath=on&showCopy=on&fetchFromJsDelivr=on"></script>
<p>As soon as you click the confirmation link, all of your data is wiped from our database. If you wish
to come
back, you should make a new account.<br><br>If your account was stolen and then deleted, you should
contact
support <a href="https://chatting.page/gjqkqirygnfslvce2m5eycuo7tfxrhxl"
target="_blank" class="text-blue-600 hover:underline">https://chatting.page/gjqkqirygnfslvce2m5eycuo7tfxrhxl</a>. We may be able to recover your account
if it still exists in a recent database backup file.<br><br>We don't provide a way to
<b><u>fully</u></b> export your data currently. This may come in the future. We do offer the ability
to
export certain application data to users who have purchased the Seller Plan <a
href="https://keyauthdocs.apidog.io/sellerapi/users/retrieve-all-users"
target="_blank" class="text-blue-600 hover:underline">https://keyauthdocs.apidog.io/sellerapi/users/retrieve-all-users</a>
</p>
</div>
</div>
</section>
<footer>
<div class="p-4 py-6 mx-auto max-w-screen-xl md:p-8 lg:-10 pt-32 md:pt-0">
<div class="grid grid-cols-2 gap-8 lg:grid-cols-6">
<div class="col-span-2">
<a href="../" class="flex items-center mb-2 text-2xl font-semibold text-white lg:mb-0">
KeyAuth LLC
</a>
<p class="my-4 font-light text-gray-400">
KeyAuth is a game-changing, affordable and easy to use licensing solution for your software.
</p>
<ul class="flex mt-5 space-x-6">
<li>
<a target="_blank" href="https://youtube.com/keyauth"
class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M21.593 7.203a2.506 2.506 0 0 0-1.762-1.766c-1.566-.43-7.83-.437-7.83-.437s-6.265-.007-7.832.404a2.56 2.56 0 0 0-1.766 1.778c-.413 1.566-.417 4.814-.417 4.814s-.004 3.264.406 4.814c.23.857.905 1.534 1.763 1.765 1.582.43 7.83.437 7.83.437s6.265.007 7.831-.403a2.515 2.515 0 0 0 1.767-1.763c.414-1.565.417-4.812.417-4.812s.02-3.265-.407-4.831ZM9.996 15.005l.005-6 5.207 3.005-5.212 2.995Z">
</path>
</svg>
</a>
</li>
<li>
<a target="_blank" href="https://github.com/KeyAuth/"
class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M12.026 2a9.973 9.973 0 0 0-9.974 9.974c0 4.406 2.857 8.145 6.82 9.465.5.09.68-.217.68-.481 0-.237-.008-.865-.011-1.696-2.775.602-3.361-1.338-3.361-1.338-.452-1.152-1.107-1.459-1.107-1.459-.905-.619.069-.605.069-.605 1.002.07 1.527 1.028 1.527 1.028.89 1.524 2.336 1.084 2.902.829.09-.645.35-1.085.635-1.334-2.214-.251-4.542-1.107-4.542-4.93 0-1.087.389-1.979 1.024-2.675-.101-.253-.446-1.268.099-2.64 0 0 .837-.269 2.742 1.021a9.582 9.582 0 0 1 2.496-.336 9.555 9.555 0 0 1 2.496.336c1.906-1.291 2.742-1.021 2.742-1.021.545 1.372.203 2.387.099 2.64.64.696 1.024 1.587 1.024 2.675 0 3.833-2.33 4.675-4.552 4.922.355.308.675.916.675 1.846 0 1.334-.012 2.41-.012 2.737 0 .267.178.577.687.479C19.146 20.115 22 16.379 22 11.974 22 6.465 17.535 2 12.026 2Z"
clip-rule="evenodd"></path>
</svg>
</a>
</li>
<li>
<a target="_blank" href="https://twitter.com/KeyAuth"
class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M19.633 7.994c.013.175.013.349.013.523 0 5.325-4.053 11.46-11.46 11.46A11.38 11.38 0 0 1 2 18.169c.324.037.636.05.973.05a8.07 8.07 0 0 0 5.001-1.721 4.036 4.036 0 0 1-3.767-2.793c.249.037.499.062.761.062.361 0 .724-.05 1.061-.137a4.027 4.027 0 0 1-3.23-3.953v-.05a4.05 4.05 0 0 0 1.82.51 4.022 4.022 0 0 1-1.796-3.353c0-.748.199-1.434.548-2.032a11.457 11.457 0 0 0 8.306 4.215c-.062-.3-.1-.611-.1-.923a4.024 4.024 0 0 1 4.028-4.028c1.16 0 2.207.486 2.943 1.272a7.957 7.957 0 0 0 2.556-.973c-.3.93-.93 1.72-1.771 2.22a8.074 8.074 0 0 0 2.319-.624 8.646 8.646 0 0 1-2.019 2.083Z">
</path>
</svg>
</a>
</li>
<li>
<a target="_blank" href="#" class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M11.999 7.375a4.624 4.624 0 1 0 0 9.248 4.624 4.624 0 0 0 0-9.248Zm0 7.627a3.004 3.004 0 1 1 0-6.008 3.004 3.004 0 0 1 0 6.008Z">
</path>
<path d="M16.805 8.289a1.078 1.078 0 1 0 0-2.156 1.078 1.078 0 0 0 0 2.156Z"></path>
<path
d="M20.533 6.114A4.605 4.605 0 0 0 17.9 3.482a6.607 6.607 0 0 0-2.186-.42c-.963-.042-1.268-.054-3.71-.054s-2.755 0-3.71.054a6.554 6.554 0 0 0-2.184.42 4.6 4.6 0 0 0-2.633 2.632A6.585 6.585 0 0 0 3.058 8.3c-.043.962-.056 1.267-.056 3.71 0 2.442 0 2.753.056 3.71.015.748.156 1.486.419 2.187a4.61 4.61 0 0 0 2.634 2.632 6.583 6.583 0 0 0 2.185.45c.963.042 1.268.055 3.71.055s2.755 0 3.71-.055a6.616 6.616 0 0 0 2.186-.42 4.613 4.613 0 0 0 2.633-2.632c.263-.7.404-1.438.419-2.186.043-.962.056-1.267.056-3.71s0-2.753-.056-3.71a6.583 6.583 0 0 0-.421-2.217Zm-1.218 9.532a5.046 5.046 0 0 1-.311 1.688 2.987 2.987 0 0 1-1.712 1.71c-.535.2-1.1.305-1.67.312-.95.044-1.218.055-3.654.055-2.438 0-2.687 0-3.655-.055a4.961 4.961 0 0 1-1.67-.311 2.985 2.985 0 0 1-1.718-1.711 5.08 5.08 0 0 1-.311-1.67c-.043-.95-.053-1.217-.053-3.653 0-2.437 0-2.686.053-3.655a5.038 5.038 0 0 1 .311-1.687c.305-.79.93-1.41 1.719-1.712a5.01 5.01 0 0 1 1.669-.311c.95-.043 1.218-.055 3.655-.055s2.687 0 3.654.055a4.96 4.96 0 0 1 1.67.31 2.99 2.99 0 0 1 1.712 1.713 5.06 5.06 0 0 1 .311 1.669c.043.95.054 1.218.054 3.655 0 2.436 0 2.698-.043 3.654h-.011v-.001Z">
</path>
</svg>
</a>
</li>
<li>
<a target="_blank" href="https://www.tiktok.com/@keyauth"
class="hover:text-white text-gray-400">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-5.2 1.74 2.89 2.89 0 0 1 2.31-4.64c.298-.002.595.042.88.13V9.4A6.33 6.33 0 0 0 5 20.1a6.34 6.34 0 0 0 10.86-4.43v-7a8.16 8.16 0 0 0 4.77 1.52v-3.4a4.85 4.85 0 0 1-1-.1h-.04Z">
</path>
</svg>
</a>
</li>
</ul>
</div>
<div class="lg:mx-auto">
<h3 class="mb-6 text-sm font-semibold uppercase text-white">Links</h3>
<ul class="text-gray-500 ">
<li class="mb-4">
<a href="https://www.youtube.com/keyauth" target="_blank"
class="hover:underline">Youtube</a>
</li>
<li class="mb-4">
<a href="https://github.com/keyauth" target="_blank" class="hover:underline">GitHub</a>
</li>
<li class="mb-4">
<a href="https://keyauthdocs.apidog.io" target="_blank"
class="hover:underline">Documentation</a>
</li>
</ul>
</div>
<div class="lg:mx-auto">
<h2 class="mb-6 text-sm font-semibold uppercase text-white">
Most Used Examples
</h2>
<ul class="text-gray-500 ">
<li class="mb-4">
<a target="_blank" href="https://github.com/KeyAuth/KeyAuth-CPP-Example"
class="hover:underline">
C++ <span class="text-xs">(CPP)</span>
</a>
</li>
<li class="mb-4">
<a target="_blank" href="https://github.com/KeyAuth/KeyAuth-CSHARP-Example"
class="hover:underline">C# <span class="text-xs">(CSharp)</span></a>
</li>
<li class="mb-4">
<a target="_blank" href="https://github.com/mazkdevf/KeyAuth-JS-Example"
class="hover:underline">JavaScript <span class="text-xs">(JS)</span></a>
</li>
<li class="mb-4">
<a target="_blank" href="https://github.com/KeyAuth/KeyAuth-Python-Example"
class="hover:underline">Python <span class="text-xs">(PY)</span></a>
</li>
</ul>
</div>
<div class="lg:mx-auto">
<h2 class="mb-6 text-sm font-semibold uppercase text-white">Other & Support</h2>
<ul class="text-gray-500 ">
<li class="mb-4">
<a target="_blank" href="https://chatting.page/gjqkqirygnfslvce2m5eycuo7tfxrhxl" class="hover:underline">
Support Center
</a>
</li>
<li class="mb-4">
<a target="_blank" href="../free-trial/" class="hover:underline">
Demo Accounts
</a>
</li>
<li class="mb-4">
<a target="_blank" href="https://t.me/keyauth" class="hover:underline">
Telegram
</a>
</li>
</ul>
</div>
<div class="lg:mx-auto">
<h2 class="mb-6 text-sm font-semibold uppercase text-white">Legal</h2>
<ul class="text-gray-500 ">
<li class="mb-4">
<a target="_blank" href="../terms" class="hover:underline">Terms of Service</a>
</li>
<li class="mb-4">
<a target="_blank" href="../privacy/" class="hover:underline">Privacy Policy</a>
</li>
<li class="mb-4">
<a target="_blank" href="https://github.com/KeyAuth/KeyAuth-Source-Code/blob/main/LICENSE"
class="hover:underline">Licensing</a>
</li>
<li class="mb-4">
<a target="_blank" href="../gdpr" class="hover:underline">GDPR</a>
</li>
</ul>
</div>
</div>
<hr class="my-6 border-[#0f0f17] sm:mx-auto lg:my-8">
<span class="block mb-6 text-sm text-gray-400 lg:mb-0 text-center">Copyright © 2020 - <script>document.write(new Date().getFullYear())</script> KeyAuth LLC. All Rights Reserved.
</span>
</div>
</footer>
<!-- jqeury -->
<script src="https://cdn.keyauth.cc/v3/scripts/jquery.min.js"></script>
<!--Flowbite JS-->
<script src="https://cdn.keyauth.cc/v3/dist/flowbite.js"></script>
</body>
</html>

5
includes/.htaccess Normal file
View File

@@ -0,0 +1,5 @@
RewriteEngine On
RewriteRule ^ - [L,R=404]
order deny,allow

View File

@@ -0,0 +1,366 @@
<?php
/**
* Class to validate the email address
*
* @author CodexWorld.com <contact@codexworld.com>
* @copyright Copyright (c) 2018, CodexWorld.com
* @url https://www.codexworld.com
*/
class VerifyEmail {
protected $stream = false;
/**
* SMTP port number
* @var int
*/
protected $port = 25;
/**
* Email address for request
* @var string
*/
protected $from = 'noreply@keyauth.com';
/**
* The connection timeout, in seconds.
* @var int
*/
protected $max_connection_timeout = 1;
/**
* Timeout value on stream, in seconds.
* @var int
*/
protected $stream_timeout = 1;
/**
* Wait timeout on stream, in seconds.
* * 0 - not wait
* @var int
*/
protected $stream_timeout_wait = 0;
/**
* Whether to throw exceptions for errors.
* @type boolean
* @access protected
*/
protected $exceptions = false;
/**
* The number of errors encountered.
* @type integer
* @access protected
*/
protected $error_count = 0;
/**
* class debug output mode.
* @type boolean
*/
public $Debug = false;
/**
* How to handle debug output.
* Options:
* * `echo` Output plain-text as-is, appropriate for CLI
* * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
* * `log` Output to error log as configured in php.ini
* @type string
*/
public $Debugoutput = 'html';
/**
* SMTP RFC standard line ending.
*/
const CRLF = "\r\n";
/**
* Holds the most recent error message.
* @type string
*/
public $ErrorInfo = '';
/**
* Constructor.
* @param boolean $exceptions Should we throw external exceptions?
*/
public function __construct($exceptions = false) {
$this->exceptions = (boolean) $exceptions;
}
/**
* Get array of MX records for host. Sort by weight information.
* @param string $hostname The Internet host name.
* @return array Array of the MX records found.
*/
public function getMXrecords($hostname) {
$mxhosts = array();
$mxweights = array();
if (getmxrr($hostname, $mxhosts, $mxweights) === FALSE) {
$this->set_error('MX records not found or an error occurred');
$this->edebug($this->ErrorInfo);
} else {
array_multisort($mxweights, $mxhosts);
}
/**
* Add A-record as last chance (e.g. if no MX record is there).
* Thanks Nicht Lieb.
* @link http://www.faqs.org/rfcs/rfc2821.html RFC 2821 - Simple Mail Transfer Protocol
*/
if (empty($mxhosts)) {
$mxhosts[] = $hostname;
}
return $mxhosts;
}
/**
* Parses input string to array(0=>user, 1=>domain)
* @param string $email
* @param boolean $only_domain
* @return string|array
* @access private
*/
public static function parse_email($email, $only_domain = TRUE) {
sscanf($email, "%[^@]@%s", $user, $domain);
return ($only_domain) ? $domain : array($user, $domain);
}
/**
* Add an error message to the error container.
* @access protected
* @param string $msg
* @return void
*/
protected function set_error($msg) {
$this->error_count++;
$this->ErrorInfo = $msg;
}
/**
* Check if an error occurred.
* @access public
* @return boolean True if an error did occur.
*/
public function isError() {
return ($this->error_count > 0);
}
/**
* Output debugging info
* Only generates output if debug output is enabled
* @see verifyEmail::$Debugoutput
* @see verifyEmail::$Debug
* @param string $str
*/
protected function edebug($str) {
if (!$this->Debug) {
return;
}
switch ($this->Debugoutput) {
case 'log':
//Don't output, just log
error_log($str);
break;
case 'html':
//Cleans up output a bit for a better looking, HTML-safe output
echo htmlentities(
preg_replace('/[\r\n]+/', '', $str), ENT_QUOTES, 'UTF-8'
)
. "<br>\n";
break;
case 'echo':
default:
//Normalize line breaks
$str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
"\n", "\n \t ", trim($str)
) . "\n";
}
}
/**
* Validate email
* @param string $email Email address
* @return boolean True if the valid email also exist
*/
public function check($email) {
$result = FALSE;
$this->error_count = 0; // Reset errors
$this->stream = FALSE;
$mxs = $this->getMXrecords(self::parse_email($email));
$timeout = ceil($this->max_connection_timeout / count($mxs));
$i = 0;
foreach ($mxs as $host) {
$i++;
if($i == 1) { // only check first MX record
/**
* suppress error output from stream socket client...
* Thanks Michael.
*/
$this->stream = @stream_socket_client("tcp://" . $host . ":" . $this->port, $errno, $errstr, $timeout);
if ($this->stream === FALSE) {
if ($errno == 0) {
$this->set_error("Problem initializing the socket");
$this->edebug($this->ErrorInfo);
if ($this->exceptions) {
throw new verifyEmailException($this->ErrorInfo);
}
return FALSE;
} else {
$this->edebug($host . ":" . $errstr);
}
} else {
stream_set_timeout($this->stream, $this->stream_timeout);
stream_set_blocking($this->stream, 1);
if ($this->_streamCode($this->_streamResponse()) == '220') {
$this->edebug("Connection success {$host}");
break;
} else {
fclose($this->stream);
$this->stream = FALSE;
}
}
}
}
if ($this->stream === FALSE) {
$this->set_error("All connection fails");
$this->edebug($this->ErrorInfo);
if ($this->exceptions) {
throw new verifyEmailException($this->ErrorInfo);
}
return FALSE;
}
$this->_streamQuery("HELO " . self::parse_email($this->from));
$this->_streamResponse();
$this->_streamQuery("MAIL FROM: <{$this->from}>");
$this->_streamResponse();
$this->_streamQuery("RCPT TO: <{$email}>");
$resp = $this->_streamResponse();
$code = $this->_streamCode($resp);
if (strpos($resp, "Client host rejected") !== false) {
$this->edebug("The email server doesn't like us :(");
return TRUE;
// server is blocking our server. AWS is far less likely to have these issues, so allow it
}
if (strpos($resp, "Protocol error") !== false) {
$this->edebug("Allowing exception for protonmail");
return TRUE;
// protonmail returning this
}
//$this->_streamResponse();
$this->_streamQuery("RSET");
//$this->_streamResponse();
$this->_streamQuery("QUIT");
fclose($this->stream);
switch ($code) {
case '250':
/**
* http://www.ietf.org/rfc/rfc0821.txt
* 250 Requested mail action okay, completed
* email address was accepted
*/
return TRUE;
case '450':
return FALSE;
case '451':
return FALSE;
case '452':
/**
* http://www.ietf.org/rfc/rfc0821.txt
* 450 Requested action not taken: the remote mail server
* does not want to accept mail from your server for
* some reason (IP address, blacklisting, etc..)
* Thanks Nicht Lieb.
* 451 Requested action aborted: local error in processing
* 452 Requested action not taken: insufficient system storage
* email address was greylisted (or some temporary error occured on the MTA)
* i believe that e-mail exists
*/
return FALSE;
case '550':
return FALSE;
default :
return FALSE;
}
}
/**
* writes the contents of string to the file stream pointed to by handle
* If an error occurs, returns FALSE.
* @access protected
* @param string $string The string that is to be written
* @return string Returns a result code, as an integer.
*/
protected function _streamQuery($query) {
$this->edebug($query);
return stream_socket_sendto($this->stream, $query . self::CRLF);
}
/**
* Reads all the line long the answer and analyze it.
* If an error occurs, returns FALSE
* @access protected
* @return string Response
*/
protected function _streamResponse($timed = 0) {
$reply = stream_get_line($this->stream, 1);
$status = stream_get_meta_data($this->stream);
if (!empty($status['timed_out'])) {
$this->edebug("Timed out while waiting for data! (timeout {$this->stream_timeout} seconds)");
}
if ($reply === FALSE && $status['timed_out'] && $timed < $this->stream_timeout_wait) {
return $this->_streamResponse($timed + $this->stream_timeout);
}
if ($reply !== FALSE && $status['unread_bytes'] > 0) {
$reply .= stream_get_line($this->stream, $status['unread_bytes'], self::CRLF);
}
$this->edebug($reply);
return $reply;
}
/**
* Get Response code from Response
* @param string $str
* @return string
*/
protected function _streamCode($str) {
preg_match('/^(?<code>[0-9]{3})(\s|-)(.*)$/ims', $str, $matches);
$code = isset($matches['code']) ? $matches['code'] : false;
return $code;
}
}
/**
* verifyEmail exception handler
*/
class verifyEmailException extends Exception {
/**
* Prettify error message output
* @return string
*/
public function errorMessage() {
$errorMsg = $this->getMessage();
return $errorMsg;
}
}
$mail = new VerifyEmail();
?>

View File

@@ -0,0 +1,7 @@
<?php
include_once (($_SERVER['DOCUMENT_ROOT'] == "/var/www/vhosts/tbs-server.de/lizenz.tbs-server.de/panel" || $_SERVER['DOCUMENT_ROOT'] == "/var/www/vhosts/tbs-server.de/lizenz.tbs-server.de/api") ? "/var/www/vhosts/tbs-server.de/lizenz.tbs-server.de" : $_SERVER['DOCUMENT_ROOT']) . '/includes/credentials.php'; // reference credentials
foreach (glob(__DIR__ . "/*.php") as $filename) {
include $filename;
}

217
includes/api/1.0/index.php Normal file
View File

@@ -0,0 +1,217 @@
<?php
namespace api\v1_0;
use api\shared\primary;
use misc\etc;
use misc\cache;
use misc\mysql;
#region enc region
function Encrypt($string, $enckey)
{
return bin2hex(openssl_encrypt($string, 'aes-256-cbc', substr(hash('sha256', $enckey), 0, 32), OPENSSL_RAW_DATA, substr(hash('sha256', $_POST['init_iv']), 0, 16)));
}
function Decrypt($string, $enckey)
{
return openssl_decrypt(hex2bin($string), 'aes-256-cbc', substr(hash('sha256', $enckey), 0, 32), OPENSSL_RAW_DATA, substr(hash('sha256', $_POST['init_iv']), 0, 16));
}
#endregion
#region rgstr region
function register($un, $key, $pw, $email, $hwid, $secret)
{
$query = mysql\query("SELECT `minUsernameLength`, `blockLeakedPasswords` FROM `apps` WHERE `secret` = ?",[$secret]);
$row = mysqli_fetch_array($query->result);
$minUsernameLength = $row['minUsernameLength'];
$blockLeakedPasswords = $row['blockLeakedPasswords'];
if (strlen($un) < $minUsernameLength) {
return 'un_too_short';
}
if ($blockLeakedPasswords && etc\isBreached($pw)) {
return 'pw_leaked';
}
// search username
$query = mysql\query("SELECT 1 FROM `users` WHERE `username` = ? AND `app` = ?",[$un, $secret]);
// if username already in existence
if ($query->num_rows >= 1) {
return 'username_taken';
}
// search for key
$query = mysql\query("SELECT `expires`, `status`, `level`, `genby` FROM `keys` WHERE `key` = ? AND `app` = ?",[$key, $secret]);
// check if key exists
if ($query->num_rows < 1) {
return 'key_not_found';
}
// if key does exist
elseif ($query->num_rows > 0) {
// gather key info
while ($row = mysqli_fetch_array($query->result)) {
$expires = $row['expires'];
$status = $row['status'];
$level = $row['level'];
$genby = $row['genby'];
}
// check license status
switch ($status) {
case 'Used':
return 'key_already_used';
case 'Banned':
return 'key_banned';
}
$ip = primary\getIp();
$hwidBlackCheck = mysql\query("SELECT 1 FROM `bans` WHERE (`hwid` = ? OR `ip` = ?) AND `app` = ?",[$hwid, $ip, $secret]);
if ($hwidBlackCheck->num_rows > 0) {
$query = mysql\query("UPDATE `keys` SET `status` = 'Banned',`banned` = 'This key has been banned as the client was blacklisted.' WHERE `key` = ? AND `app` = ?",[$un, $secret]);
cache\purge('KeyAuthKeys:' . $secret);
return 'hwid_blacked';
}
// add current time to key time
$expiry = $expires + time();
$query = mysql\query("SELECT `name` FROM `subscriptions` WHERE `app` = ? AND `level` = ?", [$secret, $level]);
if ($query->num_rows == 0) {
return 'no_subs_for_level';
}
// update key to used
mysql\query("UPDATE `keys` SET `status` = 'Used',`usedon` = ?,`usedby` = ? WHERE `key` = ? AND `app` = ?",[time(), $un, $key, $secret]);
cache\purge('KeyAuthKeys:' . $secret);
while ($row = mysqli_fetch_array($query->result)) {
// add each subscription that user's key applies to
$subname = $row['name'];
mysql\query("INSERT INTO `subs` (`user`, `subscription`, `expiry`, `app`, `key`) VALUES (?, ?, ?, ?, ?)",[$un, $subname, $expiry, $secret, $key]);
}
$password = password_hash($pw, PASSWORD_BCRYPT);
// create user
mysql\query("INSERT INTO `users` (`username`, `email`, `password`, `hwid`, `app`,`owner`,`createdate`, `lastlogin`, `ip`) VALUES (?, SHA(LOWER(NULLIF(?, ''))), ?, NULLIF(?, ''), ?, ?, ?, ?, ?)",[$un, $email, $password, $hwid, $secret, $genby, time(), time(), $ip]);
$query = mysql\query("SELECT `subscription`, `key`, `expiry` FROM `subs` WHERE `user` = ? AND `app` = ? AND `expiry` > " . time() . "",[$un, $secret]);
$rows = array();
if($query->num_rows > 0) {
while ($r = mysqli_fetch_assoc($query->result)) {
$timeleft = $expiry - time();
$r += ["timeleft" => $timeleft];
$rows[] = $r;
}
}
else {
$timeleft = $expiry - time();
$rows = array("subscription" => "$subname", "key" => "$key", "expiry" => "$expiry", "timeleft" => "$timeleft");
}
cache\purge('KeyAuthUser:' . $secret . ':' . $un);
cache\purge('KeyAuthSubs:' . $secret . ':' . $un);
// success
return array(
"username" => "$un",
"subscriptions" => $rows,
"ip" => $ip,
"hwid" => $hwid,
"createdate" => "". time() ."",
"lastlogin" => "" . time() . ""
);
}
}
#endregion
#region login region
function login($un, $pw, $hwid, $secret, $hwidenabled, $token = null, $_2fa = null)
{
$row = cache\fetch('KeyAuthUser:' . $secret . ':' . $un, "SELECT * FROM `users` WHERE `username` = ? AND `app` = ?", [$un, $secret], 0);
if ($row == "not_found") {
return 'un_not_found';
}
$pass = $row['password'];
$serverHwid = $row['hwid'];
$banned = $row['banned'];
$createdate = $row['createdate'];
if ($banned != NULL) {
return 'user_banned';
}
$ip = primary\getIp();
if (!is_null($token)) {
$validToken = md5(substr($pass, -5));
if ($validToken != $token) {
return 'pw_mismatch';
}
} else if (!is_null($pass)) {
// check if pass matches
if (!password_verify($pw, $pass)) {
return 'pw_mismatch';
}
} else {
$pass_encrypted = password_hash($pw, PASSWORD_BCRYPT);
$query = mysql\query("UPDATE `users` SET `password` = ? WHERE `username` = ? AND `app` = ?",[$pass_encrypted, $un, $secret]);
cache\purge('KeyAuthUser:' . $secret . ':' . $un);
}
// check if hwid enabled for application
if ($hwidenabled == "1") {
// check if hwid in db contains hwid recieved
if (!is_null($hwid) && !str_contains($serverHwid, $hwid) && !is_null($serverHwid)) {
return 'hwid_mismatch';
} else if (is_null($serverHwid) && !is_null($hwid)) {
$query = mysql\query("UPDATE `users` SET `hwid` = NULLIF(?, '') WHERE `username` = ? AND `app` = ?",[$hwid, $un, $secret]);
cache\purge('KeyAuthUser:' . $secret . ':' . $un);
}
}
$rows = cache\fetch('KeyAuthSubs:' . $secret . ':' . $un, "SELECT `subscription`, `key`, `expiry` FROM `subs` WHERE `user` = ? AND `app` = ? AND `expiry` > ?", [$un, $secret, time()], 1, null, "ssi");
if($_SERVER['HTTP_USER_AGENT'] == "PostmanRuntime/7.31.3") {
var_dump($rows);
}
if ($rows == "not_found") {
return 'no_active_subs';
}
$query = mysql\query("SELECT `paused` FROM `subs` WHERE `user` = ? AND `app` = ? AND `paused` = 1",[$un, $secret]);
if ($query->num_rows >= 1) {
return 'sub_paused';
}
if ($_2fa) {
if (is_null($_2fa) || empty($_2fa)) {
return 'missing_2fa_code'; }
else {
require "../../auth/GoogleAuthenticator.php";
$auth = new \GoogleAuthenticator();
if (!$auth->verifyCode($google_secret, $_2fa, 5)) {
return 'invalid_2fa';
}
}
}
$rowsFinal = array();
foreach ($rows as $row) {
$timeleft = $row["expiry"] - time();
$levelquery = mysql\query("SELECT `level` FROM `subscriptions` WHERE `name` = ? AND `app` = ?", [$row["subscription"], $secret]);
$level = mysqli_fetch_array($levelquery->result);
$row += ["timeleft" => $timeleft, "level" => $level["level"]];
$rowsFinal[] = $row;
}
$ip = primary\getIp();
$query = mysql\query("UPDATE `users` SET `ip` = NULLIF(?, ''),`lastlogin` = " . time() . " WHERE `username` = ? AND `app` = ?",[$ip, $un, $secret]);
return array(
"username" => "$un",
"subscriptions" => $rowsFinal,
"ip" => $ip,
"hwid" => $serverHwid,
"createdate" => "$createdate",
"lastlogin" => "" . time() . ""
);
}
#endregion

View File

@@ -0,0 +1,7 @@
<?php
include_once (($_SERVER['DOCUMENT_ROOT'] == "/var/www/vhosts/tbs-server.de/lizenz.tbs-server.de/panel" || $_SERVER['DOCUMENT_ROOT'] == "/var/www/vhosts/tbs-server.de/lizenz.tbs-server.de/api") ? "/var/www/vhosts/tbs-server.de/lizenz.tbs-server.de" : $_SERVER['DOCUMENT_ROOT']) . '/includes/credentials.php'; // reference credentials
foreach (glob(__DIR__ . "/*.php") as $filename) {
include $filename;
}

View File

@@ -0,0 +1,63 @@
<?php
namespace api\shared\primary;
use misc\etc;
use misc\cache;
function vpnCheck($ipaddr)
{
$url = "http://ip-api.com/json/{$ipaddr}?fields=16908288"; // returns fields: proxy,hosting
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$resp = curl_exec($curl);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$json = json_decode($resp);
if($httpcode == 429) {
global $logwebhook;
$json_data = json_encode([
// Message
"content" => "<@1268915723330392096> IP checking is rate limited",
// Username
"username" => "KeyAuth Logs",
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$ch = curl_init($logwebhook);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-type: application/json'
));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
return false;
}
if($json->proxy || $json->hosting) {
return true;
}
return false;
}
function getIp()
{
return etc\sanitize($_SERVER['HTTP_CF_CONNECTING_IP'] ?? $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR']);
}
function getSession($sessionid, $secret)
{
// had to name it 'state' instead of 'session' because Redis wouldn't save key with 'session' in it
$row = cache\fetch('KeyAuthState:' . $secret . ':' . $sessionid, "SELECT * FROM `sessions` WHERE `id` = ? AND `app` = ? AND `expiry` > ?", [$sessionid, $secret, time()], 0, NULL, "ssi");
if ($row == "not_found") {
die(json_encode(array(
"success" => false,
"message" => "Session not found. Use latest code. You can only have app opened 1 at a time."
)));
}
return array(
"credential" => $row["credential"],
"enckey" => $row["enckey"],
"validated" => $row["validated"]
);
}

34
includes/credentials.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
/*
All sensitive credentials stored here.
NOTE: change this file name from credentials.example.php to credentials.php
*/
error_reporting(0);
$databaseHost = "localhost";
$databaseUsername = "keyauth";
$databasePassword = "@8g0d2Oa9";
$databaseName = "keyauth_";
$mysqlRequireSSL = false; // in case the MySQL server requires SSL
$logwebhook = ""; // discord webhook which receives login logs and keys created
$adminwebhook = ""; // discord webhook which receives admin actions
$redisServers = []; // URLs to purge redis keys from each server (used on live KeyAuth website only)
$redisPass = "f&rkADl55AZ";
$keyauthStatsToken = ""; // discord bot token for KeyAuth Stats
$webhookun = "KeyAuth Logs"; // webhook username
$adminwebhookun = "KeyAuth Admin Logs"; // admin webhook's username
$awsAccessKey = ""; // used for AWS SES to send emails
$awsSecretKey = ""; // used for AWS SES to send emails

View File

@@ -0,0 +1,7 @@
<?php
include_once (($_SERVER['DOCUMENT_ROOT'] == "/var/www/vhosts/tbs-server.de/lizenz.tbs-server.de/panel" || $_SERVER['DOCUMENT_ROOT'] == "/var/www/vhosts/tbs-server.de/lizenz.tbs-server.de/api") ? "/var/www/vhosts/tbs-server.de/lizenz.tbs-server.de" : $_SERVER['DOCUMENT_ROOT']) . '/includes/credentials.php'; // reference credentials
foreach (glob(__DIR__ . "/*.php") as $filename) {
include $filename;
}

View File

@@ -0,0 +1,166 @@
<?php
namespace dashboard\primary;
use misc\mysql;
function time2str($date)
{
$now = time();
$diff = $now - $date;
if ($diff < 60) {
return sprintf($diff > 1 ? '%s seconds' : 'second', $diff);
}
$diff = floor($diff / 60);
if ($diff < 60) {
return sprintf($diff > 1 ? '%s minutes' : 'minute', $diff);
}
$diff = floor($diff / 60);
if ($diff < 24) {
return sprintf($diff > 1 ? '%s hours' : 'hour', $diff);
}
$diff = floor($diff / 24);
if ($diff < 7) {
return sprintf($diff > 1 ? '%s days' : 'day', $diff);
}
if ($diff < 30) {
$diff = floor($diff / 7);
return sprintf($diff > 1 ? '%s weeks' : 'week', $diff);
}
$diff = floor($diff / 30);
if ($diff < 12) {
return sprintf($diff > 1 ? '%s months' : 'month', $diff);
}
$diff = date('Y', $now) - date('Y', $date);
return sprintf($diff > 1 ? '%s years' : 'year', $diff);
}
function expireCheck($username, $expires)
{
if ($expires < time()) {
$_SESSION['role'] = "tester";
$query = mysql\query("UPDATE `accounts` SET `role` = 'tester' WHERE `username` = ?",[$username]);
}
if ($expires - time() < 2629743) // check if account expires in month or less
{
return true;
} else {
return false;
}
}
function wh_log($webhook_url, $msg, $un, $color, $pingList)
{
$json_data = json_encode([
"content" => $pingList . "\n" . $un . " > " . $msg
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$ch = curl_init($webhook_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-type: application/json'
));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
}
function error($msg){
$msg = addslashes($msg);
echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" rel="stylesheet"/>
<script type="text/javascript">
toastr.options = {
"closeButton": true,
"progressBar": true,
"positionClass": "toast-bottom-right",
"timeOut": "5000",
"showDuration": "300",
"hideDuration": "1000",
"extendedTimeOut": "1000"
};
toastr.error("' . $msg . '");
</script>';
}
function success($msg) {
$msg = addslashes($msg);
echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" rel="stylesheet"/>
<script type="text/javascript">
toastr.options = {
"closeButton": true,
"progressBar": true,
"positionClass": "toast-bottom-right",
"timeOut": "5000",
"showDuration": "300",
"hideDuration": "1000",
"extendedTimeOut": "1000"
};
toastr.success("' . $msg . '");
</script>';
}
/*function error($msg)
{
echo '<script src="https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.js"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.css"><script type=\'text/javascript\'>
const notyf = new Notyf();
notyf
.error({
message: \'' . addslashes($msg) . '\',
duration: 3500,
dismissible: true
});
</script>';
}
function success($msg)
{
echo '<script src="https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.js"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.css"><script type=\'text/javascript\'>
const notyf = new Notyf();
notyf
.success({
message: \'' . addslashes($msg) . '\',
duration: 3500,
dismissible: true
});
</script>';
}*/
function popover($id, $title, $msg){
echo '<div data-popover id="' . $id . '" role="tooltip"
class="absolute z-10 invisible inline-block w-64 text-sm text-gray-500 transition-opacity duration-300 bg-[#09090d] rounded-lg shadow-sm opacity-0">
<div class="px-3 py-2 bg-[#09090d]/70 rounded-t-lg">
<h3 class="font-semibold text-white">' . $title . '</h3>
</div>
<div class="px-3 py-2">
<p>' . $msg . '</p>
</div>
<div data-popper-arrow></div>
</div>';
}

51
includes/misc/account.php Normal file
View File

@@ -0,0 +1,51 @@
<?php
namespace misc\account;
use misc\etc;
use misc\mysql;
function addAccount($username, $role, $email, $password, $keyLevels, $owner, $name, $permissions)
{
$username = etc\sanitize($username);
$role = etc\sanitize($role);
$email = etc\sanitize($email);
$password = etc\sanitize($password);
$keyLevels = etc\sanitize($keyLevels) ?? "N/A";
$owner = etc\sanitize($owner);
$name = etc\sanitize($name);
$permissions = etc\sanitize($permissions);
if (!in_array($role, array("Manager", "Reseller"))) {
return 'invalid_role';
}
if (is_null($email)) {
return 'invalid_email';
}
$pass_encrypted = password_hash($password, PASSWORD_BCRYPT);
$user_check = mysql\query("SELECT `username` FROM `accounts` WHERE `username` = ?", [$username]);
if ($user_check->num_rows > 0) {
return 'username_taken';
}
$email_check = mysql\query("SELECT `username` FROM `accounts` WHERE `email` = SHA1(?)", [$email]);
if ($email_check->num_rows > 0) {
return 'email_taken';
}
if ($permissions <= 0 || !is_numeric($permissions)) { // Manager users must have access to at least one page
return 'invalid_perms';
}
$permissions = decbin($permissions);
$query = mysql\query("INSERT INTO `accounts` (`username`, `email`, `password`, `role`, `app`, `owner`, `balance`, `keylevels`, `permissions`) VALUES (?, SHA1(?), ?, ?, ?, ?, '0|0|0|0|0|0|0', ?, b'$permissions')", [$username, $email, $pass_encrypted, $role, $name, $owner, $keyLevels]);
if ($query->affected_rows > 0) {
return 'success';
} else {
return 'failure';
}
}

55
includes/misc/app.php Normal file
View File

@@ -0,0 +1,55 @@
<?php
namespace misc\app;
use misc\etc;
use misc\cache;
use misc\mysql;
function pause($secret = null){
mysql\query("UPDATE `subs` SET `paused` = 1, `expiry` = `expiry`-? WHERE `app` = ? AND `expiry` > ?",[time(), $secret ?? $_SESSION['app'], time()], "isi");
mysql\query("UPDATE `apps` SET `paused` = 1 WHERE `secret` = ?",[$secret ?? $_SESSION['app']]);
$query = mysql\query("SELECT `ownerid`,`name`,`customDomainAPI` FROM `apps` WHERE `secret` = ?", [$secret ?? $_SESSION['app']]);
$row = mysqli_fetch_array($query->result);
cache\purge('KeyAuthApp:' . $row['customDomainAPI']);
cache\purge('KeyAuthApp:' . $row['name'] . ':' . $row['ownerid']);
}
function unpause($secret = null){
mysql\query("UPDATE `subs` SET `paused` = 0, `expiry` = `expiry`+? WHERE `app` = ? AND `paused` = 1", [time(), $secret ?? $_SESSION['app']], "is");
mysql\query("UPDATE `apps` SET `paused` = 0 WHERE `secret` = ?",[$secret ?? $_SESSION['app']]);
$query = mysql\query("SELECT `ownerid`,`name`,`customDomainAPI` FROM `apps` WHERE `secret` = ?",[$secret ?? $_SESSION['app']]);
$row = mysqli_fetch_array($query->result);
cache\purge('KeyAuthApp:' . $row['customDomainAPI']);
cache\purge('KeyAuthApp:' . $row['name'] . ':' . $row['ownerid']);
}
function addHash($hash, $secret = null){
$hash = etc\sanitize($hash);
$query = mysql\query("SELECT `hash`, `name`, `ownerid` FROM `apps` WHERE `secret` = ?",[$secret ?? $_SESSION['app']]);
$row = mysqli_fetch_array($query->result);
$oldHash = $row["hash"];
$name = $row["hash"];
$ownerid = $row["ownerid"];
$newHash = $oldHash .= $hash;
$query = mysql\query("UPDATE `apps` SET `hash` = ? WHERE `secret` = ?",[$newHash, $secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
cache\purge("KeyAuthApp:{$name}:{$ownerid}");
return 'success';
}
return 'failure';
}
function resetHash($secret = null, $name = null, $ownerid = null){
$name = $name ?? $_SESSION['name'];
$ownerid = $ownerid ?? $_SESSION['ownerid'];
$query = mysql\query("UPDATE `apps` SET `hash` = NULL WHERE `secret` = ?",[$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
cache\purge("KeyAuthApp:{$name}:{$ownerid}");
return 'success';
}
return 'failure';
}

View File

@@ -0,0 +1,28 @@
<?php
namespace misc\auditLog;
use misc\mysql;
use misc\cache;
use dashboard\primary;
function send($event){
$query = mysql\query("SELECT `auditLogWebhook` FROM `apps` WHERE `secret` = ?",[$_SESSION['app']]);
$row = mysqli_fetch_array($query->result);
if(!is_null($row['auditLogWebhook'])) {
primary\wh_log($row['auditLogWebhook'], "**User:** " . $_SESSION['username'] . "**Event:** $event", "", "3586ee");
}
else {
$query = mysql\query("INSERT INTO `auditLog` (`user`, `event`, `time`, `app`) VALUES (?, ?, ?, ?)",[$_SESSION['username'], $event, time(), $_SESSION['app']]);
}
}
function deleteAll($secret = null){
$query = mysql\query("DELETE FROM `auditLog` WHERE `app` = ?",[$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0){
if ($_SESSION['role'] == "seller" || !is_null($secret)){
cache\purge('KeyAuthAuditLogs:' . ($secret ?? $_SESSION['app']));
} return 'success';
} else {
return 'failure';
}
}

View File

@@ -0,0 +1,7 @@
<?php
include_once (($_SERVER['DOCUMENT_ROOT'] == "/var/www/vhosts/tbs-server.de/lizenz.tbs-server.de/panel" || $_SERVER['DOCUMENT_ROOT'] == "/var/www/vhosts/tbs-server.de/lizenz.tbs-server.de/api") ? "/var/www/vhosts/tbs-server.de/lizenz.tbs-server.de" : $_SERVER['DOCUMENT_ROOT']) . '/includes/credentials.php'; // reference credentials
foreach (glob(__DIR__ . "/*.php") as $filename) {
include $filename;
}

View File

@@ -0,0 +1,94 @@
<?php
namespace misc\blacklist;
use misc\etc;
use misc\cache;
use misc\mysql;
function add($data, $type, $secret = null)
{
$data = etc\sanitize($data);
$type = etc\sanitize($type);
switch ($type) {
case 'IP Address':
$query = mysql\query("INSERT INTO `bans`(`ip`, `type`, `app`) VALUES (?, 'ip', ?)",[$data, $secret ?? $_SESSION['app'] ]);
cache\purgePattern('KeyAuthBlacklist:' . ($secret ?? $_SESSION['app']) . ':' . $data);
break;
case 'Hardware ID':
$query = mysql\query("INSERT INTO `bans`(`hwid`, `type`, `app`) VALUES (?, 'hwid', ?)",[$data, $secret ?? $_SESSION['app']]);
cache\purgePattern('KeyAuthBlacklist:' . ($secret ?? $_SESSION['app']) . ':*:' . $data);
break;
case 'region':
$query = mysql\query("INSERT INTO `bans`(`region`, `type`, `app`) VALUES (?, 'region', ?)",[$data, $secret ?? $_SESSION['app']]);
break;
case 'country':
$query = mysql\query("INSERT INTO `bans`(`country`, `type`, `app`) VALUES (?, 'country', ?)",[$data, $secret ?? $_SESSION['app']]);
break;
case 'asn':
$query = mysql\query("INSERT INTO `bans`(`asn`, `type`, `app`) VALUES (?, 'asn', ?)",[$data, $secret ?? $_SESSION['app']]);
break;
default:
return 'invalid';
}
if ($query->affected_rows > 0) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthBlacks:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function deleteAll($secret = null)
{
$query = mysql\query("DELETE FROM `bans` WHERE `app` = ?",[$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
cache\purgePattern('KeyAuthBlacklist:' . ($secret ?? $_SESSION['app']));
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthBlacks:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function deleteSingular($blacklist, $type, $secret = null)
{
$blacklist = etc\sanitize($blacklist);
$type = etc\sanitize($type);
switch ($type) {
case 'ip':
$query = mysql\query("DELETE FROM `bans` WHERE `app` = ? AND `ip` = ?",[$secret ?? $_SESSION['app'], $blacklist]);
cache\purgePattern('KeyAuthBlacklist:' . ($secret ?? $_SESSION['app']) . ':' . $blacklist);
break;
case 'hwid':
$query = mysql\query("DELETE FROM `bans` WHERE `app` = ? AND `hwid` = ?",[$secret ?? $_SESSION['app'], $blacklist]);
cache\purgePattern('KeyAuthBlacklist:' . ($secret ?? $_SESSION['app']) . ':*:' . $blacklist);
break;
case 'region':
$query = mysql\query("DELETE FROM `bans` WHERE `app` = ? AND `region` = ?",[$secret ?? $_SESSION['app'], $blacklist]);
break;
case 'country':
$query = mysql\query("DELETE FROM `bans` WHERE `app` = ? AND `country` = ?",[$secret ?? $_SESSION['app'], $blacklist]);
break;
case 'asn':
$query = mysql\query("DELETE FROM `bans` WHERE `app` = ? AND `asn` = ?",[$secret ?? $_SESSION['app'], $blacklist]);
break;
default:
return 'invalid';
}
if ($query->affected_rows > 0) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthBlacks:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}

40
includes/misc/button.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
namespace misc\button;
use misc\etc;
use misc\cache;
use misc\mysql;
function addButton($text, $value, $secret = null)
{
$text = etc\sanitize($text);
$value = etc\sanitize($value);
$query = mysql\query("INSERT INTO `buttons` (`text`, `value`, `app`) VALUES (?, ?, ?)",[$text, $value, $secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthButtons:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function deleteButton($value, $secret = null)
{
$value = etc\sanitize($value);
$query = mysql\query("DELETE FROM `buttons` WHERE `value` = ? AND `app` = ?",[$value, $secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthButtons:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}

137
includes/misc/cache.php Normal file
View File

@@ -0,0 +1,137 @@
<?php
namespace misc\cache;
use misc\mysql;
use api\shared;
function fetch($redisKey, $sqlQuery, $args = [], $multiRowed, $expiry = null, $types = null)
{
global $redis;
include_once (($_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/panel" || $_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/api") ? "/usr/share/nginx/html" : $_SERVER['DOCUMENT_ROOT']) . '/includes/redis.php'; // create connection with redis
$redisKey = strtolower($redisKey); // redis is case-insensitive
$data = $redis->get($redisKey);
if (!$data) {
$query = mysql\query($sqlQuery,$args, $types);
if ($query->num_rows < 1) // check if MySQL found any rows
{
$redis->set($redisKey, 'not_found'); // save redis key indicating record not found
$redis->expire($redisKey, 300); // if the data doesn't exist, only keep Redis key for 5 minutes to mitigate against spam
return 'not_found';
}
if ($multiRowed) { // return multi-rowed response for applications such as chat channels where multiple rows containing messages
while ($r = mysqli_fetch_assoc($query->result)) {
$data[] = $r;
}
} else {
$data = mysqli_fetch_array($query->result);
}
$redis->set($redisKey, serialize($data)); // save data to redis key so next time it's retrieved much quicker from cache
if(str_contains($redisKey, "keyauthsubs")) { // ensure no users can login for longer than they're supposed to
$expiries = array();
foreach ($data as $row) {
$expiries[] = $row['expiry'];
}
$ttl = intval(min($expiries) - time());
$redis->expire($redisKey, $ttl);
}
if(str_contains($redisKey, "keyauthsellercheck")) { // ensure no customers can use SellerAPI for longer than the period they have seller plan
$ttl = intval($data["expires"] - time());
$redis->expire($redisKey, $ttl);
}
if(str_contains($redisKey, "keyauthstate")) { // ensure no users stay logged in for longer than they're supposed to
$ttl = intval($data["expiry"] - time());
$redis->expire($redisKey, $ttl);
}
if (!is_null($expiry)) {
$redis->expire($redisKey, intval($expiry)); // set TTL if specified
}
} else {
if ($data == "not_found") {
return 'not_found';
}
$data = unserialize($data);
}
return $data; // return data from either MySQL or Redis
}
function purge($redisKey) // delete key from Redis cache (typically called when MySQL row(s) updated or deleted)
{
$redisKey = strtolower($redisKey); // redis is case-insensitive, and key must be encoded for HTTP request used in production
global $redis;
include_once (($_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/panel" || $_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/api") ? "/usr/share/nginx/html" : $_SERVER['DOCUMENT_ROOT']) . '/includes/redis.php'; // create connection with Redis
$redis->del($redisKey);
}
function purgePattern($redisKey) // purge all data starting with, ending with, or both and unknown text in between
{
if($redisKey == "*" || empty($redisKey)) {
die("Invalid redis key purge value. Must specify some text.");
}
$redisKey = strtolower($redisKey); // redis is case-insensitive, and key must be encoded for HTTP request used in production
global $redis;
include_once (($_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/panel" || $_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/api") ? "/usr/share/nginx/html" : $_SERVER['DOCUMENT_ROOT']) . '/includes/redis.php'; // create connection with Redis
$redis->delete($redis->keys($redisKey . '*'));
}
function rateLimit($redisKey, $amount, $expiry, $limit) // rate limiting with Redis, prevent spam/DDoS attack(s)
{
global $redis;
include_once (($_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/panel" || $_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/api") ? "/usr/share/nginx/html" : $_SERVER['DOCUMENT_ROOT']) . '/includes/redis.php'; // create connection with Redis
$redisKey = strtolower($redisKey); // redis is case-insensitive
$data = $redis->get($redisKey);
if (!$data) {
$redis->set($redisKey, $amount, $expiry);
return false;
} else {
if (intval($data) >= $limit) {
$ttl = $redis->ttl($redisKey);
if($ttl > $expiry || $ttl < 0) {
purge($redisKey);
return false;
}
return true;
}
$redis->incr($redisKey, $amount);
return false;
}
}
function select($redisKey) {
global $redis;
include_once (($_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/panel" || $_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/api") ? "/usr/share/nginx/html" : $_SERVER['DOCUMENT_ROOT']) . '/includes/redis.php'; // create connection with Redis
$redisKey = strtolower($redisKey); // redis is case-insensitive
return $redis->get($redisKey);
}
function insert($redisKey, $value, $expiry) {
$redisKey = strtolower($redisKey); // redis is case-insensitive
global $redis;
include_once (($_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/panel" || $_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/api") ? "/usr/share/nginx/html" : $_SERVER['DOCUMENT_ROOT']) . '/includes/redis.php'; // create connection with Redis
$redis->set($redisKey, $value, $expiry);
}
function update($redisKey, ...$replacements) {
global $redis;
include_once (($_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/panel" || $_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/api") ? "/usr/share/nginx/html" : $_SERVER['DOCUMENT_ROOT']) . '/includes/redis.php'; // create connection with Redis
$redisKey = strtolower($redisKey); // redis is case-insensitive
$data = unserialize($redis->get($redisKey));
if(!$data) {
return false;
}
$new = serialize(array_replace($data, ...$replacements));
$redis->set($redisKey, $new, ['KEEPTTL']);
return true;
}

112
includes/misc/chat.php Normal file
View File

@@ -0,0 +1,112 @@
<?php
namespace misc\chat;
use misc\etc;
use misc\cache;
use misc\mysql;
function deleteMessage($id, $secret = null){
$id = etc\sanitize($id);
$query = mysql\query("SELECT `channel` FROM `chatmsgs` WHERE `app` = ? AND `id` = ?",[$secret ?? $_SESSION['app'], $id]);
$row = mysqli_fetch_array($query->result);
cache\purge('KeyAuthChatMsgs:' . ($secret ?? $_SESSION['app']) . ':' . $row['channel']);
$query = mysql\query("DELETE FROM `chatmsgs` WHERE `app` = ? AND `id` = ?",[$secret ?? $_SESSION['app'], $id]);
if ($query->affected_rows > 0) {
return 'success';
} else {
return 'failure';
}
}
function muteUser($user, $time, $secret = null){
$user = etc\sanitize($user);
$time = etc\sanitize($time);
$query = mysql\query("SELECT 1 FROM `users` WHERE `app` = ? AND `username` = ?",[$secret ?? $_SESSION['app'], $user]);
if ($query->num_rows == 0) {
return 'missing';
}
$query = mysql\query("INSERT INTO `chatmutes` (`user`, `time`, `app`) VALUES (?, ?, ?)",[$user, $time, $secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthMutes:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function unMuteUser($user, $secret = null){
$user = etc\sanitize($user);
$query = mysql\query("DELETE FROM `chatmutes` WHERE `app` = ? AND `user` = ?",[$secret ?? $_SESSION['app'], $user]);
if ($query->affected_rows > 0) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthMutes:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function clearChannel($channel, $secret = null){
$channel = etc\sanitize($channel);
$query = mysql\query("DELETE FROM `chatmsgs` WHERE `app` = ? AND `channel` = ?",[$secret ?? $_SESSION['app'], $channel]);
if ($query->affected_rows > 0) {
cache\purge('KeyAuthChatMsgs:' . ($secret ?? $_SESSION['app']) . ':' . $channel);
return 'success';
} else {
return 'failure';
}
}
function createChannel($name, $delay, $secret = null){
$name = etc\sanitize($name);
$delay = etc\sanitize($delay);
$query = mysql\query("INSERT INTO `chats` (`name`, `delay`, `app`) VALUES (?, ?, ?)",[$name, $delay, $secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthChats:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function deleteChannel($name, $secret = null){
$name = etc\sanitize($name);
$query = mysql\query("DELETE FROM `chats` WHERE `app` = ? AND `name` = ?",[$secret ?? $_SESSION['app'], $name]);
if ($query->affected_rows > 0) {
$query = mysql\query("DELETE FROM `chatmsgs` WHERE `app` = ? AND `channel` = ?",[$secret ?? $_SESSION['app'], $name]);
cache\purge('KeyAuthChatMsgs:' . ($secret ?? $_SESSION['app']) . ':' . $name);
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthChats:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function deleteAllChannels($secret = null){
$query = mysql\query("DELETE FROM `chats` WHERE `app` = ?",[$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
$query = mysql\query("DELETE FROM `chatmsgs` WHERE `app` = ?",[$secret ?? $_SESSION['app']]);
cache\purge('KeyAuthChatMsgs:' . ($secret ?? $_SESSION['app']));
if ($_SESSION['role'] == "seller" || !is_null($secret)){
cache\purge('KeyAuthChats:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}

479
includes/misc/email.php Normal file
View File

@@ -0,0 +1,479 @@
<?php
namespace misc\email;
function send($username, $email, $content, $subject) {
global $awsAccessKey;
global $awsSecretKey;
if(empty($awsAccessKey)) {
return;
}
require_once (($_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/panel" || $_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/api") ? "/usr/share/nginx/html" : $_SERVER['DOCUMENT_ROOT']) . '/vendor/autoload.php';
$content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="x-apple-disable-message-reformatting" />
<meta name="color-scheme" content="light dark" />
<meta name="supported-color-schemes" content="light dark" />
<style type="text/css" rel="stylesheet" media="all">
@import url("https://fonts.googleapis.com/css?family=Nunito+Sans:400,700&display=swap");
body {
width: 100% !important;
height: 100%;
margin: 0;
-webkit-text-size-adjust: none;
}
a img {
border: none;
}
td {
word-break: break-word;
}
.preheader {
display: none !important;
visibility: hidden;
mso-hide: all;
font-size: 1px;
line-height: 1px;
max-height: 0;
max-width: 0;
opacity: 0;
overflow: hidden;
}
body,
td,
th {
font-family: "Nunito Sans", Helvetica, Arial, sans-serif;
}
h1 {
margin-top: 0;
color: #333333;
font-size: 22px;
font-weight: bold;
text-align: left;
}
h2 {
margin-top: 0;
color: #333333;
font-size: 16px;
font-weight: bold;
text-align: left;
}
h3 {
margin-top: 0;
color: #333333;
font-size: 14px;
font-weight: bold;
text-align: left;
}
td,
th {
font-size: 16px;
}
p,
ul,
ol,
blockquote {
margin: .4em 0 1.1875em;
font-size: 16px;
line-height: 1.625;
}
p.sub {
font-size: 13px;
}
.align-right {
text-align: right;
}
.align-left {
text-align: left;
}
.align-center {
text-align: center;
}
.u-margin-bottom-none {
margin-bottom: 0;
}
.button {
background-color: #3869D4;
border-top: 10px solid #3869D4;
border-right: 18px solid #3869D4;
border-bottom: 10px solid #3869D4;
border-left: 18px solid #3869D4;
display: inline-block;
color: #FFF;
text-decoration: none;
border-radius: 3px;
-webkit-text-size-adjust: none;
box-sizing: border-box;
}
.button--green {
background-color: #22BC66;
border-top: 10px solid #22BC66;
border-right: 18px solid #22BC66;
border-bottom: 10px solid #22BC66;
border-left: 18px solid #22BC66;
}
.button--red {
background-color: #FF6136;
border-top: 10px solid #FF6136;
border-right: 18px solid #FF6136;
border-bottom: 10px solid #FF6136;
border-left: 18px solid #FF6136;
}
@media only screen and (max-width: 500px) {
.button {
width: 100% !important;
text-align: center !important;
}
}
.attributes {
margin: 0 0 21px;
}
.attributes_content {
background-color: #F4F4F7;
padding: 16px;
}
.attributes_item {
padding: 0;
}
.related {
width: 100%;
margin: 0;
padding: 25px 0 0 0;
-premailer-width: 100%;
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
}
.related_item {
padding: 10px 0;
color: #CBCCCF;
font-size: 15px;
line-height: 18px;
}
.related_item-title {
display: block;
margin: .5em 0 0;
}
.related_item-thumb {
display: block;
padding-bottom: 10px;
}
.related_heading {
border-top: 1px solid #CBCCCF;
text-align: center;
padding: 25px 0 10px;
}
.discount {
width: 100%;
margin: 0;
padding: 24px;
-premailer-width: 100%;
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
background-color: #F4F4F7;
border: 2px dashed #CBCCCF;
}
.discount_heading {
text-align: center;
}
.discount_body {
text-align: center;
font-size: 15px;
}
.social {
width: auto;
}
.social td {
padding: 0;
width: auto;
}
.social_icon {
height: 20px;
margin: 0 8px 10px 8px;
padding: 0;
}
.purchase {
width: 100%;
margin: 0;
padding: 35px 0;
-premailer-width: 100%;
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
}
.purchase_content {
width: 100%;
margin: 0;
padding: 25px 0 0 0;
-premailer-width: 100%;
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
}
.purchase_item {
padding: 10px 0;
color: #51545E;
font-size: 15px;
line-height: 18px;
}
.purchase_heading {
padding-bottom: 8px;
border-bottom: 1px solid #EAEAEC;
}
.purchase_heading p {
margin: 0;
color: #85878E;
font-size: 12px;
}
.purchase_footer {
padding-top: 15px;
border-top: 1px solid #EAEAEC;
}
.purchase_total {
margin: 0;
text-align: right;
font-weight: bold;
color: #333333;
}
.purchase_total--label {
padding: 0 15px 0 0;
}
body {
background-color: #F2F4F6;
color: #51545E;
}
p {
color: #51545E;
}
.email-wrapper {
width: 100%;
margin: 0;
padding: 0;
-premailer-width: 100%;
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
background-color: #F2F4F6;
}
.email-content {
width: 100%;
margin: 0;
padding: 0;
-premailer-width: 100%;
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
}
.email-masthead {
text-align: center;
}
.email-masthead_logo {
width: 94px;
}
.email-masthead_name {
font-size: 16px;
font-weight: bold;
color: #A8AAAF;
text-decoration: none;
text-shadow: 0 1px 0 white;
}
.email-body {
width: 100%;
margin: 0;
padding: 0;
-premailer-width: 100%;
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
}
.email-body_inner {
width: 570px;
margin: 0 auto;
padding: 0;
-premailer-width: 570px;
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
background-color: #FFFFFF;
}
.email-footer {
width: 570px;
margin: 0 auto;
padding: 0;
-premailer-width: 570px;
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
text-align: center;
}
.email-footer p {
color: #A8AAAF;
}
.body-action {
width: 100%;
margin: 30px auto;
padding: 0;
-premailer-width: 100%;
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
text-align: center;
}
.body-sub {
margin-top: 25px;
padding-top: 25px;
border-top: 1px solid #EAEAEC;
}
.content-cell {
padding: 45px;
}
@media only screen and (max-width: 600px) {
.email-body_inner,
.email-footer {
width: 100% !important;
}
}
@media (prefers-color-scheme: dark) {
body,
.email-body,
.email-body_inner,
.email-content,
.email-wrapper,
.email-masthead,
.email-footer {
background-color: #333333 !important;
color: #FFF !important;
}
p,
ul,
ol,
blockquote,
h1,
h2,
h3,
span,
.purchase_item {
color: #FFF !important;
}
.attributes_content,
.discount {
background-color: #222 !important;
}
.email-masthead_name {
text-shadow: none !important;
}
}
:root {
color-scheme: light dark;
supported-color-schemes: light dark;
}
</style>
</head>
<body>
<table class="email-wrapper" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td align="center">
<table class="email-content" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td class="email-masthead" style="text-align: center";>
<a href="https://keyauth.cc" class="f-fallback email-masthead_name">
<img src="https://cdn.keyauth.cc/v2/assets/media/logos/logo-1-white.png" width="180" height="100">
</a>
</td>
</tr>
<!-- Email Body -->
<tr>
<td class="email-body" width="570" cellpadding="0" cellspacing="0">
<table class="email-body_inner" align="center" width="570" cellpadding="0" cellspacing="0" role="presentation">
<!-- Body content -->
<tr>
<td class="content-cell">'.$content.'</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table class="email-footer" align="center" width="570" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td align="center">
<p class="f-fallback sub align-center">
<br>KeyAuth LLC
<br>Transactional email, unsubscribe <a href="https://keyauth.cc/deleteAccount/">https://keyauth.cc/deleteAccount/</a>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>';
$m = new \SimpleEmailServiceMessage();
$m->addTo("{$username} <{$email}>");
$m->setFrom('KeyAuth <noreply@keyauth.cc>');
$m->setSubject("{$subject}");
$m->setMessageFromString($content, $content);
$region_endpoint = \SimpleEmailService::AWS_US_EAST_1;
$ses = new \SimpleEmailService($awsAccessKey, $awsSecretKey, $region_endpoint);
$ses->sendEmail($m);
}

199
includes/misc/etc.php Normal file
View File

@@ -0,0 +1,199 @@
<?php
namespace misc\etc;
function sanitize($input)
{
$input = strip_tags(trim($input));
if (empty($input) & !is_numeric($input))
{ // in the event the input can't be sanitized
return NULL;
}
return $input;
}
function random_string_lower($length = 10, $keyspace = "0123456789abcdefghijklmnopqrstuvwxyz"): string
{
$out = '';
for ($i = 0; $i < $length; $i++)
{
$rand_index = random_int(0, strlen($keyspace) -1);
$out .= $keyspace[$rand_index];
}
return $out;
}
function random_string_upper($length = 10, $keyspace = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"): string
{
$out = '';
for ($i = 0; $i < $length; $i++)
{
$rand_index = random_int(0, strlen($keyspace) -1);
$out .= $keyspace[$rand_index];
}
return $out;
}
function random_string_gen($length = 10, $keyspace = '0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'): string // generates both lower and capital letters based on checkbox results
{ // https://github.com/FinGu/c_auth/blob/cfbd7036e69561e538e26dc47f7690dbc0d8ba53/functions/general/functions.php#L55
$out = '';
for ($i = 0; $i < $length; $i++)
{
$rand_index = random_int(0, strlen($keyspace) - 1);
$out .= $keyspace[$rand_index];
}
return $out;
}
function formatBytes($bytes, $precision = 2) // convert number of file bytes to human-recognizable unit
{ // https://stackoverflow.com/a/2510459
$units = array(
'B',
'KB',
'MB',
'GB',
'TB'
);
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
$bytes /= (1 << (10 * $pow));
return round($bytes, $precision) . ' ' . $units[$pow];
}
function generateRandomString($length = 10)
{ // https://stackoverflow.com/a/4356295
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++)
{
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
function generateRandomNum($length = 6)
{ // adapted from https://stackoverflow.com/a/4356295
$characters = '0123456789';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++)
{
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
function isBreached($pw) // query HaveIBeenPwned's API (huge dataset, FBI and many other agencies worldwide contrubute) to see if pass has been leaked. This only supplies their API with SHA1 hash prefix
{ // from https://github.com/Mikjaer/haveibeenpwned/blob/main/p0wned.php
$hash = strtoupper(sha1($pw));
foreach (explode("\n", file_get_contents("https://api.pwnedpasswords.com/range/" . substr($hash, 0, 5))) as $pmatch)
if (substr($hash, 0, 5) . substr($pmatch, 0, strpos($pmatch, ":")) == $hash)
return true;
}
function isPhonyEmail($email) // check if valid email format, if known temporary email, if email server online, and if mailbox found on email server
{
if(!filter_var($email, FILTER_VALIDATE_EMAIL))
{
return true;
}
$resp = file_get_contents("https://api.mailcheck.ai/email/" . $email);
$json = json_decode($resp);
if($json->disposable)
{
return true;
}
if (strpos($email, ".ru") !== false)
{
return false;
// russian email services either have a lot of downtime or heavy rate limits, because every other time I make SMTP connection with an .ru email it fails
}
if (strpos($email, "proton") !== false)
{
return false;
// protonmail is also giving us issues
}
ini_set("default_socket_timeout", 1);
$connection = @fsockopen("gmail-smtp-in.l.google.com", 25);
// check if port 25 is open (many hosts have it closed inherently)
if (is_resource($connection))
{
global $mail;
require_once (($_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/panel" || $_SERVER['DOCUMENT_ROOT'] == "/usr/share/nginx/html/api") ? "/usr/share/nginx/html" : $_SERVER['DOCUMENT_ROOT']) . '/includes/VerifyEmail.class.php';
return (!$mail->check($email));
}
else
{
return false;
}
}
function timeconversion($expires) {
$value = "";
$unit = "";
if ($expires >= 31536000) {
$value = floor($expires / 31536000);
$unit = 'Year(s)';
}
elseif ($expires >= 2419200) {
$value = floor($expires / 2592000);
$unit = 'Month(s)';
}
elseif ($expires >= 604800) {
$value = floor($expires / 604800);
$unit = 'Weeks(s)';
}
elseif ($expires >= 86400) {
$value = floor($expires / 86400);
$unit = 'Day(s)';
} elseif ($expires >= 3600) {
$value = floor($expires / 3600);
$unit = 'Hour(s)';
} elseif ($expires >= 60) {
$value = floor($expires / 60);
$unit = 'Minute(s)';
} else {
$value = $expires;
$unit = 'Second(s)';
}
return "$value $unit";
}
function isDisabled($enabledFunctions, $type) {
$perms = array(
`loginToggle` => 1,
`registerToggle` => 2,
`licenseToggle` => 4,
`chatGetToggle` => 8,
`chatSendToggle` => 16,
`getVarToggle` => 32,
`setVarToggle` => 64,
`banToggle` => 128,
`checkBlackToggle` => 256,
`sessionToggle` => 512,
`changeUsernameToggle` => 1024,
`fileToggle` => 2048,
`fetchOnlineToggle` => 4096,
`forgotPasswordToggle` => 8192,
`fetchStatsToggle` => 16384,
`logToggle` => 32768,
`webhookToggle` => 65536,
`varToggle` => 131072,
`upgradeToggle` => 262144
);
if (array_key_exists($type, $perms)) {
if (($enabledFunctions & $perms[$type]) != $perms[$type]) {
return true;
}
}
return false;
}

410
includes/misc/license.php Normal file
View File

@@ -0,0 +1,410 @@
<?php
namespace misc\license;
use misc\etc;
use misc\cache;
use misc\user;
use misc\mysql;
use misc\token;
function license_masking($mask, $int = null) // substitute random characters for upper-case and lower-case random character variables, X or x
{
$mask_arr = str_split($mask);
$size_of_mask = count($mask_arr);
for ($i = 0; $i < $size_of_mask; $i++)
{
if ($mask_arr[$i] === '*') {
if (isset($_POST['lowercaseLetters']) && $_POST['lowercaseLetters'] == 'on' && isset($_POST['capitalLetters']) && $_POST['capitalLetters'] == 'on')
{
$mask_arr[$i] = etc\random_string_gen(1);
}
elseif (isset($_POST['lowercaseLetters']) && $_POST['lowercaseLetters'] == 'on')
{
$mask_arr[$i] = etc\random_string_lower(1);
}
elseif (isset($_POST['capitalLetters']) && $_POST['capitalLetters'] == 'on')
{
$mask_arr[$i] = etc\random_string_upper(1);
}
else
{
if (isset($int)) {
if ($int === "1")
{
$mask_arr[$i] = etc\random_string_gen(1);
}
if ($int === "2")
{
$mask_arr[$i] = etc\random_string_upper(1);
}
if ($int === "3")
{
$mask_arr[$i] = etc\random_string_lower(1);
}
}
else {
$mask_arr[$i] = etc\random_string_gen(1);
}
}
}
}
return implode('', $mask_arr);
}
function createLicense($amount, $mask, $duration, $level, $note, $user, $expiry = null, $secret = null, $owner = null, $character = null)
{
$amount = etc\sanitize($amount);
$mask = etc\sanitize($mask);
$duration = etc\sanitize($duration);
$level = etc\sanitize($level);
$note = etc\sanitize($note);
$user = etc\sanitize($user);
$expiry = etc\sanitize($expiry);
$secret = etc\sanitize($secret);
$letters = etc\sanitize($character);
if ($amount > 100) {
return 'max_keys';
}
if (!isset($amount)) {
$amount = 1;
}
if (!is_numeric($level)) {
$level = 1;
}
if (is_null($expiry)) {
$expiry = 86400; // set unit to day(s) if license expiry unit isn't specified (as it isn't with SellerAPI)
}
$duration = $duration * $expiry;
if ($amount > 1 && strpos($mask, '*') === false) {
return 'dupe_custom_key';
}
switch ($_SESSION['role'])
{
case 'tester':
$query = mysql\query("SELECT 1 FROM `keys` WHERE `genby` = ? AND `app` = ?",[$_SESSION['username'], $_SESSION['app']]);
$currkeys = $query->num_rows;
if ($currkeys + $amount > 10) {
return 'tester_limit';
}
$mask = "VAULTCORD-" . $mask;
break;
case 'Reseller':
if ($amount < 0) {
return 'no_negative';
}
$query = mysql\query("SELECT `keylevels`, `balance` FROM `accounts` WHERE `username` = ?",[$_SESSION['username']]);
$row = mysqli_fetch_array($query->result);
$keylevels = explode("|", $row['keylevels']);
$balance = explode("|", $row['balance']);
if ($row['keylevels'] != "N/A" && !in_array($level, $keylevels)) {
return 'unauthed_level';
}
$day = $balance[0];
$week = $balance[1];
$month = $balance[2];
$threemonth = $balance[3];
$sixmonth = $balance[4];
$lifetime = $balance[5];
$year = $balance[6];
switch ($expiry) {
case '1 Day':
$duration = 86400;
$day = $day - $amount;
break;
case '1 Week':
$duration = 604800;
$week = $week - $amount;
break;
case '1 Month':
$duration = 2.592e+6;
$month = $month - $amount;
break;
case '3 Month':
$duration = 7.862e+6;
$threemonth = $threemonth - $amount;
break;
case '6 Month':
$duration = 1.572e+7;
$sixmonth = $sixmonth - $amount;
break;
case '1 Lifetime':
$duration = 8.6391e+8;
$lifetime = $lifetime - $amount;
break;
case '1 Year':
$duration = 3.1536e+7;
$year = $year - $amount;
break;
default:
return 'invalid_exp';
}
if ($day < 0 || $month < 0 || $week < 0 || $threemonth < 0 || $sixmonth < 0 || $lifetime < 0 || $year < 0) {
return 'insufficient_balance';
}
$balance = $day . '|' . $week . '|' . $month . '|' . $threemonth . '|' . $sixmonth . '|' . $lifetime . '|' . $year;
$query = mysql\query("UPDATE `accounts` SET `balance` = ? WHERE `username` = ?",[$balance, $_SESSION['username']]);
break;
case 'seller':
cache\purge('KeyAuthKeys:' . ($secret ?? $_SESSION['app']));
break;
}
if(!is_null($secret)) {
cache\purge('KeyAuthKeys:' . ($secret ?? $_SESSION['app']));
}
$licenses = array();
for ($i = 0; $i < $amount; $i++) {
$license = license_masking($mask, $letters);
if (token\ModifyUserToken($license, "License") === "failed") {
return "failure";
}
$query = mysql\query("INSERT INTO `keys` (`key`, `user`, `note`, `expires`, `status`, `level`, `genby`, `gendate`, `app`) VALUES (?, ?, NULLIF(?, ''), ?, 'Not Used', ?, ?, ?, ?)", [$license, $user, $note, $duration, $level, $owner ?? $_SESSION['username'], time(), $secret ?? $_SESSION['app']]);
$licenses[] = $license;
}
return $licenses;
}
function addTime($time, $expiry, $secret = null)
{
$time = etc\sanitize($time);
$expiry = etc\sanitize($expiry);
$time = $time * $expiry;
$query = mysql\query("UPDATE `keys` SET `expires` = `expires`+? WHERE `app` = ? AND `status` = 'Not Used'",[$time, $secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0)
{
if ($_SESSION['role'] == "seller" || !is_null($secret))
{
cache\purge('KeyAuthKeys:' . ($secret ?? $_SESSION['app']));
}
return 'success';
}
else
{
return 'failure';
}
}
function deleteAll($secret = null)
{
$query = mysql\query("DELETE FROM `keys` WHERE `app` = ?",[$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0)
{
$query = mysql\query("DELETE FROM `tokens` WHERE `app` = ? AND `type` = ?",[$secret ?? $_SESSION['app'], "license"]);
if ($query->affected_rows > 0) { cache\purgePattern('KeyAuthUserTokens:' . ($secret ?? $_SESSION['app'])); }
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthKeys:' . ($secret ?? $_SESSION['app']));
}
return 'success';
}
else
{
return 'failure';
}
}
function deleteAllUnused($secret = null)
{
$query = mysql\query("DELETE FROM `keys` WHERE `app` = ? AND `status` = 'Not Used'",[$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0)
{
$query = mysql\query("DELETE FROM `tokens` WHERE `app` = ? AND `status` = ? AND `type` = ?",[$secret ?? $_SESSION['app'], "Not Used", "license"]);
if ($query->affected_rows > 0) { cache\purgePattern('KeyAuthUserTokens:' . ($secret ?? $_SESSION['app'])); }
if ($_SESSION['role'] == "seller" || !is_null($secret))
{
cache\purge('KeyAuthKeys:' . ($secret ?? $_SESSION['app']));
}
return 'success';
}
else
{
return 'failure';
}
}
function deleteAllUsed($secret = null)
{
$query = mysql\query("DELETE FROM `keys` WHERE `app` = ? AND `status` = 'Used'",[$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0)
{
if ($_SESSION['role'] == "seller" || !is_null($secret))
{
cache\purge('KeyAuthKeys:' . ($secret ?? $_SESSION['app']));
}
return 'success';
}
else
{
return 'failure';
}
}
function deleteSingular($key, $userToo, $secret = null)
{
$key = etc\sanitize($key);
$userToo = etc\sanitize($userToo);
if ($_SESSION['role'] == "Reseller")
{
$query = mysql\query("SELECT 1 FROM `keys` WHERE `app` = ? AND `key` = ? AND `genby` = ?",[$secret ?? $_SESSION['app'], $key, $_SESSION['username']]);
if ($query->num_rows < 1)
{
return 'nope';
}
}
if ($userToo) {
$query = mysql\query("SELECT `usedby` FROM `keys` WHERE `app` = ? AND `key` = ?",[$secret ?? $_SESSION['app'], $key]);
$row = mysqli_fetch_array($query->result);
$usedby = $row['usedby'];
user\deleteSingular($usedby, $secret);
}
$query = mysql\query("DELETE FROM `subs` WHERE `app` = ? AND `key` = ?",[$secret ?? $_SESSION['app'], $key]);// delete any subscriptions created with key
$query = mysql\query("DELETE FROM `tokens` WHERE `app` = ? AND `assigned` = ?", [$secret ?? $_SESSION['app'], $key]);
$query = mysql\query("DELETE FROM `keys` WHERE `app` = ? AND `key` = ?",[$secret ?? $_SESSION['app'], $key]);
if ($query->affected_rows > 0) {
cache\purgePattern('KeyAuthUserTokens:' . ($secret ?? $_SESSION['app']));
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthKeys:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthKey:' . ($secret ?? $_SESSION['app']) . ':' . $key);
}
return 'success';
} else {
return 'failure';
}
}
function deleteMultiple($keys, $userToo, $secret = null) {
$keys = explode(', ', $keys);
$userToo = etc\sanitize($userToo);
foreach ($keys as $key) {
$key = etc\sanitize(trim($key));
if ($_SESSION['role'] == "Reseller") {
$query = mysql\query("SELECT 1 FROM `keys` WHERE `app` = ? AND `key` = ? AND `genby` = ?",[$secret ?? $_SESSION['app'], $key, $_SESSION['username']]);
if ($query->num_rows < 1) {
return 'nope';
}
}
if ($userToo) {
$query = mysql\query("SELECT `usedby` FROM `keys` WHERE `app` = ? AND `key` = ?",[$secret ?? $_SESSION['app'], $key]);
$row = mysqli_fetch_array($query->result);
$usedby = $row['usedby'];
user\deleteSingular($usedby, $secret);
}
$query = mysql\query("DELETE FROM `subs` WHERE `app` = ? AND `key` = ?",[$secret ?? $_SESSION['app'], $key]);// delete any subscriptions created with key
$query = mysql\query("DELETE FROM `tokens` WHERE `app` = ? AND `assigned` = ?", [$secret ?? $_SESSION['app'], $key]);
$query = mysql\query("DELETE FROM `keys` WHERE `app` = ? AND `key` = ?",[$secret ?? $_SESSION['app'], $key]);
if ($query->affected_rows > 0) {
cache\purgePattern('KeyAuthUserTokens:' . ($secret ?? $_SESSION['app']));
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthKeys:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthKey:' . ($secret ?? $_SESSION['app']) . ':' . $key);
}
} else {
return 'failure';
}
}
return 'success';
}
function ban($key, $reason, $userToo, $secret = null)
{
$key = etc\sanitize($key);
$reason = etc\sanitize($reason);
$userToo = etc\sanitize($userToo);
if ($_SESSION['role'] == "Reseller")
{
$query = mysql\query("SELECT 1 FROM `keys` WHERE `app` = ? AND `key` = ? AND `genby` = ?", [$secret ?? $_SESSION['app'], $key, $_SESSION['username']]);
if ($query->num_rows === 0)
{
return 'nope';
}
}
if ($userToo) {
$query = mysql\query("SELECT `usedby` FROM `keys` WHERE `app` = ? AND `key` = ?", [$secret ?? $_SESSION['app'], $key]);
$row = mysqli_fetch_array($query->result);
$usedby = $row['usedby'];
user\ban($usedby, $reason, $secret);
}
$query = mysql\query("UPDATE `keys` SET `banned` = ?, `status` = 'Banned' WHERE `app` = ? AND `key` = ?",[$reason, $secret ?? $_SESSION['app'], $key]);
if ($query->affected_rows > 0)
{
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthKeys:' . ($secret ?? $_SESSION['app']));
}
$query = mysql\query("UPDATE `tokens` SET `banned` = 1, `reason` = ? WHERE `app` = ? AND `assigned` = ? AND `type` = ?", [$reason, $secret ?? $_SESSION['app'], $key, "license"]);
if ($query->affected_rows > 0) {
cache\purgePattern('KeyAuthUserTokens:' . ($secret ?? $_SESSION['app']));
} else {
return 'failure';
}
return 'success';
}
else
{
return 'failure';
}
}
function unban($key, $secret = null)
{
$key = etc\sanitize($key);
if ($_SESSION['role'] == "Reseller")
{
$query = mysql\query("SELECT 1 FROM `keys` WHERE `app` = ? AND `key` = ? AND `genby` = ?",[$secret ?? $_SESSION['app'], $key, $_SESSION['username']]);
if ($query->num_rows === 0)
{
return 'nope';
}
}
$status = "Not Used";
$query = mysql\query("SELECT `usedby` FROM `keys` WHERE `app` = ? AND `key` = ?",[$secret ?? $_SESSION['app'], $key]);
$row = mysqli_fetch_array($query->result);
if (!is_null($row['usedby']))
{
$status = "Used";
user\unban($row['usedby'], $secret);
}
$query = mysql\query("UPDATE `keys` SET `banned` = NULL, `status` = ? WHERE `app` = ? AND `key` = ?",[$status, $secret ?? $_SESSION['app'], $key]);// update key from banned to its old status
if ($query->affected_rows > 0)
{
if ($_SESSION['role'] == "seller" || !is_null($secret))
{
cache\purge('KeyAuthKeys:' . ($secret ?? $_SESSION['app']));
}
$query = mysql\query("UPDATE `tokens` SET `banned` = 0, `reason` = NULL WHERE `app` = ? AND `assigned` = ? AND `type` = ?", [$secret ?? $_SESSION['app'], $key, "license"]);
if ($query->affected_rows > 0) {
cache\purgePattern('KeyAuthUserTokens:' . ($secret ?? $_SESSION['app']));
} else {
return 'failure';
}
return 'success';
}
else
{
return 'failure';
}
}

16
includes/misc/log.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
namespace misc\logging;
use misc\etc;
use misc\mysql;
function deleteAll($secret = null)
{
$query = mysql\query("DELETE FROM `logs` WHERE `logapp` = ?",[$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
return 'success';
} else {
return 'failure';
}
}

74
includes/misc/mysql.php Normal file
View File

@@ -0,0 +1,74 @@
<?php
namespace misc\mysql;
function query($query, $args = [], $types = null)
{
static $connection = null;
static $readOnlyConnection = null;
global $mysqlRequireSSL;
global $databaseHost;
global $databaseUsername;
global $databasePassword;
global $databaseName;
global $readOnlyRegions;
// use read-only database replica, for lower latency in regions far away from the primary database region
if(strtolower(substr($query, 0, 6)) == "select" && isset($readOnlyRegions[$_SERVER['SERVER_ADDR']])) {
if (!$readOnlyConnection) {
$readOnlyConnection = new \mysqli();
if ($mysqlRequireSSL) {
$readOnlyConnection->ssl_set(NULL, NULL, "/etc/ssl/certs/ca-bundle.crt", NULL, NULL);
}
$readOnlyConnection->real_connect($readOnlyRegions[$_SERVER['SERVER_ADDR']]["host"], $readOnlyRegions[$_SERVER['SERVER_ADDR']]["username"], $readOnlyRegions[$_SERVER['SERVER_ADDR']]["password"], $databaseName);
if (!$readOnlyConnection)
die($readOnlyConnection->connect_error);
$readOnlyConnection->set_charset('utf8');
}
$connectionToUse = $readOnlyConnection;
}
else {
if (!$connection) {
$connection = new \mysqli();
if ($mysqlRequireSSL) {
$connection->ssl_set(NULL, NULL, "/etc/ssl/certs/ca-bundle.crt", NULL, NULL);
}
$connection->real_connect($databaseHost, $databaseUsername, $databasePassword, $databaseName);
if (!$connection)
die($connection->connect_error);
$connection->set_charset('utf8');
}
$connectionToUse = $connection;
}
if ($types === null && $args !== [])
$types = str_repeat('s', count($args)); // unless otherwise specified, set type to string
$stmt = $connectionToUse->prepare($query);
if (!$stmt)
die($connectionToUse->error);
if (strpos($query, '?') !== false)
$stmt->bind_param($types, ...$args);
$stmt->execute();
$query = new \stdClass();
$query->result = $stmt->get_result();
$query->num_rows = $query->result->num_rows;
$query->affected_rows = $stmt->affected_rows;
$stmt->close();
return $query;
}

53
includes/misc/session.php Normal file
View File

@@ -0,0 +1,53 @@
<?php
namespace misc\session;
use misc\etc;
use misc\cache;
use misc\mysql;
function killAll($secret = null)
{
$query = mysql\query("DELETE FROM `sessions` WHERE `app` = ?",[$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
cache\purgePattern('KeyAuthState:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthSessions:' . ($secret ?? $_SESSION['app']));
return 'success';
} else {
return 'failure';
}
}
function killSingular($id, $secret = null)
{
$id = etc\sanitize($id);
$query = mysql\query("SELECT `ip` FROM `sessions` WHERE `app` = ? AND `id` = ?",[$secret ?? $_SESSION['app'], $id]);
$row = mysqli_fetch_array($query->result);
$query = mysql\query("DELETE FROM `sessions` WHERE `app` = ? AND `id` = ?",[$secret ?? $_SESSION['app'], $id]);
if ($query->affected_rows > 0) {
global $cfZoneIdCache;
global $cfApiKeyCache;
$appSecret = ($secret ?? $_SESSION['app']);
$sessionId = strtolower($id);
$url = "https://api.cloudflare.com/client/v4/zones/{$cfZoneIdCache}/purge_cache";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode(array("files" => ["https://keyauth.win/api/KeyAuthState-{$appSecret}-{$sessionId}"])));
$headers = array(
"Authorization: Bearer {$cfApiKeyCache}",
"Content-Type: application/json",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_exec($curl);
cache\purge('KeyAuthState:' . ($secret ?? $_SESSION['app']) . ':' . $id);
return 'success';
} else {
return 'failure';
}
}

84
includes/misc/sub.php Normal file
View File

@@ -0,0 +1,84 @@
<?php
namespace misc\sub;
use misc\etc;
use misc\cache;
use misc\mysql;
function deleteSingular($subscription, $secret = null){
$subscription = etc\sanitize($subscription);
$query = mysql\query("DELETE FROM `subscriptions` WHERE `app` = ? AND `name` = ?",[$secret ?? $_SESSION['app'], $subscription]);
if ($query->affected_rows > 0) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthSubscriptions:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function deleteAll($secret = null){
$query = mysql\query("DELETE FROM `subscriptions` WHERE `app` = ? AND `name` != ?",[$secret ?? $_SESSION['app'], "default"]);
if ($query->affected_rows > 0) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthSubscriptions:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function add($name, $level, $secret = null){
$name = etc\sanitize($name);
$level = etc\sanitize($level);
$query = mysql\query("SELECT 1 FROM `subscriptions` WHERE `name` = ? AND `app` = ?", [$name, $secret ?? $_SESSION['app']]);
if ($query->num_rows > 0){
return 'already_exists';
}
$query = mysql\query("INSERT INTO `subscriptions` (`name`, `level`, `app`) VALUES (?, ?, ?)",[$name , $level,$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthSubscriptions:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function pause($subscription, $secret = null){
$subscription = etc\sanitize($subscription);
$query = mysql\query("SELECT * FROM `subs` WHERE `app` = ? AND `expiry` > ? AND `subscription` = ?", [$secret ?? $_SESSION['app'], time(), $subscription], "sis");
$updateQuery = NULL;
while ($row = mysqli_fetch_array($query->result)){
$expires = $row['expiry'];
$exp = (int)$expires - time();
$updateQuery = mysql\query("UPDATE `subs` SET `paused` = 1, `expiry` = ? WHERE `app` = ? AND `id` = ?", [$exp, $secret ?? $_SESSION['app'], $row['id']], "iss");
}
if ($updateQuery->affected_rows > 0){
cache\purge('KeyAuthSubs:' . $secret ?? $_SESSION['app'] . ':' . $subscription);
return 'success';
} else {
return 'failure';
}
}
function unpause($subscription, $secret = null){
$subscription = etc\sanitize($subscription);
$query = mysql\query("SELECT * FROM `subs` WHERE `app` = ? AND `subscription` = ? AND `paused` = 1", [$secret ?? $_SESSION['app'], $subscription]);
$updateQuery = NULL;
while ($row = mysqli_fetch_array($query->result)){
$expires = $row['expiry'];
$exp = (int)$expires + time();
$updateQuery = mysql\query("UPDATE `subs` SET `paused` = 0, `expiry` = ? WHERE `app` = ? AND `id` = ?", [$exp, $secret ?? $_SESSION['app'], $row['id']], "iss");
}
if ($updateQuery->affected_rows > 0){
cache\purge('KeyAuthSubs:' . $secret ?? $_SESSION['app'] . ':' . $subscription);
return 'success';
} else {
return 'failure';
}
}

182
includes/misc/token.php Normal file
View File

@@ -0,0 +1,182 @@
<?php
namespace misc\token;
use misc\etc;
use misc\cache;
use misc\mysql;
function IsAssignedToken($credential, $type, $secret = null, $return_token = false) {
$type = strtolower($type);
if ($type !== "user" && $type !== "license") { return "invalid_type"; }
$row = cache\fetch('KeyAuthUserTokenCheck:' . $secret ?? $_SESSION["app"] . ':' . $credential, "SELECT `token` FROM `tokens` WHERE `app` = ? AND `type` = ? AND `assigned` = ?", [$secret ?? $_SESSION["app"], $type, $credential], 0);
if ($row === "not_found") {
return false;
}
else {
if ($return_token) { return $row["token"]; }
else { return true; }
}
}
function ModifyUserToken($credential, $type, $token = null, $username = null, $secret = null) {
$generated_token = bin2hex(random_bytes(16));
switch ($type) {
case 'User':
$query = mysql\query("INSERT INTO `tokens` (`app`, `token`, `type`, `assigned`) VALUES (?, ?, ?, ?)", [$secret ?? $_SESSION["app"], $generated_token, "user", $credential]);
if ($query->affected_rows < 1) {
return "failed";
}
else {
return "success";
}
case 'License':
$query = mysql\query("INSERT INTO `tokens` (`app`, `token`, `type`, `assigned`) VALUES (?, ?, ?, ?)", [$secret ?? $_SESSION["app"], $generated_token, "license", $credential]);
if ($query->affected_rows < 1) {
return "failed";
}
else {
return "success";
}
case 'UpdateToUser':
$query = mysql\query("UPDATE `tokens` SET `type` = ?, SET `assigned` = ? WHERE `app` = ? AND `token` = ?", ["user", $username, $secret ?? $_SESSION["app"], $token]);
if ($query->affected_rows < 1) {
return "failed";
}
else {
cache\purge('KeyAuthUserTokens:' . $secret . ':' . $token);
return "success";
}
case 'UpdateStatus':
$query = mysql\query("UPDATE `tokens` SET `status` = ? WHERE `token` = ? AND `app` = ?", ["Used", $token, $secret ?? $_SESSION["app"]]);
if ($query->affected_rows < 1) {
return "failed";
}
else {
cache\purge('KeyAuthUserTokens:'.$secret ?? $_SESSION["app"] . ':' . $token);
return "success";
}
}
}
function checktoken($function, $token, $secret, $username = NULL, $token_hash = NULL) {
$token = etc\sanitize($token);
$row = cache\fetch('KeyAuthUserTokens:'.$secret.':'.$token ,"SELECT * FROM `tokens` WHERE `token` = ? AND `app` = ?", [$token, $secret], 0);
if ($row === "not_found") {
return "invalid_token";
}
switch ($function) {
case 'check_data':
if ($row["banned"]) {
return "token_blacklisted, " . $row["reason"];
}
if (!is_null($row["hash"]) && $row["hash"] !== $token_hash) {
return "hash_mismatch";
}
if (is_null($row["hash"]))
{
mysql\query("UPDATE `tokens` SET `hash` = ? WHERE `token` = ? AND `app` = ?", [$token_hash, $token, $secret]);
cache\purge('KeyAuthUserTokens:'.$secret ?? $_SESSION["app"] . ':' . $token);
}
return 'success';
case 'check_username':
if (!is_null($username) && $row["assigned"] !== $username) {
return "token_reuse";
}
}
}
function addtokenblacklist($token, $reason, $secret = null) {
$token = etc\sanitize($token);
$reason = etc\sanitize($reason);
$query = mysql\query("UPDATE `tokens` SET `reason` = ?, `status` = ? WHERE `token` = ? AND `app` = ?", [$reason, 1, $token, $secret ?? $_SESSION["app"]]);
cache\purge('KeyAuthUserTokens:'.$secret ?? $_SESSION["app"] . ':' . $token);
if ($query->affected_rows < 0) {
return "failed";
}
if ($query->affected_rows > 0) {
return "success";
}
}
function removetokenblacklist($token, $secret = null) {
$token = etc\sanitize($token);
$query = mysql\query("UPDATE `tokens` SET `reason` = ?, `status` = ? WHERE `token` = ? AND `app` = ?", ["", 0, $token, $secret ?? $_SESSION["app"]]);
cache\purge('KeyAuthUserTokens:'.$secret ?? $_SESSION["app"] . ':' . $token);
if ($query->affected_rows < 0) {
return "failed";
}
if ($query->affected_rows > 0) {
return "success";
}
}
function resettokenhash($token, $secret = null) {
$token = etc\sanitize($token);
$query = mysql\query("UPDATE `tokens` SET `hash` = ? WHERE `token` = ? AND `app` = ?", [NULL, $token, $secret]);
cache\purge('KeyAuthUserTokens:'.$secret ?? $_SESSION["app"] . ':' . $token);
if ($query->affected_rows < 0) {
return "failed";
}
if ($query->affected_rows > 1) {
return "success";
}
}
?>

161
includes/misc/upload.php Normal file
View File

@@ -0,0 +1,161 @@
<?php
namespace misc\upload;
use misc\etc;
use misc\cache;
use misc\mysql;
function add($url, $authed, $secret = null){
$url = etc\sanitize($url);
$authed = etc\sanitize($authed);
if (!filter_var($url, FILTER_VALIDATE_URL)) {
return 'invalid';
}
if (str_contains($url, "discord")) {
return 'discord_cdn';
}
if (str_contains($url, "github.com")) {
return 'github_no_raw';
}
if(str_contains($url, "localhost") || str_contains($url, "127.0.0.1") || str_contains($url, "file:/"))
return 'no_local';
//$requiredExtension = array(
// // Common file types
// ".zip", ".pdf", ".tiff", ".png", ".exe", ".psd", ".mp3", ".mp4",
// ".jar", ".xls", ".csv", ".bmp", ".txt", ".xml", ".rar", ".jpg", ".jpeg",
// ".doc", ".eps", ".avi", ".mov", ".apk", ".ios", ".sys", ".dll", ".js",
//
// // Web development
// ".html", ".css", ".php", ".json", ".asp", ".aspx", ".jsp", ".htaccess",
//
// // Programming languages
// ".c", ".cpp", ".h", ".java", ".py", ".php", ".js", ".html", ".css",
// ".rb", ".swift", ".pl", ".lua", ".sh", ".bat", ".ps1", ".ts",
//
// // Database
// ".sql", ".db", ".mdb", ".accdb", ".sqlite", ".dbf",
//
// // Markup and document formats
// ".markdown", ".md", ".rst", ".tex", ".latex", ".odt", ".docx", ".pptx",
//
// // Configuration files
// ".ini", ".yaml", ".yml", ".json", ".xml", ".cfg", ".conf",
//
// // Archive and compression
// ".7z", ".gz", ".tar", ".bz2", ".xz", ".z", ".rar",
//
// // Data interchange formats
// ".json", ".xml", ".yaml", ".csv",
//
// // Version control
// ".gitignore", ".gitattributes", ".gitkeep",
//
// // Compiled files
// ".class", ".o", ".obj", ".lib", ".dll", ".so",
//
// // Executable scripts
// ".bat", ".sh", ".ps1", ".bash",
//
// // Virtualization
// ".vmdk", ".vdi", ".ova", ".ovf",
//
// // Configuration and settings
// ".conf", ".config", ".settings",
//
// // Configuration and log files
// ".log", ".log1", ".log2", ".bak", ".backup", ".swp", ".ttf",
//
// // binary, I (mak) am going to tell people rename their files to .bin so catbox.moe accepts it
// ".bin"
//);
//$linkExtension = strtolower(substr($url, strrpos($url, ".")));
//
//if (!in_array($linkExtension, $requiredExtension)){
// return 'invalid_extension';
//}
// Initialize cURL session
$ch = curl_init($url);
// Set options
curl_setopt($ch, CURLOPT_NOBODY, true); // Only fetch headers, no body
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the transfer as a string
curl_setopt($ch, CURLOPT_HEADER, true); // Include the header in the output
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla KeyAuth');
$response = curl_exec($ch);
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpStatusCode == 403 || $httpStatusCode == 404) {
return 'bad_response';
}
// Get content length
$filesize = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
$contType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
if(str_contains($contType, "html")) {
return 'invalid_extension';
}
if ($filesize > 10000000 && $_SESSION['role'] == "tester") {
return 'tester_file_exceed';
} else if ($filesize > 50000000 && ($_SESSION['role'] == "developer" || $_SESSION['role'] == "Manager")) {
return 'dev_file_exceed';
} else if ($filesize > 75000000) {
return 'seller_file_exceed';
}
$id = etc\generateRandomNum();
$fn = basename(parse_url($url, PHP_URL_PATH));
$fs = etc\formatBytes($filesize);
if (strlen($fn) > 49) {
return 'name_too_large';
}
$query = mysql\query("INSERT INTO `files` (name, id, url, size, uploaddate, app, authed) VALUES (?, ?, ?, ?, ?, ?, ?)", [$fn, $id, $url, $fs, time(), $secret ?? $_SESSION['app'], $authed]);
if ($query->affected_rows > 0) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthFiles:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function deleteAll($secret = null){
$query = mysql\query("DELETE FROM `files` WHERE `app` = ?", [$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
cache\purgePattern('KeyAuthFile:' . ($secret ?? $_SESSION['app']));
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthFiles:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function deleteSingular($file, $secret = null){
$file = etc\sanitize($file);
$query = mysql\query("DELETE FROM `files` WHERE `app` = ? AND `id` = ?", [$secret ?? $_SESSION['app'], $file]);
if ($query->affected_rows > 0) {
cache\purge('KeyAuthFile:' . ($secret ?? $_SESSION['app']) . ':' . $file);
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthFiles:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}

524
includes/misc/user.php Normal file
View File

@@ -0,0 +1,524 @@
<?php
namespace misc\user;
use misc\etc;
use misc\cache;
use misc\blacklist;
use misc\mysql;
use misc\token;
function deleteSingular($username, $secret = null)
{
$username = etc\sanitize($username);
if ($_SESSION['role'] == "Reseller") {
$query = mysql\query("SELECT 1 FROM `users` WHERE `app` = ? AND `username` = ? AND `owner` = ?", [$secret ?? $_SESSION['app'], $username, $_SESSION['username']]);
if ($query->num_rows < 1) {
return 'nope';
}
}
$query = mysql\query("DELETE FROM `subs` WHERE `app` = ? AND `user` = ?", [$secret ?? $_SESSION['app'], $username]);
$query = mysql\query("DELETE FROM `uservars` WHERE `app` = ? AND `user` = ?", [$secret ?? $_SESSION['app'], $username]);
$query = mysql\query("DELETE FROM `tokens` WHERE `app` = ? AND `assigned` = ? AND `type` = ?", [$secret ?? $_SESSION['app'], $username, "user"]);
$query = mysql\query("DELETE FROM `users` WHERE `app` = ? AND `username` = ?", [$secret ?? $_SESSION['app'], $username]);
if ($query->affected_rows > 0) {
cache\purge('KeyAuthUser:' . ($secret ?? $_SESSION['app']) . ':' . $username);
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthUsernames:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthUsers:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function setVariable($user, $var, $data, $secret = null, $readOnly = 0)
{
$user = etc\sanitize($user);
$var = etc\sanitize($var);
$data = etc\sanitize($data);
$readOnly = intval($readOnly);
if ($user == "all") {
$query = mysql\query("SELECT `username` FROM `users` WHERE `app` = ?", [$secret ?? $_SESSION['app']]);
if ($query->num_rows < 1) {
return 'missing';
}
$rows = array();
while ($r = mysqli_fetch_assoc($query->result)) {
$rows[] = $r;
}
foreach ($rows as $row) {
$query = mysql\query("REPLACE INTO `uservars` (`name`, `data`, `user`, `app`, `readOnly`) VALUES (?, ?, ?, ?, ?)", [$var, $data, $row['username'], $secret ?? $_SESSION['app'], $readOnly]);
}
cache\purgePattern('KeyAuthUserVar:' . ($secret ?? $_SESSION['app']));
} else {
$query = mysql\query("REPLACE INTO `uservars` (`name`, `data`, `user`, `app`, `readOnly`) VALUES (?, ?, ?, ?, ?)", [$var, $data, $user, $secret ?? $_SESSION['app'], $readOnly]);
cache\purge('KeyAuthUserVar:' . ($secret ?? $_SESSION['app']) . ':' . $var . ':' . $user);
}
if ($query->affected_rows > 0) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthUserVars:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function ban($username, $reason, $secret = null)
{
$username = etc\sanitize($username);
$reason = etc\sanitize($reason);
if ($_SESSION['role'] == "Reseller") {
$query = mysql\query("SELECT 1 FROM `users` WHERE `app` = ? AND `username` = ? AND `owner` = ?", [$secret ?? $_SESSION['app'], $username, $_SESSION['username']]);
if ($query->num_rows < 1) {
return 'nope';
}
}
$query = mysql\query("SELECT * FROM `users` WHERE `app` = ? AND `username` = ?", [$secret ?? $_SESSION['app'], $username]);
if ($query->num_rows < 1) {
return 'missing';
}
$row = mysqli_fetch_array($query->result);
$hwid = $row["hwid"];
$ip = $row["ip"];
$query = mysql\query("UPDATE `users` SET `banned` = ? WHERE `app` = ? AND `username` = ?", [$reason, $secret ?? $_SESSION['app'], $username]);
if (!is_null($hwid)) {
blacklist\add($hwid, "Hardware ID", ($secret ?? $_SESSION['app']));
}
if (!is_null($ip)) {
blacklist\add($ip, "IP Address", ($secret ?? $_SESSION['app']));
}
if ($query->affected_rows > 0) {
mysql\query("UPDATE `tokens` SET `banned` = ?, `reason` = ? WHERE `app` = ? AND `assigned` = ? AND `type` = ?", [1, $reason, $secret ?? $_SESSION['app'], $username, "user"]);
cache\purge('KeyAuthUser:' . ($secret ?? $_SESSION['app']) . ':' . $username);
cache\purge('KeyAuthUserTokens:' . ($secret ?? $_SESSION['app']) . ':' . token\IsAssignedToken($username, "user", $secret ?? $_SESSION["app"], true));
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthUsernames:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthUsers:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function pauseUser($username, $secret = null){
$username = etc\sanitize($username);
$query = mysql\query("SELECT * FROM `subs` WHERE `app` = ? AND `expiry` > ? AND `user` = ?", [$secret ?? $_SESSION['app'], time(), $username], "sis");
$updateQuery = NULL;
while ($row = mysqli_fetch_array($query->result)){
$expires = $row['expiry'];
$exp = (int)$expires - time();
$updateQuery = mysql\query("UPDATE `subs` SET `paused` = 1, `expiry` = ? WHERE `app` = ? AND `id` = ?", [$exp, $secret ?? $_SESSION['app'], $row['id']], "iss");
}
if ($updateQuery->affected_rows > 0){
cache\purge('KeyAuthSubs:' . $secret ?? $_SESSION['app'] . ':' . $username);
return 'success';
} else {
return 'failure';
}
}
function unpauseUser($username, $secret = null){
$username = etc\sanitize($username);
$query = mysql\query("SELECT * FROM `subs` WHERE `app` = ? AND `user` = ? AND `paused` = 1", [$secret ?? $_SESSION['app'], $username]);
$updateQuery = NULL;
while ($row = mysqli_fetch_array($query->result)){
$expires = $row['expiry'];
$exp = (int)$expires + time();
$updateQuery = mysql\query("UPDATE `subs` SET `paused` = 0, `expiry` = ? WHERE `app` = ? AND `id` = ?", [$exp, $secret ?? $_SESSION['app'], $row['id']], "iss");
}
if ($updateQuery->affected_rows > 0){
cache\purge('KeyAuthSubs:' . $secret ?? $_SESSION['app'] . ':' . $username);
return 'success';
} else {
return 'failure';
}
}
function unban($username, $secret = null)
{
$username = etc\sanitize($username);
if ($_SESSION['role'] == "Reseller") {
$query = mysql\query("SELECT 1 FROM `users` WHERE `app` = ? AND `username` = ? AND `owner` = ?", [$secret ?? $_SESSION['app'], $username, $_SESSION['username']]);
if ($query->num_rows < 1) {
return 'nope';
}
}
$query = mysql\query("SELECT `hwid`, `ip` FROM `users` WHERE `app` = ? AND `username` = ?", [$secret ?? $_SESSION['app'], $username]);
if ($query->num_rows < 1) {
return 'missing';
}
$row = mysqli_fetch_array($query->result);
$hwid = $row["hwid"];
$ip = $row["ip"];
cache\purgePattern('KeyAuthBlacklist:' . ($secret ?? $_SESSION['app']) . ':' . $ip);
if (!is_null($hwid)) {
cache\purgePattern('KeyAuthBlacklist:' . ($secret ?? $_SESSION['app']) . ':*:' . $hwid);
}
$query = mysql\query("DELETE FROM `bans` WHERE `hwid` = ? OR `ip` = ? AND `app` = ?", [$hwid, $ip, $secret ?? $_SESSION['app']]);
$query = mysql\query("UPDATE `users` SET `banned` = NULL WHERE `app` = ? AND `username` = ?", [$secret ?? $_SESSION['app'], $username]);
if ($query->affected_rows > 0) {
mysql\query("UPDATE `tokens` SET `banned` = 0, `reason` = NULL WHERE `app` = ? AND `assigned` = ? AND `type` = ?", [$secret ?? $_SESSION['app'], $username, "user"]);
cache\purge('KeyAuthUserTokens:' . ($secret ?? $_SESSION['app']) . ':' . token\IsAssignedToken($username, "user", $secret ?? $_SESSION["app"], true));
cache\purge('KeyAuthUser:' . ($secret ?? $_SESSION['app']) . ':' . $username);
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthUsernames:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthUsers:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function deleteVar($username, $var, $secret = null)
{
$username = etc\sanitize($username);
$var = etc\sanitize($var);
$query = mysql\query("DELETE FROM `uservars` WHERE `app` = ? AND `user` = ? AND `name` = ?", [$secret ?? $_SESSION['app'], $username, $var]);
if ($query->affected_rows > 0) {
cache\purge('KeyAuthUserVar:' . ($secret ?? $_SESSION['app']) . ':' . $var . ':' . $username);
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthUserVars:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function deleteSub($username, $sub, $secret = null)
{
$username = etc\sanitize($username);
$sub = etc\sanitize($sub);
$query = mysql\query("DELETE FROM `subs` WHERE `app` = ? AND `user` = ? AND `subscription` = ?", [$secret ?? $_SESSION['app'], $username, $sub]);
if ($query->affected_rows > 0) {
cache\purge('KeyAuthSubs:' . ($secret ?? $_SESSION['app']) . ':' . $username);
return 'success';
} else {
return 'failure';
}
}
function extend($username, $sub, $expiry, $activeOnly = 0, $secret = null)
{
$username = etc\sanitize($username);
$sub = etc\sanitize($sub);
$expiry = etc\sanitize($expiry);
$query = mysql\query("SELECT 1 FROM `subscriptions` WHERE `name` = ? AND `app` = ?", [$sub, $secret ?? $_SESSION['app']]);
if ($query->num_rows < 1) {
return 'sub_missing';
} else if ($expiry < time()) {
return 'date_past';
}
if ($username == "all") {
if (!$activeOnly) {
$query = mysql\query("SELECT `username` FROM `users` WHERE `username` NOT IN (SELECT `user` FROM `subs` WHERE `subscription` = ? AND `expiry` > ? AND `app` = ?) AND `app` = ?", [$sub, time(), $secret ?? $_SESSION['app'], $secret ?? $_SESSION['app']]);
$rows = array();
while ($r = mysqli_fetch_assoc($query->result)) {
$rows[] = $r;
}
foreach ($rows as $row) {
$query = mysql\query("INSERT INTO `subs` (`user`, `subscription`, `expiry`, `app`) VALUES (?, ?, ?, ?)", [$row['username'], $sub, $expiry, $secret ?? $_SESSION['app']]);
}
}
$appendExpiry = $expiry - time();
$query = mysql\query("UPDATE `subs` SET `expiry` = `expiry`+? WHERE `subscription` = ? AND `expiry` > " . time() . " AND `app` = ?", [$appendExpiry, $sub, $secret ?? $_SESSION['app']]);
cache\purgePattern('KeyAuthSubs:' . ($secret ?? $_SESSION['app']));
} else {
$query = mysql\query("SELECT `username` FROM `users` WHERE `username` = ? AND `app` = ?", [$username, $secret ?? $_SESSION['app']]);
if ($query->num_rows < 1) {
return 'missing';
}
$query = mysql\query("SELECT `id` FROM `subs` WHERE `user` = ? AND `subscription` = ? AND `expiry` > " . time() . " AND `app` = ?", [$username, $sub, $secret ?? $_SESSION['app']]);
if ($query->num_rows > 0) {
$appendExpiry = $expiry - time();
$query = mysql\query("UPDATE `subs` SET `expiry` = `expiry`+? WHERE `user` = ? AND `subscription` = ? AND `app` = ?", [$appendExpiry, $username, $sub, $secret ?? $_SESSION['app']]);
} else {
$query = mysql\query("INSERT INTO `subs` (`user`, `subscription`, `expiry`, `app`) VALUES (?, ?, ?, ?)", [$username, $sub, $expiry, $secret ?? $_SESSION['app']]);
}
cache\purge('KeyAuthSubs:' . ($secret ?? $_SESSION['app']) . ':' . $username);
}
if ($query->affected_rows > 0) {
return 'success';
} else {
return 'failure';
}
}
function subtract($username, $sub, $seconds, $secret = null)
{
$username = etc\sanitize($username);
$sub = etc\sanitize($sub);
$seconds = etc\sanitize($seconds);
if ($seconds <= 0) {
return 'invalid_seconds';
}
if ($username == "all") {
$query = mysql\query("UPDATE `subs` SET `expiry` = `expiry`-? WHERE `subscription` = ? AND `app` = ?", [$seconds, $sub, $secret ?? $_SESSION['app']]);
} else {
$query = mysql\query("UPDATE `subs` SET `expiry` = `expiry`-? WHERE `user` = ? AND `subscription` = ? AND `app` = ?", [$seconds, $username, $sub, $secret ?? $_SESSION['app']]);
}
if ($query->affected_rows > 0) {
cache\purge('KeyAuthSubs:' . ($secret ?? $_SESSION['app']) . ':' . $username);
return 'success';
} else {
return 'failure';
}
}
function add($username, $sub, $expiry, $secret = null, $password = null)
{
$username = etc\sanitize($username);
$query = mysql\query("SELECT 1 FROM `users` WHERE `username` = ? AND `app` = ?", [$username, $secret ?? $_SESSION['app']]);
if ($query->num_rows > 0) {
return 'already_exist';
}
if (strtolower($username) === "all" || strtoupper($username) === "ALL"){
return 'username_not_allowed';
}
if (!empty($password))
$password = password_hash(etc\sanitize($password), PASSWORD_BCRYPT);
$sub = etc\sanitize($sub);
$expiry = etc\sanitize($expiry);
$query = mysql\query("SELECT 1 FROM `subscriptions` WHERE `name` = ? AND `app` = ?", [$sub, $secret ?? $_SESSION['app']]);
if ($query->num_rows < 1) {
return 'sub_missing';
} else if ($expiry < time()) {
return 'date_past';
}
$subQuery = mysql\query("SELECT * FROM `subs` WHERE `subscription` = ? AND `paused` = 1 AND `app` = ?", [$sub, $secret ?? $_SESSION['app']]);
if ($subQuery->num_rows > 0) {
return 'sub_paused';
}
$query = mysql\query("INSERT INTO `subs` (`user`, `subscription`, `expiry`, `app`) VALUES (?, ?, ?, ?)", [$username, $sub, $expiry, $secret ?? $_SESSION['app']]);
$query = mysql\query("INSERT INTO `users` (`username`, `password`, `hwid`, `app`,`owner`,`createdate`) VALUES (?, NULLIF(?, ''), NULL, ?, ?, ?);", [$username, $password, $secret ?? $_SESSION['app'], $_SESSION['username'] ?? 'SellerAPI', time()]);
if ($query->affected_rows > 0) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthUsernames:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthUsers:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthUser:' . ($secret ?? $_SESSION['app']) . ':' . $username);
}
if (token\ModifyUserToken($username, "User") === "failed") { return "failure"; }
return 'success';
} else {
return 'failure';
}
}
function deleteExpiredUsers($secret = null)
{
$query = mysql\query("SELECT `username` FROM `users` WHERE `app` = ?", [$secret ?? $_SESSION['app']]);
if ($query->num_rows < 1) {
return 'missing';
}
$rows = array();
while ($r = mysqli_fetch_assoc($query->result)) {
$rows[] = $r;
}
$success = 0;
foreach ($rows as $row) {
$query = mysql\query("SELECT 1 FROM `subs` WHERE `user` = ? AND `app` = ? AND `expiry` > ?", [$row['username'], $secret ?? $_SESSION['app'], time()]);
if ($query->num_rows < 1) {
$success = 1;
$query = mysql\query("DELETE FROM `users` WHERE `app` = ? AND `username` = ?", [$secret ?? $_SESSION['app'], $row['username']]);
cache\purge('KeyAuthUser:' . ($secret ?? $_SESSION['app']) . ':' . $row['username']);
}
}
if ($success) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthUsernames:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthUsers:' . ($secret ?? $_SESSION['app']));
}
$query = mysql\query("DELETE FROM `tokens` WHERE `app` = ? AND `assigned` = ? AND `type` = ?", [$secret ?? $_SESSION['app'], $row['username'], "user"]);
if ($query->affected_rows >= 0) { cache\purgePattern('KeyAuthUserTokens:' . ($secret ?? $_SESSION['app'])); } else { return "failure"; }
return 'success';
} else {
return 'failure';
}
}
function deleteAll($secret = null)
{
$query = mysql\query("DELETE FROM `users` WHERE `app` = ?", [$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
cache\purgePattern('KeyAuthUser:' . ($secret ?? $_SESSION['app']));
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthUsernames:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthUsers:' . ($secret ?? $_SESSION['app']));
}
$query = mysql\query("DELETE FROM `tokens` WHERE `app` = ? AND `type` = ?", [$secret ?? $_SESSION['app'], "user"]);
if ($query->affected_rows >= 0) { cache\purgePattern('KeyAuthUserTokens:' . ($secret ?? $_SESSION['app'])); } else { return "failure"; }
return 'success';
} else {
return 'failure';
}
}
function resetSingular($username, $secret = null)
{
$username = etc\sanitize($username);
if ($_SESSION['role'] == "Reseller") {
$query = mysql\query("SELECT 1 FROM `users` WHERE `app` = ? AND `username` = ? AND `owner` = ?", [$secret ?? $_SESSION['app'], $username, $_SESSION['username']]);
if ($query->num_rows < 1) {
return 'nope';
}
}
$query = mysql\query("UPDATE `users` SET `hwid` = NULL WHERE `app` = ? AND `username` = ?", [$secret ?? $_SESSION['app'], $username]);
if ($query->affected_rows > 0) {
cache\purge('KeyAuthUser:' . ($secret ?? $_SESSION['app']) . ':' . $username);
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthUsernames:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthUsers:' . ($secret ?? $_SESSION['app']));
}
$query = mysql\query("UPDATE `tokens` SET `hash` = NULL WHERE `app` = ? AND `type` = ?", [$secret ?? $_SESSION['app'], "user"]);
if ($query->affected_rows >= 0) {
cache\purgePattern('KeyAuthUserTokens:' . ($secret ?? $_SESSION['app']));
} else {
return "failure";
}
return 'success';
} else {
return 'failure';
}
}
function resetAll($secret = null)
{
$query = mysql\query("UPDATE `users` SET `hwid` = NULL WHERE `app` = ?", [$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
cache\purgePattern('KeyAuthUser:' . ($secret ?? $_SESSION['app']));
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthUsernames:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthUsers:' . ($secret ?? $_SESSION['app']));
}
$query = mysql\query("UPDATE `tokens` SET `hash` = NULL WHERE `app` = ? AND `type` = ?", [$secret ?? $_SESSION['app'], "user"]);
if ($query->affected_rows >= 0) {
cache\purgePattern('KeyAuthUserTokens:' . ($secret ?? $_SESSION['app']));
} else {
return "failure";
}
return 'success';
} else {
return 'failure';
}
}
function unbanAll($secret = null)
{
$query = mysql\query("UPDATE `users` SET `banned` = NULL WHERE `app` = ?", [$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
cache\purgePattern('KeyAuthUser:' . ($secret ?? $_SESSION['app']));
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthUsernames:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthUsers:' . ($secret ?? $_SESSION['app']));
}
$query = mysql\query("UPDATE `tokens` SET `banned` = 0, `reason` = NULL WHERE `app` = ?", [$secret ?? $_SESSION['app']]);
if ($query->affected_rows >= 0) { cache\purgePattern('KeyAuthUserTokens:' . ($secret ?? $_SESSION['app'])); } else { return "failure"; }
return 'success';
} else {
return 'failure';
}
}
function changeUsername($oldUsername, $newUsername, $secret = null)
{
$oldUsername = etc\sanitize($oldUsername);
$newUsername = etc\sanitize($newUsername);
$query = mysql\query("SELECT 1 FROM `users` WHERE `username` = ? AND `app` = ?", [$newUsername, $secret ?? $_SESSION['app']]);
if ($query->num_rows > 0) {
return 'already_used';
}
$query = mysql\query("UPDATE `users` SET `username` = ? WHERE `username` = ? AND `app` = ?", [$newUsername, $oldUsername, $secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
mysql\query("UPDATE `subs` SET `user` = ? WHERE `user` = ? AND `app` = ?", [$newUsername, $oldUsername, $secret ?? $_SESSION['app']]);
mysql\query("UPDATE `uservars` SET `user` = ? WHERE `user` = ? AND `app` = ?", [$newUsername, $oldUsername, $secret ?? $_SESSION['app']]);
mysql\query("UPDATE `chatmsgs` SET `author` = ? WHERE `author` = ? AND `app` = ?", [$newUsername, $oldUsername, $secret ?? $_SESSION['app']]);
mysql\query("UPDATE `keys` SET `usedby` = ? WHERE `usedby` = ? AND `app` = ?", [$newUsername, $oldUsername, $secret ?? $_SESSION['app']]);
mysql\query("UPDATE `tokens` SET `assigned` = ? WHERE `assigned` = ? AND `app` = ?", [$newUsername, $oldUsername, $secret ?? $_SESSION['app']]);
cache\purge('KeyAuthUser:' . ($secret ?? $_SESSION['app']) . ':' . $oldUsername);
cache\purge('KeyAuthSubs:' . ($secret ?? $_SESSION['app']) . ':' . $oldUsername);
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthUsernames:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthUsers:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function changePassword($username, $password, $secret = null)
{
$username = etc\sanitize($username);
$password = etc\sanitize($password);
$query = mysql\query("UPDATE `users` SET `password` = ? WHERE `username` = ? AND `app` = ?", [password_hash($password, PASSWORD_BCRYPT), $username, $secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
cache\purge('KeyAuthUser:' . ($secret ?? $_SESSION['app']) . ':' . $username);
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthUsers:' . ($secret ?? $_SESSION['app']));
cache\purge('KeyAuthUserData:' . $_SESSION['app'] . ':' . $username);
}
return 'success';
} else {
return 'failure';
}
}
function changeEmail($username, $email, $secret = null){
$username = etc\sanitize($username);
$email = etc\sanitize($email);
$query = mysql\query("UPDATE `users` SET `email` = SHA1(LOWER(?)) WHERE `username` = ? AND `app` = ?", [$email, $username, $secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0){
cache\purge('KeyAuthUser:' . ($secret ?? $_SESSION['app']) . ':' . $username);
if ($_SESSION['role'] == "seller" || !is_null($secret)){
cache\purge('KeyAuthUsers:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function disable2fa($username, $secret = null) {
$username = etc\sanitize($username);
$query = mysql\query("UPDATE `users` SET `googleAuthCode` = NULL, `2fa` = 0 WHERE `username` = ? AND `app` = ?", [$username, $secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
cache\purge('KeyAuthUser:' . ($secret ?? $_SESSION['app']) . ':' . $username);
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthUsers:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}

101
includes/misc/variable.php Normal file
View File

@@ -0,0 +1,101 @@
<?php
namespace misc\variable;
use misc\etc;
use misc\cache;
use misc\mysql;
function add($name, $data, $authed, $secret = null)
{
$name = etc\sanitize($name);
$data = etc\sanitize($data);
$authed = etc\sanitize($authed);
if(strlen($data) > 1000) {
return 'too_long';
}
$name_check = mysql\query("SELECT 1 FROM `vars` WHERE `varid` = ? AND `app` = ?",[$name, $secret ?? $_SESSION['app']]);
if ($name_check->num_rows > 0) {
return 'exists';
}
$query = mysql\query("INSERT INTO `vars`(`varid`, `msg`, `app`, `authed`) VALUES (?, ?, ?, ?)",[$name, $data,$secret ?? $_SESSION['app'], $authed]);
if ($query->affected_rows > 0) {
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthVars:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function deleteAll($secret = null)
{
$query = mysql\query("DELETE FROM `vars` WHERE `app` = ?",[$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
cache\purgePattern('KeyAuthVar:' . ($secret ?? $_SESSION['app']));
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthVars:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function deleteSingular($var, $secret = null)
{
$var = etc\sanitize($var);
$query = mysql\query("DELETE FROM `vars` WHERE `app` = ? AND `varid` = ?",[$secret ?? $_SESSION['app'], $var]);
if ($query->affected_rows > 0) {
cache\purge('KeyAuthVar:' . ($secret ?? $_SESSION['app']) . ':' . $var);
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthVars:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}
function edit($name, $data, $authed, $secret = null)
{
$name = etc\sanitize($name);
$data = etc\sanitize($data);
$authed = etc\sanitize($authed);
if(strlen($data) > 1000) {
return 'too_long';
}
$query = mysql\query("UPDATE `vars` SET `msg` = ?, `authed` = ? WHERE `varid` = ? AND `app` = ?",[$data, $authed, $name, $secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0) {
global $cfZoneIdCache;
global $cfApiKeyCache;
$appSecret = ($secret ?? $_SESSION['app']);
$varId = strtolower($name);
$url = "https://api.cloudflare.com/client/v4/zones/{$cfZoneIdCache}/purge_cache";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode(array("files" => ["https://keyauth.win/api/KeyAuthVar-{$appSecret}-{$varId}"])));
$headers = array(
"Authorization: Bearer {$cfApiKeyCache}",
"Content-Type: application/json",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_exec($curl);
cache\purge('KeyAuthVar:' . ($secret ?? $_SESSION['app']) . ':' . $name);
if ($_SESSION['role'] == "seller" || !is_null($secret)) {
cache\purge('KeyAuthVars:' . ($secret ?? $_SESSION['app']));
}
return 'success';
} else {
return 'failure';
}
}

51
includes/misc/webhook.php Normal file
View File

@@ -0,0 +1,51 @@
<?php
namespace misc\webhook;
use misc\etc;
use misc\cache;
use misc\mysql;
function add($webhookName, $baseLink, $userAgent, $authed, $secret = null)
{
$baseLink = etc\sanitize($baseLink);
$userAgent = etc\sanitize($userAgent);
$authed = intval($authed);
if (!filter_var($baseLink, FILTER_VALIDATE_URL))
return 'invalid_url';
if(str_contains($baseLink, "localhost") || str_contains($baseLink, "127.0.0.1"))
return 'no_local';
$webid = etc\sanitize($webhookName) ?? etc\generateRandomString();
if (is_null($userAgent))
$userAgent = "KeyAuth";
$query = mysql\query("INSERT INTO `webhooks` (`webid`, `baselink`, `useragent`, `app`, `authed`) VALUES (?, ?, ?, ?, ?)",[$webid, $baseLink, $userAgent, $secret ?? $_SESSION['app'], $authed]);
if ($query->affected_rows > 0) {
return 'success';
} else {
return 'failure';
}
}
function deleteSingular($webhook, $secret = null){
$webhook = etc\sanitize($webhook);
$query = mysql\query("DELETE FROM `webhooks` WHERE `app` = ? AND `webid` = ?",[$secret ?? $_SESSION['app'], $webhook]);
if ($query->affected_rows > 0) {
cache\purge('KeyAuthWebhook:' . ($secret ?? $_SESSION['app']) . ':' . $webhook);
return 'success';
} else {
return 'failure';
}
}
function deleteAll($secret = null){
$query = mysql\query("DELETE FROM `webhooks` WHERE `app` = ?", [$secret ?? $_SESSION['app']]);
if ($query->affected_rows > 0){
cache\purge('KeyAuthWebhook:' . ($secret ?? $_SESSION['app']));
return 'success';
} else {
return 'failure';
}
}

Some files were not shown because too many files have changed in this diff Show More