Re: Shorten String or encode/decode a string
| From: | Christian Reiniger | Date: | Fri, 04 May 2001 10:29:21 +0000 |
| Subject: | Re: Shorten String or encode/decode a string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51391@lists.php.net to get a copy of this message | ||
On Thursday 03 May 2001 21:25, Jared Howard wrote:
> I want to shorten a string that I'll be throwing through the url. It's
> not so much that it's too long, but it's ugly. What it is, is my query
> string that I need to pass through to different pages, i.e. viewing
> multiple pages. Anyway, I was looking at encode and decode features but
> not really sure that they could shorten it down significantly. Now I
> understand that I won't be able to use it, but I tried the crypt()
> function and liked how small it made it. The string information
*g* Yess, crypt() even manages to crunch down megabytes of data to about
10 bytes.
The problem is that it is a one-way function, i.e. you can't decrypt the
data afterwards (it's a kind of checksum generator)...
You should use sessions or something similar - instead of passing all the
data around on each request, store it in a database and just pass around
the record ID
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
..to paraphrase Churchill, while representative democracy may be
terrible, it's still the best system that large corporations can buy.
- David Weinberger JOHO January 25, 2000