mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 21:04:07 -07:00
Preventing CSRF in file_manager/fm_api.php
This commit is contained in:
parent
55c591535c
commit
43da9e2aa7
1 changed files with 11 additions and 0 deletions
|
@ -2,6 +2,17 @@
|
||||||
// Init
|
// Init
|
||||||
//error_reporting(NULL);
|
//error_reporting(NULL);
|
||||||
|
|
||||||
|
// Preventing CSRF
|
||||||
|
if ($_SERVER['REQUEST_METHOD']=='POST') {
|
||||||
|
$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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue