andz Posted May 21, 2009 Share Posted May 21, 2009 Is there any way that I can globally filter the whole POST and GET variables by putting up the script at the very top of the page. any possible codes Link to comment https://forums.phpfreaks.com/topic/159114-global-filter-for-post-and-get/ Share on other sites More sharing options...
gevans Posted May 21, 2009 Share Posted May 21, 2009 <?php foreach($_GET as $key => $value) { //do whatever you want to $value $_GET[$key] = trim($value);//example } Link to comment https://forums.phpfreaks.com/topic/159114-global-filter-for-post-and-get/#findComment-839111 Share on other sites More sharing options...
andz Posted May 21, 2009 Author Share Posted May 21, 2009 is there any way that i can possibly write it in example .htaccess or php.ini that all of incoming GET or POST will be filtered so that i won't have to write php codes Link to comment https://forums.phpfreaks.com/topic/159114-global-filter-for-post-and-get/#findComment-839120 Share on other sites More sharing options...
gevans Posted May 21, 2009 Share Posted May 21, 2009 As far as I'm aware no... That's hardly the hardest 3 lines of code ever written, and if you ut in a function you can use it on all sorts of strins/arrays for cleaning. Link to comment https://forums.phpfreaks.com/topic/159114-global-filter-for-post-and-get/#findComment-839121 Share on other sites More sharing options...
andz Posted May 21, 2009 Author Share Posted May 21, 2009 the problem that i have right now is that im working with an existing system with many files that contains GET and POST, the owner of the codes wants to FILTER all of the POST and GET without modifying the existing php codes. Link to comment https://forums.phpfreaks.com/topic/159114-global-filter-for-post-and-get/#findComment-839128 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.