Welcome Guest, Not a member yet? Register   Sign In
Adding a base64_encode data to URL
#1

[eluser]Josepzin[/eluser]
I want to create a URI with a encoded data, like this:

Code:
htt://domain.com/loquesea/VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==

But it is impossible, because when i get the segment, this is in lowercase and i can not decode it...

I have read same discussion posts about the lowercase URIs and CI, my question is: is possible get a segment without lowercase? I do not want to modify the core... :S

I think, the segment function may be a parameter to disconnect this lowercase conversion.
#2

[eluser]Jan_1[/eluser]
May be just doing a step more with str_replace?
http://de2.php.net/manual/en/function.str-replace.php
#3

[eluser]Josepzin[/eluser]
May be replacing uppercases with 2 characters...

Same like A -> _a, B -> _b ... :S
#4

[eluser]Jan_1[/eluser]
yes, sorry, my bad english...
Did you see this one: http://ellislab.com/forums/viewthread/45271/P15/
they do discuss it alike.
#5

[eluser]aquariuz[/eluser]
Maybe this helps.

I use this code to encode a URL if users are not logged in:

Code:
$uri_segments = substr(current_url(), strlen(base_url()));
redirect('login/' . strtr(base64_encode(addslashes(gzcompress(serialize($uri_segments), 9))), '+/=', '-_.'));

And this code to decode:

Code:
$redirect = unserialize(gzuncompress(stripslashes(base64_decode(strtr($redirect, '-_.', '+/=')))));
#6

[eluser]Josepzin[/eluser]
@aquariuz: i like it, i will try it, thanks!

@Jan from Hamburg: my english is really bad, i am Tarzan Tongue




Theme © iAndrew 2016 - Forum software by © MyBB