Updater Ip address Filtration

This commit is contained in:
JonatanRek 2020-03-11 12:23:49 +01:00
parent 44c4c84292
commit 6184f3815f

View File

@ -26,6 +26,19 @@ $logManager = new LogManager();
header('Content-type: text/plain; charset=utf8', true); header('Content-type: text/plain; charset=utf8', true);
//Filtrování IP adress
if (DEBUGMOD != 1) {
if (!in_array($_SERVER['REMOTE_ADDR'], HOMEIP)) {
echo json_encode(array(
'state' => 'unsuccess',
'errorMSG' => "Using API from your IP insnt alowed!",
));
header($_SERVER["SERVER_PROTOCOL"]." 401 Unauthorized");
$logManager->write("[Updater] acces denied from " . $_SERVER['REMOTE_ADDR'], LogRecordType::WARNING);
exit();
}
}
function sendFile($path) function sendFile($path)
{ {
header($_SERVER["SERVER_PROTOCOL"] . ' 200 OK', true, 200); header($_SERVER["SERVER_PROTOCOL"] . ' 200 OK', true, 200);