fuzzyDCR Posted March 18, 2011 Posted March 18, 2011 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. Quote
Danny696 Posted March 18, 2011 Posted March 18, 2011 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. Quote
bluegman991 Posted March 18, 2011 Posted March 18, 2011 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');} Quote
fuzzyDCR Posted March 18, 2011 Author Posted March 18, 2011 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. Quote
Danny696 Posted March 18, 2011 Posted March 18, 2011 Yeh, i edited my post, dont use the wildcard, it wont work :/ Quote
bluegman991 Posted March 18, 2011 Posted March 18, 2011 well i cant tell you where cuz i dont know how that page looks but instead of using preferences.php you could delete that and use a mod i made a while ago account.php Quote
fuzzyDCR Posted March 19, 2011 Author Posted March 19, 2011 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 Quote
Danny696 Posted March 19, 2011 Posted March 19, 2011 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. Quote
Paul Evans Posted March 19, 2011 Posted March 19, 2011 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()); } Quote
bluegman991 Posted March 19, 2011 Posted March 19, 2011 mwg's bbcode parser is messing up the input and output of my code so you will have to download the zip in my original thread Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.