-
-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #464 from causefx/develop
v1.40 Changes
- Loading branch information
Showing
26 changed files
with
9,357 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,39 @@ | ||
<?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; | ||
|
||
$debug = false; | ||
require_once("user.php"); | ||
$USER = new User("registration_callback"); | ||
$ban = isset($_GET['ban']) ? strtoupper($_GET['ban']) : ""; | ||
$whitelist = isset($_GET['whitelist']) ? $_GET['whitelist'] : false; | ||
$currentIP = get_client_ip(); | ||
|
||
if ($whitelist) { | ||
$skipped = false; | ||
if(in_array($currentIP, getWhitelist($whitelist))) { | ||
!$debug ? exit(http_response_code(200)) : die("$currentIP Whitelist Authorized"); | ||
}else{ | ||
$skipped = true; | ||
} | ||
} | ||
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 Authorized At Admin Level"); | ||
} else { | ||
!$debug ? exit(http_response_code(401)) : die("$USER->username Not Authorized At Admin Level"); | ||
} | ||
} | ||
if (isset($_GET['user'])) { | ||
if($USER->authenticated && !in_array(strtoupper($USER->username), getBannedUsers($ban))) { | ||
!$debug ? exit(http_response_code(200)) : die("$USER->username Authorized At User Level"); | ||
} else { | ||
!$debug ? exit(http_response_code(401)) : die("$USER->username Not Authorized At User Level"); | ||
} | ||
} | ||
if (!isset($_GET['user']) && !isset($_GET['admin']) && !isset($_GET['whitelist'])) { | ||
!$debug ? exit(http_response_code(401)) : die("Not Authorized Due To No Parameters Set"); | ||
} | ||
|
||
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; | ||
if ($skipped) { | ||
!$debug ? exit(http_response_code(401)) : die("$USER->username on $currentIP $skipped Not Authorized Nor On Whitelist"); | ||
} | ||
|
||
?> |
Oops, something went wrong.