generating random id"s
am 09.02.2006 08:26:45 von jusa_98
--0-946662220-1139470005=:45758
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Just to let you all know I used PHP's unique ID generator to generate a unique id for tracking purposes. I than md5 it hide the format a bit, would this be enough? Or can be easily worked out also? Need it pretty tight and keeping the likelyhood down of having multiple listings of id's. It's using 32 chars.
Jerry
--0-946662220-1139470005=:45758--
Re: generating random id"s
am 09.02.2006 18:08:14 von Dan Baker
"JeRRy" wrote in message
news:20060209072645.46008.qmail@web34806.mail.mud.yahoo.com. ..
>
> Just to let you all know I used PHP's unique ID generator to generate a
> unique id for tracking purposes.
> I than md5 it hide the format a bit, would this be enough?
> Or can be easily worked out also?
> Need it pretty tight and keeping the likelyhood down of having multiple
> listings of id's.
> It's using 32 chars.
So, I'm guessing/interpreting here:
You have a table that has records in it, each record has a unique ID (an
auto-increment field).
You want to be able to send some magic ID with an html page, so that you can
identify the record when the page response comes back. But, you don't want
the end-user to easily alter the ID to discover a different record.
Now, I don't have a clear understanding of what you have doe with the "32
char" item:
Idea #1) You have added another field "RndID" which you generate for each
record, and use this as the published record ID.
Idea #2) You take the ID, and mangle it, and use the mangled ID as the
published record ID. When it comes back, you un-mangle it to get the true
ID.
I've used idea #1 before. I set the RndID field as "Unique", so I never
have duplicates. If the record update fails, I generate a different random
ID and try again.
I've never used idea#2.
DanB
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: generating random id"s
am 09.02.2006 18:40:54 von Miles Thompson
At 03:26 AM 2/9/2006, JeRRy wrote:
>
> Just to let you all know I used PHP's unique ID generator to generate a
> unique id for tracking purposes. I than md5 it hide the format a bit,
> would this be enough? Or can be easily worked out also? Need it pretty
> tight and keeping the likelyhood down of having multiple listings of
> id's. It's using 32 chars.
>
> Jerry
Yes, I've done something similar. Used the random number generator and
chr()'d anything that's printable ascii, looping until I have the desired
length, then md5'd it.
It works and generates a peculiar value.
Miles
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 267.15.3/254 - Release Date: 2/8/2006
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php