0

I have a codeigniter Controller that has an index page that accepts 4 parameters like the followng :

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Upload extends CI_Controller {

    public function index($file_name = NULL, $PID = NULL, $Email = NULL, $password = NULL){
        if($file_name === NULL){
           $this->output    
                ->set_content_type('application/json')
                ->set_output(json_encode(array("status"=> "failure", "message" => "The file name is missing")));          
        }else if($PID === NULL){
            $this->output    
                ->set_content_type('application/json')
                ->set_output(json_encode(array("status"=> "failure", "message" => "The PID is missing")));
        }else if($Email === NULL){
            $this->output    
                ->set_content_type('application/json')
                ->set_output(json_encode(array("status"=> "failure", "message" => "The email is missing")));
        }else if($password === NULL){
            $this->output    
                ->set_content_type('application/json')
                ->set_output(json_encode(array("status"=> "failure", "message" => "The password is missing")));
}else{
$this->output    
                ->set_content_type('application/json')
                ->set_output(json_encode(array("status"=> "success", "message" => "Upload Done")));
}
}
}

the route.php file looks like :

$route['Upload/(:any)'] = "Upload/index/$1";
$route['Upload/(:any)/(:any)'] = "Upload/index/$1/$2";
$route['Upload/(:any)/(:any)/(:any)'] = "Upload/index/$1/$2/$3";
$route['Upload/(:any)/(:any)/(:any)/(:any)'] = "Upload/index/$1/$2/$3/$4";

I want to call the Controller index method an provide all data like the following:

www.mysite.com/Upload/myfile.csv/367/[email protected]/mypass;23!ù/o*

if I run it like that I get :

An Error Was Encountered

The URI you submitted has disallowed characters.

What is the best way to encrypt each data and send them all within the URL like above?

I tried base64 but same issue, any ideas please?

Thanks

1 Answer 1

1

Hey Man just change your config.php put this on on your permitted chars

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-\=';

you can variate depending on what you need

$config['permitted_uri_chars'] = 'a-z 0-9~%.:&_\-'; 
Sign up to request clarification or add additional context in comments.

5 Comments

Can I allow all possible chars?
The issue is now if the password has a slash that will break the routes conditions so any ideas on how to fix that?
first you close this problem (or at least upvote me =P ) then we work on the next one, kidding on your apache configs put this AllowEncodedSlashes httpd.apache.org/docs/2.2/mod/core.html#allowencodedslashes Then try to enconde the url so the "/" becames a "%2F"
ok Sorry i just forgot to do it. So can you advice me please?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.