The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Random Number, if duplicate?
Code:
<?php srand ((double) microtime( )*1000000); $random_number = rand( ); echo "$random_number"; ?> I can tell MySQL to keep it unique, but I don't want an error page. I want to keep errors to a minimum. Thank you for the help. I was thinking of a loop to check if it exists until it finds a unique number and end the loop before it spits out the page with the code in a hidden field. I just don't know what codes to use. >_< |
#2
|
|||
|
|||
What are you trying to do with this?
|
#3
|
||||
|
||||
Well, I want this for a gallery. When someone makes an album, the random number generator would create a number. The user would have to keep this to go back to view the album. Kind of like a passcode... key kinda thing.
|
#4
|
|||
|
|||
Why not just use mysql's auto_increment attribute, which adds a unique identifer to table rows?
|
#5
|
||||
|
||||
Well, I don't want single digit keys. Otherwise, random people will just type 1, 2, 3, 4, 5...and have access where they're not suppose to be.
|
#6
|
|||
|
|||
So you want to make it that anybody that want to view an album needs a password? Or just the original owner of the album when they want to edit it?
|
#7
|
||||
|
||||
If the users types in the correct passcode, they can view the album.
|
#8
|
|||
|
|||
And how will they get that password?
Wouldn't it be easiest if you let the user who creates the album just let choose a password? |
#9
|
||||
|
||||
It would be emailed to them.
lol I have it figured out. I just want to know how to keep it from duplicating; if it ever happend. |
#10
|
||||
|
||||
Why does it matter if you happen to get a duplicate ?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|