mirror of
https://github.com/myvesta/vesta
synced 2025-07-06 04:51:54 -07:00
Update index.php
This commit is contained in:
parent
9f55ef33cf
commit
518e627b46
1 changed files with 8 additions and 6 deletions
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
// Preventing CSRF
|
||||
$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.");
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue