Browse Source

Added Blacklist to Auth.php

causefx 8 years ago
parent
commit
2f4f086078
1 changed files with 7 additions and 1 deletions
  1. 7 1
      auth.php

+ 7 - 1
auth.php

@@ -4,6 +4,7 @@ require_once("user.php");
 $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) {
@@ -14,6 +15,11 @@ if ($whitelist) {
 		$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");
@@ -36,4 +42,4 @@ if ($skipped) {
 	!$debug ? exit(http_response_code(401)) : die("$USER->username on $currentIP Not Authorized Nor On Whitelist");
 }
 
-?>
+?>