asmith Posted December 31, 2007 Share Posted December 31, 2007 have you guys ever have experience not allowing offensive words as a for example username ? if i want to not allow the user choose an offensive word as his username , what should i do ? got a better idea than checking it through a list of words ? Quote Link to comment https://forums.phpfreaks.com/topic/83819-solved-offensive-words/ Share on other sites More sharing options...
rajivgonsalves Posted December 31, 2007 Share Posted December 31, 2007 You will have to check it through a list of words... because that would be your definition of offensive words Quote Link to comment https://forums.phpfreaks.com/topic/83819-solved-offensive-words/#findComment-426500 Share on other sites More sharing options...
marcus Posted December 31, 2007 Share Posted December 31, 2007 <?php $username = "marcus"; $bad = array('fuck','ass','rape'); foreach($bad AS $duh){ if(preg_match("/$duh/is",$username)){ $err = 1; } } if($err){ echo "Invalid username!\n"; }else { echo "Nice username! -wink-\n"; } With username -> marcus Nice username! -wink- With username -> marcusfuck Invalid username! Quote Link to comment https://forums.phpfreaks.com/topic/83819-solved-offensive-words/#findComment-426505 Share on other sites More sharing options...
asmith Posted December 31, 2007 Author Share Posted December 31, 2007 thanks , anyway is the common thing ? you do on your sites too ? or let the user be free? Quote Link to comment https://forums.phpfreaks.com/topic/83819-solved-offensive-words/#findComment-426509 Share on other sites More sharing options...
marcus Posted December 31, 2007 Share Posted December 31, 2007 Let them submit the username, and you find a cruel punishment for them Quote Link to comment https://forums.phpfreaks.com/topic/83819-solved-offensive-words/#findComment-426511 Share on other sites More sharing options...
asmith Posted December 31, 2007 Author Share Posted December 31, 2007 lol i like the idea !! easier and more fun Quote Link to comment https://forums.phpfreaks.com/topic/83819-solved-offensive-words/#findComment-426516 Share on other sites More sharing options...
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.