Log in

View Full Version : PHP Username Suggestion



NeilWilliams
11-15-2006, 10:51 AM
I wonder if someone could help.

Im looking for some code to use (preferrablly php) wwhich will link t my MySql database.

What i am trying to do:

1. Someone enters their name, first and last.
2. They create a username, for use on a site.
3. The username is taken, so the page shows a few options that are available, which basially is a return mix of their first and last name and a random number.

I suppose for an example, its a bit like the username suuggestions found on the ebay page.
https://scgi.ebay.co.uk/ws/eBayISAPI.dll?RegisterEnterInfo&ru=http%3A//www.ebay.co.uk

havlf way down, where you check availability of usernames and if taken a selection are automatically returned to the user.

Anyone have any ideas, or can point me the right dirctio where i can find the code for this sort of thing??

Would be greatly appreciated
regards
Neil

djr33
11-15-2006, 11:10 AM
I personally hate the suggestions. They just don't ever fit what I want.

It's not that complex, in theory.

I think the best way is to general a name... like...
$suggestion = $first.$last.rand([params]);

that would give you something like johnsmith42

then you would want to check that against a database to see if it too was taken.

There are various ways you could rearrange the name.

I would also consider using their first choice username to generate a suggested username as opposed to using their actual name, since that is likely to be closer t what they want.

NeilWilliams
11-15-2006, 12:26 PM
hi,
Thanks

Is there anywhere i might find an example of this working, in code?

Regards
Neil

djr33
11-16-2006, 09:06 AM
It's very specific overall.

How does it interact with the database, for example?

Post the code you have and we could help you include this step in it.