Welcome Guest, Not a member yet? Register   Sign In
Disallowed Character Redirect
#2

[eluser]Buso[/eluser]
Code:
class MY_URI extends CI_Uri {
    
    public function __construct() {
      
        parent::CI_URI();
        
    }
    
    function _filter_uri($str) {
        
        if ($str != '' && $this->config->item('permitted_uri_chars') != '' && $this->config->item('enable_query_strings') == FALSE) {
            
            if ( ! preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $str)) {
                
                $str = 'non-existent-uri';
                
            }
            
        }
                            
        return $str;
        
    }
}

Basically you return a non-existent uri when you find disallowed characters. Then you let the Router class handle that as a 404.


Messages In This Thread
Disallowed Character Redirect - by El Forum - 07-10-2010, 03:56 PM
Disallowed Character Redirect - by El Forum - 07-10-2010, 04:10 PM
Disallowed Character Redirect - by El Forum - 07-10-2010, 04:15 PM
Disallowed Character Redirect - by El Forum - 08-13-2010, 10:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB