forked from TDR-1000/KeyAuth-Source-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
146 lines (124 loc) · 5.16 KB
/
Copy pathindex.php
File metadata and controls
146 lines (124 loc) · 5.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?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($exception);
http_response_code(500);
\dashboard\primary\error($exception->getMessage());
});
$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'];
$twofactor = $row['twofactor'];
$_SESSION['role'] = $role;
$expires = $row['expires'];
if (in_array($role, array("developer", "seller"))) {
$_SESSION['timeleft'] = dashboard\primary\expireCheck($username, $expires);
}
if (!$_SESSION['app']) // no app selected yet
{
$query = misc\mysql\query("SELECT * FROM `apps` WHERE `owner` = ? AND `ownerid` = ?",[$_SESSION['username'], $_SESSION['ownerid']]); // select all apps where owner is current user
if ($query->num_rows == 1) // if the user only owns one app, load that app (they can still change app after it's loaded)
{
$row = mysqli_fetch_array($query->result);
$_SESSION['name'] = $row["name"];
$_SESSION["selectedApp"] = $row["name"];
$_SESSION['app'] = $row["secret"];
}
}
?>
<!DOCTYPE html>
<html lang="en">
<!--begin::Head-->
<head>
<base href="">
<title>Keyauth - Open Source Auth</title>
<link rel="shortcut icon" href="https://cdn.keyauth.cc/v2/assets/media/logos/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--begin::Page Vendor Stylesheets(used by this page)-->
<link href="https://cdn.keyauth.cc/v2/assets/plugins/custom/datatables/datatables.bundle.css" rel="stylesheet"
type="text/css" />
<!--end::Page Vendor Stylesheets-->
<!--begin::Global Stylesheets Bundle(used by all pages)-->
<link href="https://cdn.keyauth.cc/v2/assets/plugins/global/plugins.dark.bundle.css" rel="stylesheet"
type="text/css" />
<link href="https://cdn.keyauth.cc/v2/assets/css/style.dark.bundle.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/@mdi/font@6.9.96/css/materialdesignicons.min.css">
<style>
.secret {
color: transparent;
text-shadow: 0px 0px 5px #b2b9bf;
transition: text-shadow 0.1s linear;
}
.secret:hover {
text-shadow: 0px 0px 0px #b2b9bf;
}
.secretlink {
color: transparent;
text-shadow: 0px 0px 5px #007bff;
transition: text-shadow 0.1s linear;
}
.secretlink:hover {
text-shadow: 0px 0px 0px #007bff;
color: transparent;
}
</style>
<!-- Credits to https://stackoverflow.com/a/45656609 -->
<script>
if (window.history.replaceState) {
window.history.replaceState(null, null, window.location.href);
}
</script>
<!--end::Global Stylesheets Bundle-->
</head>
<!--end::Head-->
<!--begin::Body-->
<!--<body id="kt_body" class="page-loading-enabled header-fixed header-tablet-and-mobile-fixed toolbar-enabled toolbar-fixed toolbar-tablet-and-mobile-fixed aside-enabled aside-fixed" style="--kt-toolbar-height:55px;--kt-toolbar-height-tablet-and-mobile:55px" data-kt-aside-minimize="on">'; -->
<body id="kt_body"
class="page-loading-enabled header-fixed header-tablet-and-mobile-fixed toolbar-enabled toolbar-fixed toolbar-tablet-and-mobile-fixed aside-enabled aside-fixed"
style="--kt-toolbar-height:55px;--kt-toolbar-height-tablet-and-mobile:55px"';
<?php include 'layout/master.php' ?>
<?php include 'layout/_scrolltop.php' ?>
<!--end::Modals-->
<!--begin::Javascript-->
<!--begin::Global Javascript Bundle(used by all pages)-->
<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>
<!--end::Global Javascript Bundle-->
<!--begin::Page Vendors Javascript(used by this page)-->
<script src="https://cdn.keyauth.cc/v2/assets/plugins/custom/datatables/datatables.bundle.js"></script>
<script src="https://cdn.keyauth.cc/v2/assets/plugins/custom/datatables/datatables.js"></script>
<!--end::Page Vendors Javascript-->
<!--end::Javascript-->
<script src="https://cdn.keyauth.cc/dashboard/assets/libs/popper-js/dist/umd/popper.min.js"></script>
<script src="https://cdn.keyauth.cc/dashboard/assets/libs/bootstrap/dist/js/bootstrap.min.js"></script>
<script>
// @see https://docs.headwayapp.co/widget for more configuration options.
var HW_config = {
selector: ".noti", // CSS selector where to inject the badge
account: "yBgPqx"
}
</script>
<script async src="https://cdn.headwayapp.co/widget.js"></script>
</body>
<!--end::Body-->
</html>