forked from Shenzhen-Robotics-Alliance/Maple-Scout-Legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpermissions.php
More file actions
90 lines (88 loc) · 3.35 KB
/
Copy pathpermissions.php
File metadata and controls
90 lines (88 loc) · 3.35 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
<?php
// 权限检查函数,接收一个包含多个组别的数组
function checkPermission($allowedGroups) {
// 启动会话管理
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
// 确保 $_SESSION['group'] 已设置,并检查用户组是否在允许的组别中
if (!isset($_SESSION['group']) || !in_array($_SESSION['group'], $allowedGroups)) {
// 如果不在允许的组别中,显示访问被拒绝的消息
header("HTTP/1.1 403 Forbidden");
echo '
<?php
header("HTTP/1.1 403 Forbidden");
?>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>403 Forbidden</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f2f2f2;
color: #333;
text-align: center;
}
.container {
padding: 20px;
background-color: white;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
max-width: 600px;
margin: 50px auto;
text-align: left;
}
h1 {
color: #e74c3c;
}
p {
font-size: 16px;
line-height: 1.6;
}
hr {
border: 0;
border-top: 1px solid #ddd;
margin: 20px 0;
}
footer {
font-size: 14px;
color: #888;
}
@media (max-width: 600px) {
.container {
padding: 15px;
margin: 20px;
}
h1 {
font-size: 24px;
}
p {
font-size: 14px;
}
}
</style>
<script>
setTimeout(function() {
window.location.href = "../";
}, 10000);
</script>
</head>
<body>
<div class="container">
<h1>403 Forbidden</h1>
<p>Access Denied.<br>You do not have permission to access this page.<br><br>To prevent extraneous video uploads from affecting bandwidth, and malicious attacks from the Internet, this page is only open to media groups, outreach groups, and administrator groups.<br><br>Redirected back after 10 seconds.</p>
<hr>
<footer>IronMaple@Minur_</footer>
</div>
</body>
</html>
';
exit;
}
}
?>