PDA

View Full Version : random value generation


raf
10-11-2002, 11:50 AM
It might sound stupid buth I can't afford to mee this up or I'll have a loot of problems later.

I've got a registration form with the ICQ-number as an optionnal field. If the user leaves it blank, my asp validationscript fills in a value (99999999999999 or something like that).

Before I register the new user I preform a check to make sure no other visitor uses the same username, email-adres or ICQ number.

My problem:
- I cant assign the same number to blank ICQ field (duplication is not allowed in my db and in my script)
- I don't want to make a databaseconnection to simply generate the "dummy" ICQ-number
- I'd rather not build in an "if then else" statement (to differently proces forms with ICQ field filled in or blanked)

Any one has an idea to get out of this ?


Thanks

fractalvibes
10-11-2002, 06:29 PM
Could you store the session id (or a portion of it)
in the case that the ICQ number is left blank???

raf
10-14-2002, 12:56 PM
that's maybe an option. i haven't desided yet because i'm still thinking about storing something meaningfull into it (like converting time and date into a number or something). thanks

fractalvibes
10-14-2002, 03:34 PM
Yes, that sounds like another decent option. I'd suggest that if you use the timestamp. perhaps append a randomly-generated
integer onto it to guarantee uniqueness, as I think the timestamp
in ASP is just granular down to the second.