Welcome Guest, Not a member yet? Register   Sign In
Generating Unique ID
#11

[eluser]Michael Wales[/eluser]
100% accepted - I completely understand the benefit of offering multiple ways of doing something. It was how you offered that other view - which was one of the rudest things I have ever seen grace these forums and that behavior has no place in our community.

We are a community of professionals, even the hobbiests, act in a professional manner. This doesn't mean you can't have fun but we all respect one another. I advise you to do the same.
#12

[eluser]Randy Casburn[/eluser]
Listen, I apologized. And then you become pretentious enough to lecture me about "being professional" and "respecting each other" immediately after calling me a smart ass. Confusing.

Let's just agree that we're likely not to see eye-to-eye on things.

Please carry this to PMs if you have anything further.
#13

[eluser]xwero[/eluser]
I have to agree with Randy on this. uniqid() or UUID are the things to use if you want a unique hash.

And for the question of the length i wonder why it needs to be 5 characters? Do people have to remember the filename?

Michael you use the database to check the uniqueness. Why not check the uniqueness per directory. Using the database also limits the script to a certain framework or database abstraction layer. I think it's better to keep the script to the level of file structure, this way it's more reusable.
#14

[eluser]wiredesignz[/eluser]
I have to agree with xwero (and Randy) on this, I can't see the point in using only a 5 character unique_id (not very unique). Randy's example is far better, because the result is 13 characters.

Also Michael's while() loop is a terrible performance hit.
#15

[eluser]Michael Wales[/eluser]
Yeah, if I were going about it, I would use uniqid() as well and it's good Randy offered that suggestion. My solution was taking into account Kemik's original post:
Quote: was looking for a 5 character string consisting of alphanumeric characters, both upper and lower.
#16

[eluser]xwero[/eluser]
I've read over response 3. Kermiks idea is to add the unique string to the url making it possible to url hack your own files. Remembering a random string of 5 characters is as hard as remembering a 13 character string if you upload a bunch of files. People have password managers remembering passwords they choose, how are they going to remember the filename if it isn't descriptive?

I understand you wanted to honor the original request but i think you should go beyond the request to provide a better way to do things.




Theme © iAndrew 2016 - Forum software by © MyBB