Welcome Guest, Not a member yet? Register   Sign In
Any way to allow certain URL characters only for a specifc controller?
#1

[eluser]Dandy_andy[/eluser]
Is there any way to change the allowed URL characters for a specific controller rather than change them globally? I am integrating a payment processor that needs to post certain characters in the URL to a specific controller but I don't want to compromise the security of the rest of the site.
#2

[eluser]InsiteFX[/eluser]
You could try this:

Code:
// set it for modified url.
$this->config->set_item('permitted_uri_chars', 'a-z 0-9~%.:_\-&?');

// your code here!

// set it back for orginal url.
$this->config->set_item('permitted_uri_chars', 'a-z 0-9~%.:_\-');
#3

[eluser]jonez[/eluser]
Another alternative is to use a pre_system hook and change the config setting at run time based on the current URL.

Code:
$hook['pre_system'][] = array(
'function' => 'check_chars',
'filename' => 'chars.php',
'filepath' => 'hooks',
);
Code:
<?php

function check_chars( ) {
if ( stripos( $_SERVER[ 'REQUEST_URI' ], '/login' ) !== false || stripos( $_SERVER[ 'REQUEST_URI' ], '/register' ) !== false ) {
  $config =& load_class( 'Config', 'core' );
  $config->set_item( 'permitted_uri_chars', '.....' );
}
}

?>




Theme © iAndrew 2016 - Forum software by © MyBB