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

[eluser]freshface[/eluser]
When I have this error

Quote:The URI you submitted has disallowed characters.

I want to load an other view, but how do i fetch this in my controller?
#2

[eluser]Yash[/eluser]
Question is not clear to me..Give more detail
#3

[eluser]freshface[/eluser]
When somebody enters disallowed characters in the url i want to capture the error instead of showing the default CI error.
Edit, extending the permitted characters is not an option.
#4

[eluser]Yash[/eluser]
http://ellislab.com/forums/viewreply/410947/

You can achieve a much neater “upgrade” to this error message without hacking the core files.

Simply make a file in your application’s “libraries” directory called MY_URI.php, and fill it with:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_URI extends CI_URI {

    function _filter_uri($str)
    {
        if ($str != '' AND $this->config->item('permitted_uri_chars') != '')
        {
            if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str))
            {
                show_404($str);
                exit();
            }
        }
            
        return $str;
    }
    
}

?>

i.e. a direct copy of the appropriate function from the core class, but with your new addition of show_404() too.
#5

[eluser]freshface[/eluser]
Thx, works like a charm!
#6

[eluser]Yash[/eluser]
your welcome




Theme © iAndrew 2016 - Forum software by © MyBB