mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 02:28:05 -07:00
Preventing CSRF in /file_manager/fm_api.php
This commit is contained in:
parent
9277b37800
commit
0336e8b8d0
1 changed files with 1 additions and 9 deletions
|
@ -3,15 +3,7 @@
|
|||
//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.");
|
||||
}
|
||||
}
|
||||
prevent_post_csrf(true);
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue