|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
I'm alittle stumped on this one
I need to come up with a way, when a person submits a form with a username selection, that if the username is already been choosen, to "suggest" 5 random usernames that haven't been choosen, something like if they where to enter "Mickyd" and it was already taken to have the script generate 5 that are similar but not already in the database. I've seen this done on various membership sites, but not quiet sure how this would be done. Any suggestion or tips would be greatly appreciated! ![]()
__________________
Thunder Rain Internet Publishing Custom Programming & Database development Providing Personal/Business Internet Solutions that work! |
|
#2
|
|||
|
|||
|
Well there is 2 things I can suggest... 1 take the string and add 5 random chars (numbers or letters) on the end with the 'rand' function, then when each is generated check to see if it exists.. if not then store and go onto the next one. The other way I can suggest is if you have a text file full of words, and then take of say the first 3 characters of the username and use the match command to find similiar words?
There is probably a better way of doing it, but what the hell! |
|
#3
|
||||
|
||||
|
Quote:
DropKick, Interesting! I think the first one would probably be the most efficent You wouldn't happen to have a sample code laying around,..by chance?? Mickalo |
|
#4
|
||||
|
||||
|
Hi,
I use Data::Random to generate random data. It is quite a handy module as it can generate numbers, letters, dates, combinations etc. The only limitation I have had has been the length of random data from a single call to the library. It not necessarily the best solution but it works for me ![]() It's on the CPAN (http://search.cpan.org) but I can't get the link at the moment because my stoopid ADSL ISP has got a major cache problem that rotates round sites I access - aargh! ![]() Got there at last ![]() http://search.cpan.org/search?dist=Data-Random
__________________
Robert. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Suggest a Username |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|