-
-
Save sfengyuan/2a77538ed1a5c4aec41c 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