Welcome Guest, Not a member yet? Register   Sign In
passing text over the URI - how to encode?
#1

[eluser]deck42[/eluser]
Hi everyone,

This is quite a basic question: if I want to pass long messages over the URI, I run into the problem that my browser will interpret some characters in a way that breaks the URI, i.e. I get a 404.

So I guess I have to encode all URI text, but what algorithm to use? base64? urlencode? unix2unix?
As far as I can say all generate some unwanted characters, which I would have to allow, but then the security suffers.

I though this question is so fundamental that there must be some simpler solution that Im missing?
#2

[eluser]John_Betong_002[/eluser]
 
Take a look at the User Guide, url_title();, it may do what you want...
 

 

 
#3

[eluser]deck42[/eluser]
Hello and thanks for your reply!

Yet I do not feel this is what Im looking for. Let me rephrase:
I want to redirect from one controller to another and pass along a status message. I can only do this over the URI, since I cant call a controller directly. Now I dont want to worry about whats in the string I pass.

There has to be some standard encode decode for this? is url_title that, will it encode / decode any forbidden characters?
#4

[eluser]danmontgomery[/eluser]
Use session?

Code:
// controller 1
$this->session->set_flashdata('message', 'This is a really long message that is really long and even has some "special ch@racters!"');
redirect('another/controller');

// controller 2
if($this->session->flashdata('message')) {
    echo $this->session->flashdata('message');
}
#6

[eluser]deck42[/eluser]
Thanks alot for your replys.
I remember trying urlencode and decode and having some special problem, but forgot what it was :-)

Anyways, the session solution looks very neat, I will go with that, thanks to all!




Theme © iAndrew 2016 - Forum software by © MyBB