1

I have a Controller with a method that accepts 2 parameters a username and a password like the following :

class Test extends CI_Controller {

    public function index($username= NULL, $password = NULL){
        if($username === NULL){
           echo "Error";          
        }else if($password === NULL){
            echo "Error";
        }else{
            echo "Your username is :"$username." and your password is :".$password;
        }            
    }
}

in the route file I'm doing:

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

and in config file :

$config['permitted_uri_chars'] = '';

The url looks like: mysite.com/Test/mike123/rtO;"*skj

The issue I'm facing is that the password can contain a slashes that can make the url like below and break it:

mysite.com/Test/mike123/rtO;"*//skj

The url must be run like : mysite.com/Test/param1/param2 I do not want to url encode it. Is there any solution to run the url and get the parameters as mike123 and rtO;"*//skj

Thanks

1
  • Use url_encode and url_decode Commented Sep 18, 2015 at 10:15

2 Answers 2

3

You are trying to pass password through URL. DO you know that this is not at all secure. You do not want to encode it either.

I would pass the password through POST which is more secure then passing it directly through URL.

However, If this is what you want you can url_encode the password when passing into this function and again url_decode it back in the function for further use

Sign up to request clarification or add additional context in comments.

1 Comment

what is the portable between languages like PHP and .NET? url_encode and url_decode or rawurlencode and rawurldecode
0

Send username and password using jquery like this

var username = $("#username").val();

var password = $("#password").val();

var datastring ='username='+username+'&password='+password;

$.post(URL,datastring,function(){

});

Comments

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.