Encoding/Decoding URL for GET

maple_toast

Newbie
Joined
Jul 23, 2008
Messages
32
Reaction score
54
I thought I found this answer somewhere on here a while back, but now I can't find it.

I'm trying to do a simple base64_encode($url) via an email link. Then pass the variables to the if(isset($_GET statement)). However, it's not working for me.

Is it even possible to do this? To bas64_decode($url) and then GET it?

Thanks all...
 
are you trying to base64 the entire url? or you are trying to do pass the vars like ?vars=$base64ed

if the latter it should work if you say if (isset($_GET['vars'])) then base64_decode($_GET['vars'])

otherwise provide more information if you want help
 
base64 encoding includes the symbols "+" and "=" in the encoded texts (in most, that is)

And that may mess up your URL as the .htaccess generally doesnt allow those symbols in a url.

So replace "+" and "=" with something like "7PLUS7" and "7EQUALS7" and then pass it through, then when $_GETing it, replace "7PLUS7" etc with the symbol then decode that.

Enjoy!
 
base64 encoding includes the symbols "+" and "=" in the encoded texts (in most, that is)

And that may mess up your URL as the .htaccess generally doesnt allow those symbols in a url.

So replace "+" and "=" with something like "7PLUS7" and "7EQUALS7" and then pass it through, then when $_GETing it, replace "7PLUS7" etc with the symbol then decode that.

Enjoy!

Thanks!!!
 
Use 'rawurlencode' for encoding URLs, it handles spaces correctly for that purpose
 
Back
Top