Last active
July 2, 2018 20:24
-
-
Save vzool/87b13a3d0c8e168a3587 to your computer and use it in GitHub Desktop.
CodeIgniter: ignore CSRF in many URIs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Put those lines in application/config/config.php | |
$csrf_ignore = [ | |
'/page1.html', | |
'/about.html' | |
]; | |
$is_csrf_condition_met = true; | |
foreach($csrf_ignore as $ci){ | |
if (strpos($_SERVER["REQUEST_URI"], $ci) !== FALSE) { | |
$is_csrf_condition_met = false; | |
break; | |
} | |
} | |
$config['csrf_protection'] = $is_csrf_condition_met; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For anyone looking at targeting list of links which can be grouped in arrays see my answer HERE