Update index.php

This commit is contained in:
myvesta 2021-08-15 14:37:53 +02:00 committed by GitHub
parent 9f55ef33cf
commit 518e627b46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,12 +1,14 @@
<?php <?php
// Preventing CSRF // Preventing CSRF
$host_arr=explode(":", $_SERVER['HTTP_HOST']); if ($_SERVER['REQUEST_METHOD']=='POST') {
$hostname=$host_arr[0]; $host_arr=explode(":", $_SERVER['HTTP_HOST']);
$port = $_SERVER['SERVER_PORT']; $hostname=$host_arr[0];
$expected_http_origin="https://".$hostname.":".$port; $port = $_SERVER['SERVER_PORT'];
if ($_SERVER['HTTP_ORIGIN'] != $expected_http_origin) { $expected_http_origin="https://".$hostname.":".$port;
die ("Nope."); if ($_SERVER['HTTP_ORIGIN'] != $expected_http_origin) {
die ("Nope.");
}
} }
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");