diff --git a/README.md b/README.md index 6a8df11..e1b30ee 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,5 @@ # KeyAuth Source Code -> Please star :star2: - -> [!WARNING] -> AS OF JANUARY 29th, 2024 - THIS REPOSITORY IS NO LONGER BEING UPDATED! - -[KeyAuth](https://keyauth.win) is an open source authentication system with [cloud-hosted subscriptions](https://keyauth.win/app/?page=upgrade) available as well. +KeyAuth is an open source authentication system with cloud-hosted subscriptions available aswell https://keyauth.cc
*You're not allowed to sell KeyAuth. source made avaliable only for you to use* @@ -13,7 +9,7 @@ To submit a suggestion or a bug, please go to https://keyauth.cc/app/?page=forms [![Telegram Chat](https://img.shields.io/endpoint?color=neon&style=flat-square&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fkeyauth)](https://t.me/KeyAuth) [![Twitter](https://img.shields.io/twitter/follow/KeyAuth?cacheSeconds=3600)](https://twitter.com/KeyAuth) -[![Screenshot](https://cdn.keyauth.cc/v3/imgs/Screenshot%20from%202025-07-04%2012-07-30.png)](https://keyauth.cc) +[![Screenshot](https://i.imgur.com/rige1nM.png)](https://keyauth.cc) ## Bugs ## @@ -46,12 +42,12 @@ Thank you for your compliance, we work hard on the development of KeyAuth and do - Redis - PHP -No setup support given to non-enterprise users. However for $79.99 you can purchase access to the source code of paid features (developer and seller plan features), setup support 1-on-1 with the owner of KeyAuth, and a tutorial video on how to host KeyAuth for 100% free forever (good preformance & secure also) +No setup support given to non-enterprise users. However for $79.99 you can purchase access to the source code of paid features (developer and seller plan features), setup support one-on-one with the Founder of KeyAuth, and a tutorial video on how to host KeyAuth for 100% free forever (good preformance & secure also) -Purchase enterprise today --> https://keyauth.win/app/?page=upgrade +Purchase enterprise today --> https://shop.keyauth.cc/product/6361c20e415e9 -## Updates ## +Some pages such as the API endpoint that upgrades users after they purchase a subscription have been omitted to prevent violation of the license (No Commercial Access Allowed) -https://keyauth.canny.io/changelog +## Updates ## -Looking for a Discord bot made by the KeyAuth & RestoreCord founder that you can use to backup your Discord members, server settings, and messages? Go to https://vaultcord.com +https://headwayapp.co/keyauth-changelog/ diff --git a/api/1.2/index.php b/api/1.2/index.php index 7c701e5..583c05c 100644 --- a/api/1.2/index.php +++ b/api/1.2/index.php @@ -56,7 +56,6 @@ $sessionexpiry = $row['session']; $forceEncryption = $row['forceEncryption']; $forceHwid = $row['forceHwid']; -$tokensystem = $row['tokensystem']; $banned = $row['banned']; $owner = $row['owner']; @@ -78,7 +77,6 @@ $userbanned = $row['userbanned']; $sessionunauthed = $row['sessionunauthed']; $hashcheckfail = $row['hashcheckfail']; -$invalid_token = $row['tokeninvalid']; // why using null coalescing operators? because if I add a field and it's not in redis cache, it'll be NULL $loggedInMsg = $row['loggedInMsg'] ?? "Logged in!"; @@ -176,91 +174,6 @@ die($response); } - if ($tokensystem) { - - list($token, $thash) = [misc\etc\sanitize($_POST["token"] ?? $_GET["token"]) , misc\etc\sanitize($_POST["thash"] ?? $_GET["thash"])]; - - if (!isset($token)) { - - $response = json_encode(array( - "success" => false, - "message" => "Token Must Be Provided" - )); - - $sig = hash_hmac('sha256', $response, $secret); - header("signature: {$sig}"); - - die($response); - } - - if (!isset($thash)) { - $response = json_encode(array( - "success" => false, - "message" => "Hash Must Be Provided" - )); - - $sig = hash_hmac('sha256', $response, $secret); - header("signature: {$sig}"); - - die($response); - } - - $verification = misc\token\checktoken("check_data", $token, $secret, null, $thash); - - switch ($verification) { - case str_contains($verification, 'token_blacklisted'): - $reason = str_ireplace("token_blacklisted, ", "", $verification); - $response = json_encode(array( - "success" => false, - "message" => "The Token Has Been Blacklisted For The Following Reason: " . $reason . " Contact Application Developer If This Is A Mistake" - )); - - $sig = hash_hmac('sha256', $response, $secret); - header("signature: {$sig}"); - - die($response); - case 'invalid_token': - - $response = json_encode(array( - "success" => false, - "message" => $invalid_token - )); - - $sig = hash_hmac('sha256', $response, $secret); - header("signature: {$sig}"); - - die($response); - - case 'hash_mismatch': - - $response = json_encode(array( - "success" => false, - "message" => "Token File Hashes Must Be The Same" - )); - - $sig = hash_hmac('sha256', $response, $secret); - header("signature: {$sig}"); - - die($response); - - case 'success': - break; - - default: - - $response = json_encode(array( - "success" => false, - "message" => "Unknown Error Occured" - )); - - $sig = hash_hmac('sha256', $response, $secret); - header("signature: {$sig}"); - - die($response); - - } - } - $ver = misc\etc\sanitize($_POST['ver'] ?? $_GET['ver']); if (!empty($ver)) { if ($ver != $currentver) { @@ -1746,202 +1659,9 @@ header("signature: {$sig}"); die($response); - case '2faenable': - - list($sessionid, $code) = [misc\etc\sanitize($_POST['sessionid'] ?? $_GET['sessionid']), misc\etc\sanitize($_POST["code"] ?? $_GET["code"])]; - $session = api\shared\primary\getSession($sessionid, $secret); - $enckey = $session["enckey"]; - - if (!$session["validated"]) { - $response = json_encode(array( - "success" => false, - "message" => "$sessionunauthed" - )); - $sig = !is_null($enckey) ? hash_hmac('sha256', $response, $enckey) : 'No encryption key supplied'; - header("signature: {$sig}"); - - die($response); - } - - $row = misc\cache\fetch('KeyAuthUser:' . $secret . ':' . $session["credential"], "SELECT * FROM `users` WHERE `username` = ? AND `app` = ?", [$session["credential"], $secret], 0); - - if ($row["2fa"]) { - - $response = json_encode(array( - "success" => false, - "message" => "2fa is already enabled on this account" - )); - - $sig = !is_null($enckey) ? hash_hmac('sha256', $response, $enckey) : 'No encryption key supplied'; - header("signature: {$sig}"); - - die($response); - - } - - include_once '../../auth/GoogleAuthenticator.php'; - - $_2fa = new GoogleAuthenticator(); - - if (empty($code) || is_null($code)) { - - $secret_code = $_2fa->createSecret(); - - misc\cache\insert('KeyAuthTwoFactorAuthentication:' . $session["credential"], $secret_code, 300); - - $qrcode = str_replace(urlencode("https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl="), " ", $_2fa->getQRCodeGoogleUrl($session["credential"], $secret_code, 'KeyAuth')); - - $response = json_encode(array( - "success" => true, - "2fa" => array( - "secret_code" => $secret_code, - "QRCode" => "otpauth://totp/" . $session["credential"] . "?secret=" . $secret_code . "&issuer=KeyAuth" - ) - )); - - $sig = !is_null($enckey) ? hash_hmac('sha256', $response, $enckey) : 'No encryption key supplied'; - header("signature: {$sig}"); - - die($response); - - } - else { - - $secret_code = misc\cache\select('KeyAuthTwoFactorAuthentication:' . $session["credential"]); - - if (!$secret_code) { - - $response = json_encode(array( - "success" => true, - "message" => "2fa session has expired" - )); - - $sig = !is_null($enckey) ? hash_hmac('sha256', $response, $enckey) : 'No encryption key supplied'; - header("signature: {$sig}"); - - die($response); - - } - - if ($_2fa->verifyCode($secret_code, $code, 2)) { - - misc\mysql\query("UPDATE `users` SET `2fa` = ?, `googleAuthCode` = ? WHERE `app` = ? AND `username` = ?", [1, $secret_code, $secret, $session["credential"]]); - misc\cache\purge('KeyAuthUser:' . $secret . ':' . $session["credential"]); - misc\cache\purge('KeyAuthTwoFactorAuthentication: ' . $session["credential"]); - - $response = json_encode(array( - "success" => true, - "message" => "2fa successfully activated" - )); - - $sig = !is_null($enckey) ? hash_hmac('sha256', $response, $enckey) : 'No encryption key supplied'; - header("signature: {$sig}"); - - die($response); - - } - else { - - $response = json_encode(array( - "success" => true, - "message" => "Invalid code please try again" - )); - - $sig = !is_null($enckey) ? hash_hmac('sha256', $response, $enckey) : 'No encryption key supplied'; - header("signature: {$sig}"); - - die($response); - - } - - } - case '2fadisable': - - list($sessionid, $code) = [misc\etc\sanitize($_POST['sessionid'] ?? $_GET['sessionid']), misc\etc\sanitize($_POST["code"] ?? $_GET["code"])]; - - if (empty($code) || is_null($code)) { - - $response = json_encode(array( - "success" => false, - "message" => "Please provide the 2fa code to disable 2fa" - )); - - $sig = !is_null($enckey) ? hash_hmac('sha256', $response, $enckey) : 'No encryption key supplied'; - header("signature: {$sig}"); - - die($response); - - } - - $session = api\shared\primary\getSession($sessionid, $secret); - $enckey = $session["enckey"]; - - if (!$session["validated"]) { - $response = json_encode(array( - "success" => false, - "message" => "$sessionunauthed" - )); - $sig = !is_null($enckey) ? hash_hmac('sha256', $response, $enckey) : 'No encryption key supplied'; - header("signature: {$sig}"); - - die($response); - } - - $row = misc\cache\fetch('KeyAuthUser:' . $secret . ':' . $session["credential"], "SELECT * FROM `users` WHERE `username` = ? AND `app` = ?", [$session["credential"], $secret], 0); - - if (!$row["2fa"]) { - - $response = json_encode(array( - "success" => false, - "message" => "2fa is not enabled on this account" - )); - - $sig = !is_null($enckey) ? hash_hmac('sha256', $response, $enckey) : 'No encryption key supplied'; - header("signature: {$sig}"); - - die($response); - - } - - include_once '../../auth/GoogleAuthenticator.php'; - - $_2fa = new GoogleAuthenticator(); - - $secret_code = $row["googleAuthCode"]; - - if ($_2fa->verifyCode($secret_code, $code, 2)) { - - misc\mysql\query("UPDATE `users` SET `2fa` = ?, `googleAuthCode` = ? WHERE `app` = ? AND `username` = ?", [0, NULL, $secret, $row["username"]]); - misc\cache\purge('KeyAuthUser:' . $secret . ':' . $session["credential"]); - - $response = json_encode(array( - "success" => true, - "message" => "2fa successfully activated" - )); - - $sig = !is_null($enckey) ? hash_hmac('sha256', $response, $enckey) : 'No encryption key supplied'; - header("signature: {$sig}"); - - die($response); - - } - else { - - $response = json_encode(array( - "success" => true, - "message" => "Invalid code please try again" - )); - - $sig = !is_null($enckey) ? hash_hmac('sha256', $response, $enckey) : 'No encryption key supplied'; - header("signature: {$sig}"); - - die($response); - - } - - default: - die(json_encode(array( - "success" => false, - "message" => "The value inputted for type paramater was not found" - ))); - } + default: + die(json_encode(array( + "success" => false, + "message" => "The value inputted for type paramater was not found" + ))); +} diff --git a/app/black-fetch.php b/app/black-fetch.php index 16bc522..96e3ad7 100644 --- a/app/black-fetch.php +++ b/app/black-fetch.php @@ -54,33 +54,11 @@ $data = array(); - while ($row = mysqli_fetch_assoc($query->result)) { + while ($row = mysqli_fetch_assoc($query->result)) { $data[] = array( - "data" => '' . ($row["hwid"] ?? $row["ip"]) . '', + "data" => '' . ($row["hwid"] ?? $row["ip"]) . '', "type" => $row["type"], - "actions" => - '
- -
- -
- - - - - -
', + "actions" => '
', ); } diff --git a/app/download-types.php b/app/download-types.php deleted file mode 100644 index fdb3a75..0000000 --- a/app/download-types.php +++ /dev/null @@ -1,169 +0,0 @@ - array(), - "subscription" => 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"], - "banned" => $row["banned"], - "ip" => $row["ip"] - ); - - 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" => "default", - "expiry" => $row["expiry"] - ); - - array_push($jsondata->subscription, $subjson); - } - - $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': - $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'], - "level" => $row['level'], - "expiry" => $row['expires'] / 86400 - ); - } - - // Convert the array to a JSON string - $jsonData = json_encode($keysArray); - - 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'; -} diff --git a/app/index.php b/app/index.php index 017960d..3edc7bc 100644 --- a/app/index.php +++ b/app/index.php @@ -68,88 +68,87 @@ - - - - - - - - - - - - - + + Keyauth - Open Source Auth + + + + + + + + + + + - - - - - - - - - + - -
-
-
- -
-
- - Loading taking a while? Please - feel free to return. - -
- - - -
-
- - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/layout/_footer.php b/app/layout/_footer.php new file mode 100644 index 0000000..730e5ba --- /dev/null +++ b/app/layout/_footer.php @@ -0,0 +1,16 @@ + + + \ No newline at end of file diff --git a/app/layout/_loader.php b/app/layout/_loader.php new file mode 100644 index 0000000..83259b0 --- /dev/null +++ b/app/layout/_loader.php @@ -0,0 +1,9 @@ + +
+ Logo +
+ + Loading... +
+
+ \ No newline at end of file diff --git a/app/layout/_scrolltop.php b/app/layout/_scrolltop.php new file mode 100644 index 0000000..0561bad --- /dev/null +++ b/app/layout/_scrolltop.php @@ -0,0 +1,14 @@ + +
+ + + + + + + + +
+ \ No newline at end of file diff --git a/app/layout/aside.php b/app/layout/aside.php deleted file mode 100644 index f78d9d5..0000000 --- a/app/layout/aside.php +++ /dev/null @@ -1,190 +0,0 @@ - - - - -
diff --git a/app/layout/aside/_base.php b/app/layout/aside/_base.php new file mode 100644 index 0000000..a902f24 --- /dev/null +++ b/app/layout/aside/_base.php @@ -0,0 +1,53 @@ + + + +
+ + + + + +
+ + + + + +
+ + +
+ \ No newline at end of file diff --git a/app/layout/aside/_menu.php b/app/layout/aside/_menu.php new file mode 100644 index 0000000..eb86f8b --- /dev/null +++ b/app/layout/aside/_menu.php @@ -0,0 +1,398 @@ + + + + + + + + + + + + +
+ + + + +
+ + + + \ No newline at end of file diff --git a/app/layout/aside/resellermenu.php b/app/layout/aside/resellermenu.php new file mode 100644 index 0000000..314cc65 --- /dev/null +++ b/app/layout/aside/resellermenu.php @@ -0,0 +1,72 @@ + + + + + + + + + + + + +
+ + + + +
+ + + + \ No newline at end of file diff --git a/app/layout/breadcrumb.php b/app/layout/breadcrumb.php deleted file mode 100644 index 924b92f..0000000 --- a/app/layout/breadcrumb.php +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/app/layout/footer.php b/app/layout/footer.php deleted file mode 100644 index 0d0603f..0000000 --- a/app/layout/footer.php +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/app/layout/header/_base.php b/app/layout/header/_base.php new file mode 100644 index 0000000..f4e40d7 --- /dev/null +++ b/app/layout/header/_base.php @@ -0,0 +1,52 @@ + +
+ +
+ +
+
+ + + + + + + + +
+
+ + +
+ + Logo + +
+ + +
+ +
+ + + +
+ + +
+ + + +
+ +
+ +
+ +
+ \ No newline at end of file diff --git a/app/layout/header/_menu.php b/app/layout/header/_menu.php new file mode 100644 index 0000000..35ed596 --- /dev/null +++ b/app/layout/header/_menu.php @@ -0,0 +1,41 @@ + + +
+ + + +
+ \ No newline at end of file diff --git a/app/layout/master.php b/app/layout/master.php index 7abcf05..8544bb2 100644 --- a/app/layout/master.php +++ b/app/layout/master.php @@ -1,39 +1,45 @@ - - -
- - - - - - -
-
- - -
- - + + + +
+ +
+ + + + +
+ + + + +
+ + + + +
+ + + +
+ +
+ + + + +
+
+
+ + + \ No newline at end of file diff --git a/app/layout/page-title/_default.php b/app/layout/page-title/_default.php new file mode 100644 index 0000000..3a32f72 --- /dev/null +++ b/app/layout/page-title/_default.php @@ -0,0 +1,13 @@ + + +
+ +

+ + +

+ +
+ \ No newline at end of file diff --git a/app/layout/profile.php b/app/layout/profile.php deleted file mode 100644 index c03531d..0000000 --- a/app/layout/profile.php +++ /dev/null @@ -1,92 +0,0 @@ -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; - } -} - -?> - -
-
- - -
- -
-
-
- " alt="profile image" /> - -
- -
- - - " . strtoupper($role) . " PLAN

"; - ?> - - '', - 'developer' => '', - 'seller' => '', - 'Reseller' => '', - 'Manager' => '', - 'default' => '' - }; - echo $display; - - if ($role === 'developer' || $role === 'seller') { - echo ''; - } - ?> -
-
-
diff --git a/app/layout/toolbars/_toolbar-1.php b/app/layout/toolbars/_toolbar-1.php new file mode 100644 index 0000000..651d46b --- /dev/null +++ b/app/layout/toolbars/_toolbar-1.php @@ -0,0 +1,11 @@ + +
+ +
+ + + + +
+ +
\ No newline at end of file diff --git a/app/layout/topbar.php b/app/layout/topbar.php deleted file mode 100644 index 978bce8..0000000 --- a/app/layout/topbar.php +++ /dev/null @@ -1,133 +0,0 @@ - - - diff --git a/app/layout/topbar/_base.php b/app/layout/topbar/_base.php new file mode 100644 index 0000000..c0ef677 --- /dev/null +++ b/app/layout/topbar/_base.php @@ -0,0 +1,49 @@ + +
+ +
+

+
+ +
+ + +
+ + + + + + + + +
+
+ + + + + + + + +
+
+ +
+ \ No newline at end of file diff --git a/app/layout/topbar/partials/_user-menu.php b/app/layout/topbar/partials/_user-menu.php new file mode 100644 index 0000000..e0efd4f --- /dev/null +++ b/app/layout/topbar/partials/_user-menu.php @@ -0,0 +1,43 @@ + + + \ No newline at end of file diff --git a/app/license-download.php b/app/license-download.php new file mode 100644 index 0000000..762dab6 --- /dev/null +++ b/app/license-download.php @@ -0,0 +1,106 @@ + array(), + "subscription" => 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"], + "banned" => $row["banned"], + "ip" => $row["ip"] + ); + + 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" => "default", + "expiry" => $row["expiry"] + ); + + array_push($jsondata->subscription, $subjson); + } + + $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': + $query = misc\mysql\query("SELECT * FROM `keys` WHERE `app` = ?",[$_SESSION['app']]); + + + + while ($row = mysqli_fetch_array($query->result)) + + + + $stringData .= "" . $row['key'] . "\n"; + + + + $stringData = preg_replace( + + '~[\r\n]+~', + + "\r\n", + + trim($stringData) + + ); + + + + header('Content-Description: File Transfer'); + header('Content-Type: application/octet-stream'); + header('Content-Disposition: attachment; filename="KeyAuthKeys.txt"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Length: ' . strlen($stringData)); + + + die($stringData); + + default: + echo 'Invalid Type or Type does not Exist'; +} \ No newline at end of file diff --git a/app/license-fetch.php b/app/license-fetch.php index 89793b6..f45aa19 100644 --- a/app/license-fetch.php +++ b/app/license-fetch.php @@ -11,7 +11,8 @@ error_log(print_r($_POST, true)); error_log("\n--------------------------------------------------------------"); http_response_code(500); - die("Error: " . $exception->getMessage()); + $errorMsg = str_replace($databaseUsername, "REDACTED", $exception->getMessage()); + die("Error: " . $errorMsg); }); if (session_status() === PHP_SESSION_NONE) { @@ -23,7 +24,6 @@ } if (!isset($_SESSION['app'])) { - dashboard\primary\error("Application not selected"); die("Application not selected."); } @@ -62,9 +62,9 @@ ## If only one or two keys exists then we will use custom margin to fix the bugging menu $banBtns = ""; if ($row['status'] == "Banned") { - $banBtns = ''; + $banBtns = ''; } else { - $banBtns = ''; + $banBtns = 'Ban'; } $MarginManager = ""; @@ -76,47 +76,15 @@ $data[] = array( "key" => $row['key'], - "gendate" => '
', + "gendate" => '
', "genby" => $row['genby'], "expires" => timeconversion($row["expires"]), "note" => $row['note'] ?? 'N/A', - "usedon" => (!is_null($row["usedon"])) ? '
' : 'N/A', + "usedon" => (!is_null($row["usedon"])) ? '
' : 'N/A', "usedby" => ($row["usedby"] == $row['key']) ? 'Same as key' : $row["usedby"] ?? 'N/A', - "status" => '' . $row['status'] . '', - - "actions" => ' -
- -
- -
    -
  • - -
  • -
  • - ' . $banBtns . ' -
  • -
  • - -
  • -
