You are here: Re: cookie spec « PHP Programming Language « IT news, forums, messages
Re: cookie spec

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация