From 6184f3815f74a80ed4c61ee61007fcfcba8a89a5 Mon Sep 17 00:00:00 2001 From: JonatanRek Date: Wed, 11 Mar 2020 12:23:49 +0100 Subject: [PATCH] Updater Ip address Filtration --- update.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/update.php b/update.php index e756b62..b483dca 100644 --- a/update.php +++ b/update.php @@ -26,6 +26,19 @@ $logManager = new LogManager(); 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) { header($_SERVER["SERVER_PROTOCOL"] . ' 200 OK', true, 200);