Welcome Guest, Not a member yet? Register   Sign In
How To Encode/Decode Encrypted Cookies
#1

[eluser]Christophe28[/eluser]
Hi,

Because of a bug in Flash I have to manually send the value of an encrypted cookie as a post parameter when uploading a file.

The value of the cookie looks a bit like:
Code:
ZXNddf2DN4V8i4Ei/wc9qpADEG1yB1A3BjiW9s/xBlF9+8x7D6+MFAc5yF%2
FWAgw2/ER4klwIPd5ZkBsTzbm+dBDdgRwqb3Hysr3lxNk2o8GG1c4TgLgP1Ci3Ns7Vs6fP
/LGOMC3hfUZOJmA5YcK9pYx1Xb2dGJgVta.......

But when it is send to the server as a post parameter the symbols like % are all taken out.

Is there a way to encode this cookie in JavaScript, send it to the server and decode it at the server?

Thanks for your help!

Christophe
#2

[eluser]Twisted1919[/eluser]
I use base64_encode() and base64_decode() to avoid the problem you describe .
#3

[eluser]Christophe28[/eluser]
Hi,

It works! :-) Thanks!

I'm just wondering one thing ...

To make the code in the application organized, I want to paste encode/decode functions in a separate encoding.js file. But when I call an encoding function from the sitewide.js file, it says it is not defined ...?

Why can't I call functions from another JS file?

Christophe




Theme © iAndrew 2016 - Forum software by © MyBB