Preventing CSRF in UploadHandler.php

This commit is contained in:
myvesta 2021-08-29 00:10:42 +02:00 committed by GitHub
commit 92297f2fc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,13 +2,8 @@
//session_start();
$host_arr=explode(":", $_SERVER['HTTP_HOST']);
$hostname=$host_arr[0];
$port = $_SERVER['SERVER_PORT'];
$expected_http_origin="https://".$hostname.":".$port;
if ($_SERVER['HTTP_ORIGIN'] != $expected_http_origin) {
die ("Nope.");
}
// Preventing CSRF
prevent_post_csrf(true);
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");