Re: Random Unique ID
| From: | Robert Cummings | Date: | Sat, 24 Mar 2007 13:13:45 +0000 |
| Subject: | Re: Random Unique ID | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-251279@lists.php.net to get a copy of this message | ||
On Sat, 2007-03-24 at 08:24 -0400, Jim McIntyre wrote:
> IIRC, the OP wanted to generate a unique key precisely to keep from
> revealing the record ID to the end user... what about taking the
> auto_increment value (easy to generate, assured to be unique) adding its
> MD5 hash to another column in the table, then using that as the
> "published" ID?
>
> The only disadvantage I see is that the MD5 hash isn't very
> human-friendly, so using it for an account or member number, or something
> like that the user might have to write down or read to a customer service
> rep on the phone, might be difficult.
It's more likely that he wants the unique ID so that he can serve up a
document or image such that other documents or images can't be retrieved
just by incrementing the ID in the URL.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'