-
- - -
- ', - ); + "status" => '', + "actions" => '
', + ); } ## Response diff --git a/app/log-fetch.php b/app/log-fetch.php index f89fc05..2ff6e9e 100644 --- a/app/log-fetch.php +++ b/app/log-fetch.php @@ -8,7 +8,8 @@ error_log(print_r($_POST, true)); error_log("\n--------------------------------------------------------------"); http_response_code(500); - die("Error: " . $exception->getMessage()); + $errorMsg = str_replace($databaseUsername, "REDACTED", $exception->getMessage()); + die("Error: " . $errorMsg); }); if (session_status() === PHP_SESSION_NONE) { @@ -20,7 +21,6 @@ } if (!isset($_SESSION['app'])) { - dashboard\primary\error("Application not selected"); die("Application not selected."); } @@ -56,7 +56,7 @@ while ($row = mysqli_fetch_assoc($query->result)) { $data[] = array( - "logdate" => '
', + "logdate" => '
', "logdata" => $row['logdata'], "credential" => $row['credential'] ?? 'N/A', "pcuser" => $row['pcuser'] ?? 'N/A', diff --git a/app/pages/account-logs.php b/app/pages/account-logs.php index 2f9dde5..7f11168 100644 --- a/app/pages/account-logs.php +++ b/app/pages/account-logs.php @@ -1,53 +1,45 @@ - -
-
-
- -

