Preventing silly or not allowed user names

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
User avatar
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Preventing silly or not allowed user names

Post by shasta59 » 2013-06-02 15:37

Do you wish to prevent users from using certain user names?

There are two ways to do this. There could be more but I have only tried two.

Method 1:

Easiest but time consuming - create users, as admin, with the usernames you do not want used. For example, on one site for baseball umpires the following users have been created to prevent their usage by others - mostly to prevent squabbles from happening :

and a bunch of others are also created.

Method 2:

The other method (much faster but coding changes needed), and this is an overview only not the actual code I used - I may post it later when I have a chance to test it in generic situations.

In the membership_signup.php file you can find a function: function checkUser(){

This points you to the checkMemberID.php file where the actual checking takes place. As you can see all it is is a select function searching for the new username being requested.

What I have done is add code to this to check another table in the same database where I can enter names I do not wish used. This is faster as it does not require creating the user etc. I just enter a list of names. The new table only has two fields, id and disallowed_user_names. The code in checkMemberID.php is just an addition to the existing if statement. The checkMember file now checks in two places. First existing user names. If no match found it next checks the table which has a list of usernames which are not to be used or are banned. I keep a list of names in an Excel sheet and it is easy to import as a csv file into the database.

Steps: (for setting up Method 2 - no code given at this time)

In appgini create an additional table with the following fields:

disallowed user names

Then in checkMemberID.php add in the necessary code to have it check this table also for banned user names.

Code for this will follow once I get a chance to check it for generic usage. I tend to put in extras in my code for my situations so cannot copy/paste it in and do not like doing that until I check it for generic any database usage.

Hope this helps someone or show what is possible with a little behind the scenes work.

Calgary, Alberta, Canada - Using Appgini 5.50 -

Post Reply