mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 18:49:21 -07:00
Preventing all CSRF
This commit is contained in:
parent
1d73ff488b
commit
55c591535c
1 changed files with 13 additions and 0 deletions
|
@ -49,3 +49,16 @@ if ($skip_login_url_check==0) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Preventing all CSRF
|
||||
if ($skip_login_url_check==0) {
|
||||
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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue