Jump to content
MakeWebGames

Usernames/AdminNames - Stop people from using certain ones, and stop people from having the same names


Recommended Posts

Posted

So today some people decided to have some fun on my game and everyone changed there name to the same...Like 15 people...I tried to figure out a way to stop this from happening and couldn't figure it out. Any help would be great. I would also like to be able to prevent people from using certain names in general, or even have certain words in there names...Like Admin...Right now i have the name ADMIN blocked, but can't figure out how to make it so they cant put stuff like Admin-Brad, or Admin-God, or Adminsdeath. Any help if great enough will be compensated.

Posted

In preferences, for the username change, and register

Just do a simple query to chekc if the name is taken

Ten a simple if to check it, if its taken tell them, kill the script.

Posted

firstly i would stop people from using names already in use like this

 

if($db->num_rows($db->query("SELECT `userid` FROM `users` WHERE `username`='$_POST[username]'"))){die('username already in use');}

 

second if you dont want people to have "admin" in there name u should do it something like this

 

if(substr_count($_POST['username'],'admin')){die('Admin is not allowed in your name');}
Posted

I understand how, i just can't figure out where. When ever I do anything in the preferences it doesnt work. I tried doing it with wildcard, and the way posted above, and I must be doing it in the incorrect spot.

Posted

hmmm...I get errors using that code...

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/wereatw1/public_html/account.php on line 44

Posted

Let me put it in laymans....

Oi, you've made me error. Theres a problem with your syntax. I've just checked it, there was meant to be a coma or semi colon (more likely the later), but instead there was a variable. Just to help you its in account.php, and its on line 44.

Posted

Mc v2.0.3 has this in preferences

	$check_ex = $db->query('SELECT `userid` FROM `users` WHERE `username` = "'.$_POST['newname'].'"');
   if ( $db->num_rows($check_ex) > 0 ) {
  echo '
This username is already in use.

> [url=""]Back[/url]
  ';
  die($h->endpage());
   }

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...