Preventing uploads from other origin

This commit is contained in:
Anton Reutov 2021-07-27 14:56:35 +03:00 committed by GitHub
commit 8a60b257a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,13 @@
//session_start();
$hostname = exec('hostname');
$port = $_SERVER['SERVER_PORT'];
$expected_http_origin="https://".$hostname.":".$port;
if ($_SERVER['HTTP_ORIGIN'] != $expected_http_origin) {
die ("Nope.");
}
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check login_as feature