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

92
panel/dashboard/index.php Normal file
View File

@@ -0,0 +1,92 @@
<?php
require '../../includes/misc/autoload.phtml';
require '../../includes/dashboard/autoload.phtml';
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if (!isset($_SESSION['un'])) {
die("Not logged in");
}
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);
});
$query = misc\mysql\query("SELECT `name`, `download`, `webdownload`, `cooldown`, `customerPanelIcon` FROM `apps` WHERE `secret` = ?", [$_SESSION['panelapp']]);
$row = mysqli_fetch_array($query->result);
$name = $row["name"];
$download = $row["download"];
$webdownload = $row["webdownload"];
$appcooldown = $row["cooldown"];
$customerPanelIcon = $row["customerPanelIcon"];
?>
<!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/github-dark.min.css">
<script src="https://cdn.keyauth.cc/v3/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" href="<?= $customerPanelIcon ?>" />
<title><?= $name; ?> Panel</title>
<script>
if (window.history.replaceState) {
window.history.replaceState(null, null, window.location.href);
}
</script>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
}
#loader {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: black;
/* Black background color for the loader */
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 9999;
}
</style>
<link rel="stylesheet" href="https://unpkg.com/flowbite@1.8.1/dist/flowbite.min.css" />
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" />
<script src="https://cdn.tailwindcss.com/3.3.3"></script>
<script src="https://unpkg.com/flowbite@1.8.1/dist/flowbite.js"></script>
<link href="https://cdn.lineicons.com/4.0/lineicons.css" rel="stylesheet" />
</head>
<body>
<?php include 'layout/master.php' ?>
</body>
</html>

View File

@@ -0,0 +1,20 @@
<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]">
<div class="mb-4 border-b border-[#0f0f17]">
<?php require '../dashboard/layout/profile.php';?>
</div>
</div>
</div>
</div>
</aside>

View File

@@ -0,0 +1,41 @@
<?php
$page = isset($_GET['page']) ? $_GET['page'] : "customer-actions";
require '../../app/layout/topbar.php';
?>
<div class="flex overflow-hidden pt-16 bg-[#09090d]">
<?php
include '/var/www/vhosts/tbs-server.de/lizenz.tbs-server.de/panel/dashboard/layout/customeraside.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>

View File

@@ -0,0 +1,48 @@
<script src="https://cdn.keyauth.cc/dashboard/unixtolocal.js"></script>
<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=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 flex-col items-center pb-4">
<?php
$query = misc\mysql\query("SELECT * FROM `subs` WHERE `app` = ? AND `user` = ? AND `expiry` > ? LIMIT 1", [$_SESSION['panelapp'], $_SESSION['un'], time()]);
$row = mysqli_fetch_array($query->result);
$subName = $row["subscription"];
$subExpiry = $row["expiry"];
?>
<h5 class="mb-1 text-xl font-medium text-blue-700 stars"><?= $_SESSION["un"]; ?></h5>
<?php
$cssClasses = "text-transparent bg-clip-text bg-gradient-to-r to-blue-600 from-sky-400 text-xs font-black mr-2 px-1.5 py-0.5 rounded border mb-2 mt-2";
$cssClasses .= " border-white-400";
// Finally, output the HTML with the calculated classes
echo "<p class=\"$cssClasses\">" . $subName . "</p>";
?>
<label class="text-sm text-gray-400"><b>Expires:</b>
<script>
document.write(convertTimestamp(<?= $subExpiry; ?>));
</script>
</label>
</div>
</div>

View File

