diff --git a/index.php b/index.php index 185c87e..b1b929d 100644 --- a/index.php +++ b/index.php @@ -29,6 +29,31 @@ } } + $headers = apache_request_headers(); + // Need this headers + $check = [ + "Content-Type" => "application/json" + "Connection" => "keep-alive" + ]; + + if($pass){ + foreach($check as $h => $v){ + $get = FALSE; + $h = strtolower($h); + // $v = strtolower($v); + foreach($headers as $ah => $av){ + if($h == trim(strtolower($ah)) and $v == $av){ + $get = TRUE; + break; + } + } + if(!$get){ + $pass = FALSE; + break; + } + } + } + if(!$pass){ error_log("Access denied from " .$_SERVER['REMOTE_ADDR'] ." to bot " .$config['telegram']['username']); http_response_code(401); diff --git a/robots.txt b/robots.txt new file mode 100644 index 0000000..1f53798 --- /dev/null +++ b/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: /