Welcome Guest, Not a member yet? Register   Sign In
Problem passing encrypted values in url segments
#1

[eluser]fusionblu[/eluser]
I have an application that that needs an id to be passed as part of the URL. Due to security concerns I need to encrypt the id.

Current Scenario -
Code:
http://mysite/mycontroller/myfunction/5
Expected solution -
Code:
http://mysite/mycontroller/myfunction/XcvTr4YtddfRkouyt

The encrypted id will be decoded and used later.

I tried using the encrypt helper..the problem is that special characters are introduced and + or / is part of the encrypted string. This is throwing up all types of problems.

I have also tried to use htmlentities, urlencode, rawurlencode, htmlspecialcharacters as wrappers after encryption. Nothing seems to work as each of these allow the use of '/'.

Can someone guide me on what to do ?
Thanks in advance.
#2

[eluser]Pascal Kriete[/eluser]
Encrypt uses base64_encode before returning the string, so basically, you need to replace all the offending characters with something that isn't in the base64 alphabet (and is allowed in a url), and then replace it back before decoding it.
Code:
$encoded = $this->encrypt->encode....
$encoded = strtr($encoded, '+/=', '-_,');

// And back again
$decoded = strtr($encoded, '-_,', '+/=');
$decoded = $this->encrypt->decode...
#3

[eluser]davidbehler[/eluser]
try this one: http://ellislab.com/forums/viewthread/45129/

scroll down to zenfro's second post.

works fine for me!
#4

[eluser]fusionblu[/eluser]
Zenfros solutions works for me.

Regarding using GET ..In my scenario I cant use GET. It is a hyperlink that does some processing.

Thanks
#5

[eluser]Unknown[/eluser]
[quote author="davidbehler" date="1215173352"]try this one: http://ellislab.com/forums/viewthread/45129/

scroll down to zenfro's second post.

works fine for me![/quote]


Hi davidbehler,
Can you please send me the solution because when i click on the link it is saying "You are not authorized to perform this action"

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB