Welcome Guest, Not a member yet? Register   Sign In
Overriding the disallowed characters error
#1

[eluser]simonspoken[/eluser]
I'm trying to override the disallowed characters error:

From Router.php

Code:
function _filter_uri($str)
    {
        if ($this->config->item('permitted_uri_chars') != '')
        {
            if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str))
            {
                exit('The URI you submitted has disallowed characters.');
            }
        }    
            return $str;
    }

I'd like to be able to strip out the disallowed characters, and then redirect to the valid URI (so - replace exit() with something). I'm terrible with regex, which has led me here.

Can anyone help?
#2

[eluser]Mirage[/eluser]
From the top of my head this might work:

Code:
$new_uri=preg_replace('|[^/'.$this->config->item('permitted_uri_chars').']|', '', $str);
header: "Location: {$str}"; exit();

Cheers,
-m




Theme © iAndrew 2016 - Forum software by © MyBB