Skip to content

Commit

Permalink
fix(CSRF) merge IFs
Browse files Browse the repository at this point in the history
  • Loading branch information
joebordes committed Aug 21, 2022
1 parent 6b5de9e commit 781e947
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions include/csrfmagic/csrf-magic.php
Expand Up @@ -202,11 +202,9 @@ function csrf_ob_handler($buffer, $flags) {
*/
function csrf_check($fatal = true) {
global $site_URL;
if (empty($_SERVER['HTTP_REFERER']) && ((empty($_SERVER['REQUEST_METHOD']) || $_SERVER['REQUEST_METHOD'] !== 'POST'))) {
return true;
}

if (!empty($_SERVER['HTTP_REFERER']) && (strpos($_SERVER['HTTP_REFERER'], $site_URL) !== false) && (empty($_SERVER['REQUEST_METHOD']) || $_SERVER['REQUEST_METHOD'] !== 'POST')) {
if ((empty($_SERVER['HTTP_REFERER']) || strpos($_SERVER['HTTP_REFERER'], $site_URL) !== false)
&& (empty($_SERVER['REQUEST_METHOD']) || $_SERVER['REQUEST_METHOD'] !== 'POST')
) {
return true;
}

Expand Down

0 comments on commit 781e947

Please sign in to comment.