Posted by Toby A Inkster on 05/18/07 07:43
Jon Slaughter wrote:
> What I'm essentially doing is encrypting the name/data then encoding it
> using base64 but base64 uses the special characters +, /, and =. They seem
> to be causing problems with the cook being written or read. I have mapped
> the ='s into _ and can map the + into - because I think those work for
> cookies but I am not sure... and then I have the issue with the /. (which
> I'm thinking of using _ for it too but have to handle the case where it
> occurs at the end of the string to be encoded(Which will cause it to be
> confused with the padding).
Have you thought instead of using:
$encoded = urlencode(base64_encode($data));
This should create a string consisting of only alphanumeric data and '%'.
To go back the other way:
$data = base64_decode(urldecode($encoded));
--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux
Navigation:
[Reply to this message]
|