mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 10:37:42 -07:00
Preventing CSRF in schedule / backup
This commit is contained in:
parent
518e627b46
commit
1d73ff488b
1 changed files with 11 additions and 0 deletions
|
@ -1,5 +1,16 @@
|
|||
<?php
|
||||
|
||||
// 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.");
|
||||
}
|
||||
}
|
||||
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue