Gossamer Forum
Home : Products : DBMan : Customization :

Random key

Quote Reply
Random key
Hello! After a whole evening of searching the forum, I decided to post this question.

How can I produce a random ID? I want to use it with the upload mod. The upload mod produces a directory that corresponds to the Dbman ID of the record.

I want dbman to produce random ID/directory names that look like "3E589D".

Any suggestions?
Greetings, Michael
Quote Reply
Re: [Muhe] Random key In reply to
I know there are modifications to pad the ID number with zeros and also another to add a prefix to the number, but haven't seen anything that would generate a random number.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [Muhe] Random key In reply to
Do a google search on "Perl" and "Rand". You can create a random number (dbman does it to generate your user_id or uid) it is in auth.pl under check password. here is the section:

Code:

srand( time() ^ ($$ + ($$ << 15)) ); # Seed Random Number
$db_uid = "$userid." . time() . (int(rand(100000)) + 1);# Build User Id

You could possibly hack this section for your purposes?