Re: generating random id's

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"JeRRy" <jusa_98@xxxxxxxxx> wrote in message 
news:20060209072645.46008.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
>  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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux