Skip to content

Commit

Permalink
Added Blacklist to Auth.php
Browse files Browse the repository at this point in the history
  • Loading branch information
causefx committed Oct 30, 2017
1 parent 8381926 commit 2f4f086
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
$USER = new User("registration_callback");
$ban = isset($_GET['ban']) ? strtoupper($_GET['ban']) : "";
$whitelist = isset($_GET['whitelist']) ? $_GET['whitelist'] : false;
$blacklist = isset($_GET['blacklist']) ? $_GET['blacklist'] : false;
$currentIP = get_client_ip();

if ($whitelist) {
Expand All @@ -14,6 +15,11 @@
$skipped = true;
}
}
if ($blacklist) {
if(in_array($currentIP, getWhitelist($blacklist))) {
!$debug ? exit(http_response_code(401)) : die("$currentIP Blacklisted");
}
}
if (isset($_GET['admin'])) {
if($USER->authenticated && $USER->role == "admin" && !in_array(strtoupper($USER->username), getBannedUsers($ban))) {
!$debug ? exit(http_response_code(200)) : die("$USER->username on $currentIP Authorized At Admin Level");
Expand All @@ -36,4 +42,4 @@
!$debug ? exit(http_response_code(401)) : die("$USER->username on $currentIP Not Authorized Nor On Whitelist");
}

?>
?>

0 comments on commit 2f4f086

Please sign in to comment.