@@ -0,0 +1,214 @@
<?php
if (isset($_POST['resethwid'])) {
$today = time();
$cooldown = $today + $appcooldown;
misc\mysql\query("UPDATE `users` SET `hwid` = NULL, `cooldown` = ? WHERE `app` = ? AND `username` = ?", [$cooldown, $_SESSION['panelapp'], $_SESSION['un']]);
dashboard\primary\success("Reset HWID!");
misc\cache\purge('KeyAuthUser:' . $_SESSION['panelapp'] . ':' . $_SESSION['un']);
echo "<meta http-equiv='Refresh' Content='2;'>";
}
if (isset($_POST['saveUser'])) {
if (!empty($_POST['username'])) {
$resp = misc\user\changeUsername($_SESSION['un'], $_POST['username'], $_SESSION['panelapp']);
match($resp){
'already_used' => dashboard\primary\error("Username already used!"),
'failure' => dashboard\primary\error("Failed to change username!"),
'success' => dashboard\primary\success("Successfully changed username!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (!empty($_POST['password'])) {
$resp = misc\user\changePassword($_SESSION['un'], $_POST['password'], $_SESSION['panelapp']);
match($resp){
'failure' => dashboard\primary\error("Failed to change password!"),
'success' => dashboard\primary\success("Successfully changed password!"),
default => dashboard\primary\error("Unhandled Error! Contact us if you need help")
};
}
if (empty($_POST['username']) && empty($_POST['password'])) {
dashboard\primary\error("You must enter new username or password!");
}
}
?>
<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">
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">Customer Actions</h1>
<p class="text-xs text-gray-500">View and Modify your account on <?= ucwords($page); ?></p>
<div class="pt-5">
<form method="POST">
<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-border-gray-300 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on">
<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">New
Username:</label>
</div>
<div class="relative">
<input type="password" id="password" name="password"
class="block px-2.5 pb-2.5 pt-4 w-full text-sm text-white bg-transparent rounded-lg border-1 border-border-gray-300 appearance-none focus:ring-0 peer"
placeholder=" " autocomplete="on">
<label for="password"
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>
<button name="saveUser"
class="text-white border-2 hover:bg-white 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 mt-5">
<span class="inline-flex">
Update Changes
<svg class="w-3.5 h-3.5 ml-2 mt-1" 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"></path>
</svg></span>
</button>
</form>
</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">
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">HWID Reset</h1>
<p class="text-xs text-gray-500">Reset your hwid</p>
<div class="pt-5">
<?php
$query = misc\mysql\query("SELECT * FROM `users` WHERE `app` = ? AND `username` = ?", [$_SESSION['panelapp'], $_SESSION['un']]);
$row = mysqli_fetch_array($query->result);
$today = time();
$cooldown = $row["cooldown"];
if (is_null($cooldown)){
echo '<form method="post"><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="resethwid">
<i class="lni lni-reload mr-2 mt-1"></i>Reset HWID
</button></form>';
} else {
if ($today > $cooldown) {
echo '<form method="post"><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="resethwid">
<i class="lni lni-reload mr-2 mt-1"></i>Reset HWID
</button></form>';
} else {
echo '<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-reload mr-2 mt-1"></i>HWID cooldown until <script>document.write(convertTimestamp(' . $cooldown . '));</script>
</button>';
}
}
?>
</div>
</div>
<?php
if (!is_null($webdownload)) {
$query = misc\mysql\query("SELECT `password` FROM `users` WHERE `username` = ? AND `app` = ?", [$_SESSION['un'], $_SESSION['panelapp']]);
$row = mysqli_fetch_array($query->result);
$token = md5(substr($row["password"], -5));
?>
<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">
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">Web Loader</h1>
<p class="text-xs text-gray-500">Control your application from the website</p>
<div class="pt-5" id="buttons">
<?php
$query = misc\mysql\query("SELECT * FROM `buttons` WHERE `app` = ?", [$_SESSION['panelapp']]);
$rows = array();
while ($r = mysqli_fetch_assoc($query->result)) {
$rows[] = $r;
}
foreach ($rows as $row) {
?>
<button
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 mb-2 transition duration-200"
onclick="doButton(this.value)"
value="<?= $row['value']; ?>"><?= $row['text']; ?></button>
<?php } ?>
</div>
<a href="<?= $webdownload; ?>" class="text-blue-700">
<button onclick="handshake()"
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>Download
</button>
</a>
</div>
<?php } ?>
<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">
<h1 class="text-xl font-semibold text-white-900 sm:text-2xl">Stay Updated!
</h1>
<p class="text-xs text-gray-500">If there is a link visible, there is a new version
of the app
<?= $name; ?></p>
<div class="pt-5">
<?php
if (!is_null($download)){ ?>
<a href="<?= $download; ?>" class="text-blue-700" target="appdownload">
<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-download mr-2 mt-1"></i>Download new version of
<?= $name; ?>
</button>
</a>
<?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">
<i class="lni lni-checkmark mr-2 mt-1"></i>You're on the current version!
</button>
<?php } ?>
</div>
</div>
<script>
var going = 1;
function handshake() {
if (navigator.userAgent.includes("Chrome/98")) {
going = 0;
alert(
"Currently Chrome 98 does not work with the web loader. Please use an older chrome version such as Chrome 97 or use another browser such as Firefox"
);
}
setTimeout(function() {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET",
"http://localhost:1337/handshake?user=<?= $_SESSION['un']; ?>&token=<?= $token; ?>"
);
xmlHttp.onload = function() {
going = 0;
switch (xmlHttp.status) {
case 420:
console.log("returned handshake :)");
$("#handshake").fadeOut(100);
$("#buttons").fadeIn(1900);
break;
default:
alert(xmlHttp.statusText);
break;
}
};
xmlHttp.send();
if (going == 1) {
handshake();
}
}, 3000);
}
function doButton(value) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "http://localhost:1337/" + value);
xmlHttp.send();
}
</script>
<script src="https://cdn.keyauth.cc/dashboard/unixtolocal.js"></script>

View File

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

View File

@@ -0,0 +1,12 @@
<?php
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
unset($_SESSION['un']);
unset($_SESSION['panelapp']);
$oldUrl = $_SESSION['oldUrlPanel'];
if(isset($oldUrl))
echo "<meta http-equiv='Refresh' Content='0; url=$oldUrl'>";
else
die('<br><p style="font-size:25px">Logged Out!</p>');