Account Logs

-

View the event history of your account.

-
-
- -
- - - - - - - - - - result)) - { - $rows[] = $r; - } + +
+ - foreach ($rows as $row) - { - ?> -
- +
DateIPUser-Agent
- -
+ + + + + + + - - - - - -
DateIP AddressUser Agent
+ + result)) + { + $rows[] = $r; + } + + foreach ($rows as $row) + { + ?> + + + + + + + + + + + + + +
+ \ No newline at end of file diff --git a/app/pages/account-settings.php b/app/pages/account-settings.php index 3c0f7ec..0f88f0d 100644 --- a/app/pages/account-settings.php +++ b/app/pages/account-settings.php @@ -1,8 +1,7 @@ that's the only thing you need on this page."); } $twofactor = $row['twofactor']; @@ -20,20 +19,29 @@ } $google_QR_Code = $gauth->getQRCodeGoogleUrl($_SESSION['username'], $code_2factor, 'KeyAuth'); +?> -$query = misc\mysql\query("SELECT * FROM `accounts` WHERE `username` = ?", [$_SESSION['username']]); + +
+ + + + + num_rows > 0) -{ - while ($row = mysqli_fetch_array($query->result)) + $query = misc\mysql\query("SELECT * FROM `accounts` WHERE `username` = ?", [$_SESSION['username']]); + + if ($query->num_rows > 0) { - $acclogs = $row['acclogs']; - $expiry = $row["expires"]; - $emailVerify = $row["emailVerify"]; + while ($row = mysqli_fetch_array($query->result)) + { + $acclogs = $row['acclogs']; + $expiry = $row["expires"]; + $emailVerify = $row["emailVerify"]; + } } -} -if (isset($_POST['updatesettings'])) + if (isset($_POST['updatesettings'])) { $pfp = misc\etc\sanitize($_POST['pfp']); $acclogs = misc\etc\sanitize($_POST['acclogs']); @@ -67,7 +75,12 @@ if (isset($_POST['submit_code'])) { - $code = misc\etc\sanitize($_POST['scan_code1'] . ($_POST['scan_code2']) . ($_POST['scan_code3']) . ($_POST['scan_code4']) . ($_POST['scan_code5']) . ($_POST['scan_code6'])); + if (empty($_POST['scan_code'])) + { + dashboard\primary\error("You forgot to enter 2FA code!"); + } + + $code = misc\etc\sanitize($_POST['scan_code']); $query = misc\mysql\query("SELECT `googleAuthCode` from `accounts` WHERE `username` = ?", [$_SESSION['username']]); @@ -102,7 +115,12 @@ if (isset($_POST['submit_code_disable'])) { - $code = misc\etc\sanitize($_POST['scan_code1'] . ($_POST['scan_code2']) . ($_POST['scan_code2']) . ($_POST['scan_code3']) . ($_POST['scan_code4']) . ($_POST['scan_code5'])); + if (empty($_POST['scan_code'])) + { + dashboard\primary\error("You forgot to enter 2FA code!"); + } + + $code = misc\etc\sanitize($_POST['scan_code']); $query = misc\mysql\query("SELECT `googleAuthCode` from `accounts` WHERE `username` = ?", [$_SESSION['username']]); @@ -152,343 +170,329 @@ dashboard\primary\error("Failed to delete security key!"); } } + ?> + +
+
+
+
+
+
+ +
+ +
+
-?> +
+ +
+ +
+ +
+
-
-
-
- -

Account Settings

-

Manage your account.

-
-
-
-
- -
-
- -
+
+ +
-
- -
-
- - -
+
- -
- " - readonly> - +
+ +
+
Change password here + https://' . ($_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME']) . '/forgot/'; ?> +
+
- - -
- Free Forever " - autocomplete="on" readonly> - - - - + +
+ +
+ +
+ +
- - -
- - +
+ +
+ +
+
Change email here + https://' . ($_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME']) . '/changeEmail/'; ?> +
+
- - - - Enable 2FA'; - } else { - echo 'Disable 2FA'; - } - ?> +
- - - - Change Password - - - Change Email - - - Change Username - - - Delete Account - - - - - - -