Created
January 4, 2014 12:15
-
-
Save wmandai/8254861 to your computer and use it in GitHub Desktop.
Codeigniter disable CSRF in specific pages
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
<?php | |
// Add this to your config.php file | |
if (stripos($_SERVER["REQUEST_URI"],'/controller/method') === FALSE) { | |
$config['csrf_protection'] = TRUE; | |
}else{ | |
$config['csrf_protection'] = FALSE; | |
} | |
//the rest of the code |
Thanks...
thanks
wow its work 💃
thanks
Thanks! (;
Thank you 1000 times.
You can also use,
$config['csrf_exclude_uris'] = array('controller/method');
Hello,
this is for controller function, i want to ignore API file means web service controller file all functions.
please help me for this.
For anyone looking at targeting list of links which can be grouped in arrays see my answer HERE
Thank you
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is my update for this logic to working with many URIs.
https://gist.github.com/vzool/87b13a3d0c8e168a3587
Hope it help other developers.