is there an issue with this php unique id generator?

03FHpatria

New Member
This code is what I plan to use for the generation of Uniques codes for tickets.\[code\]// A prefix to avoid uniqid collisions (when invoking this function at the same time).// Should I use mt_rand or just rand?$prefix = str_pad(dechex(mt_rand(0, 0xFFFFFF)), 6, '0', STR_PAD_LEFT);// uniqid with more entropy enabled.$unique_id = uniqid("$prefix-", TRUE);// A SHA-1 hash for the generated code, this way it looks less sequential.$unique_id = sha1($unique_id);\[/code\]It'll be more helpful if you can tell me problems in this code.Thx in advance.
 
Back
Top