forked from causefx/Organizr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.php
executable file
·56 lines (29 loc) · 1.02 KB
/
auth.php
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
<?php
$data = false;
function getBannedUsers($string){
if (strpos($string, ',') !== false) {
$banned = explode(",", $string);
}elseif (strpos($string, ',') == false) {
$banned = array($string);
}
return $banned;
}
if (isset($_GET['ban'])) : $ban = strtoupper($_GET['ban']); else : $ban = ""; endif;
require_once("user.php");
$USER = new User("registration_callback");
if (isset($_GET['admin'])) :
if($USER->authenticated && $USER->role == "admin" && !in_array(strtoupper($USER->username), getBannedUsers($ban))) :
exit(http_response_code(200));
else :
exit(http_response_code(401));
endif;
elseif (isset($_GET['user'])) :
if($USER->authenticated && !in_array(strtoupper($USER->username), getBannedUsers($ban))) :
exit(http_response_code(200));
else :
exit(http_response_code(401));
endif;
elseif (!isset($_GET['user']) && !isset($_GET['admin'])) :
exit(http_response_code(401));
endif;
?>