mirror of
https://github.com/myvesta/vesta
synced 2025-08-21 13:54:28 -07:00
Preventing CSRF in edit/file
This commit is contained in:
parent
914b53ea1c
commit
d559763427
1 changed files with 9 additions and 0 deletions
|
@ -1,5 +1,14 @@
|
||||||
<?php
|
<?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.");
|
||||||
|
}
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
$user = $_SESSION['user'];
|
$user = $_SESSION['user'];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue