Welcome Guest, Not a member yet? Register   Sign In
Decoding fails when encrypted string gets passed in URI
#1

[eluser]Unknown[/eluser]
Hi all,

I'm having problems decoding a encoded string, being read from a URI.

First I encode a string (with the CI Encryption lib), create a anchor from it, and send it to the user via email. This results in a link like this:
Code:
http://www.example.com/verify/user/[ENCRYPTED_STRING]

The 'user' method in the Verify Controller expects only one param, the encoded string. But when I try to decode the param in the Verify controller, it fails almost everytime. Sometimes I get a partially decoded string, but most of the time it fails completely. I think it has something to do with the fact that the encrypted string sometimes contains characters like '/', which lets the controller believe it recieves multiple params.

Anybody any ideas what is going wrong? And how to fix it?

Thanks Smile
#2

[eluser]rogierb[/eluser]
you can use urlencode([ENCRYPTED_STRING]) and when reading the uri segment urldecode([ENCRYPTED_STRING]).




Theme © iAndrew 2016 - Forum software by © MyBB