How to force username format?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

djdubuque
Forum Newbie
Posts: 10
Joined: Sat Sep 12, 2009 6:53 pm

Re: How to force username format?

Post by djdubuque »

jackpf wrote:
What are these "requirements"? What have you tried?
They seem like pretty self explanatory questions to me....

Does this not explain the requirements?
if username = xyz123 then continue
if username = xyzabc then echo "this username does not conform to this forums registration requirements!
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: How to force username format?

Post by jackpf »

No. You've given an example of an acceptable username, and an example of an unacceptable username. You've not explained what the format should be though.

That's like me saying to you, the answer to a sum is 5, and not 4. What's the sum?
djdubuque
Forum Newbie
Posts: 10
Joined: Sat Sep 12, 2009 6:53 pm

Re: How to force username format?

Post by djdubuque »

Code: Select all

// word in username too long?
       $too_long_word = too_long_word($new_user_name,$settings['name_word_maxlength']);
       if($too_long_word) $errors[] = 'error_word_too_long';
 
       // look if name already exists:
       $name_result = mysql_query("SELECT user_name FROM ".$db_settings['userdata_table']." WHERE lower(user_name) = '".mysql_real_escape_string(my_strtolower($new_user_name, $lang['charset']))."'", $connid) or raise_error('database_error',mysql_error());
       if(mysql_num_rows($name_result)>0) $errors[] = 'user_name_already_exists';
       mysql_free_result($name_result);
Can this be changed to include what I'm asking?
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: How to force username format?

Post by Eric! »

This is the best thread ever.
djdubuque wrote:Can this be changed to include what I'm asking?
Yes it can. But we can't help you because no one can understand what you want it to do. Please explain your requirements. What is a "good" username and what is a "bad" username? Your examples don't tell us anything.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: How to force username format?

Post by superdezign »

Google Regular Expressions and leave us be.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: How to force username format?

Post by jackpf »

Innapropriate -- Removed by Jcart
djdubuque
Forum Newbie
Posts: 10
Joined: Sat Sep 12, 2009 6:53 pm

Re: How to force username format?

Post by djdubuque »

jackpf wrote:nnapropriate -- Removed by Jcart

If you have nothing to contribute to this discussion, please leave your useless comments to yourself!
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: How to force username format?

Post by superdezign »

djdubuque wrote:
jackpf wrote:Innapropriate -- Removed by Jcart

If you have nothing to contribute to this discussion, please leave your useless comments to yourself!
The urge to say "likewise" to you is so tempting. >.>
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: How to force username format?

Post by jackpf »

:yar:
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: How to force username format?

Post by John Cartwright »

I knew I should have locked this previously. Locked.
Locked