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,6 +1,7 @@
<?php <?php
// Preventing CSRF // Preventing CSRF
if ($_SERVER['REQUEST_METHOD']=='POST') {
$host_arr=explode(":", $_SERVER['HTTP_HOST']); $host_arr=explode(":", $_SERVER['HTTP_HOST']);
$hostname=$host_arr[0]; $hostname=$host_arr[0];
$port = $_SERVER['SERVER_PORT']; $port = $_SERVER['SERVER_PORT'];
@ -8,6 +9,7 @@ $expected_http_origin="https://".$hostname.":".$port;
if ($_SERVER['HTTP_ORIGIN'] != $expected_http_origin) { if ($_SERVER['HTTP_ORIGIN'] != $expected_http_origin) {
die ("Nope."); die ("Nope.");
} }
}
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$user = $_SESSION['user']; $user = $_SESSION['user'];