Welcome Guest, Not a member yet? Register   Sign In
URI-Safe Encrypt Library Extension

Echo $from_id and check that it is truly identical to what you are expecting it to be

$from_id_decrypted    =    $this->encrypt->decode($from_id);
        echo 'Encrypted $from_id: >>> ' . $from_id . '<br />';                 //returns  7hCcRW5sSA6661ozJuC4n2SXu5tsU5GjPdoNkNP~n4DP0up9k6OfK7Hq_ACgY_sFsVn3rx4MbfEJ4O_gfLEvzQ--
        echo 'Decrypted $from_id: >>> ' . $from_id_decrypted . '<br />';     //returns BLANK
        echo 'Decrypted $from_id value >>> ' . $this->encrypt->decode('7hCcRW5sSA6661ozJuC4n2SXu5tsU5GjPdoNkNP~n4DP0up9k6OfK7Hq.ACgY.sFsVn3rx4MbfEJ4O.gfLEvzQ--'); //returns "2"

Yes it's exactly the same. Hmmm....

*Edit: see attachment (*.png file)

They're not the same

query string: 7hCcRW5sSA6661ozJuC4n2SXu5tsU5GjPdoNkNP~n4DP0up9k6OfK7Hq_ACgY_sFsVn3rx4MbfEJ4O_gfLEvzQ--
your test: 7hCcRW5sSA6661ozJuC4n2SXu5tsU5GjPdoNkNP~n4DP0up9k6OfK7Hq.ACgY.sFsVn3rx4MbfEJ4O.gfLEvzQ--

The difference is that there are dots instead of underscores. Did you copy and paste the above code (for MY_Encrypt) or did you try to manually type it out? It looks to me like there is a mix-up in the array being passed to strtr. Check there against the actual code and I think you will find the issue. I recommend just copying and pasting it.

Haha .. no I didn't type it out..I did a copy & paste it.
But thanks anyways... I did a str_replace('_', '.', $from_id) and THEN decode it.

It works perfectly now! =)

the echo $from_id that the controller receives ...automatically replaces "." => "_"
I dont know why. The MY_Encrypt doesn't do that (I already checked that out)

I tried to add "_" => "." to the decode array script in MY_Encrypt. It does his job but in the end it will return BLANK.

*So the only way out is the str_replace function.*

Have a nice day.

[quote author="TheFuzzy0ne" date="1237784179"]I extended the CI_Encrypt class, as I wanted to have the ability to send an encrypted string over the URI, without triggering the infamous "The URI you submitted has disallowed characters." message. I use it for my "Forgot Password" module on my Web site. I encrypt the users Email address, and the last 16 characters of their MD5 hashed password, and this is then decoded and used to validate the user.

I hope someone might find it useful.


Hi TheFuzzy0ne
I found this post accidently whilst looking for something else.
This is great. I had this issue a month ago and created my own solution, but this is way better.
I have now changed over to your solution and have no problems.
When I am looking for a solution in CI I always check the Wiki first. This is not there, so maybe you can help CIers in the future with this issue by adding this to the Wiki if you have time.

Theme © iAndrew 2016 - Forum software by © MyBB