Badword Array Replacement [SOLVED]
Posted: Thu Jun 01, 2006 11:00 am
Can someone help me with this. I want the following PHP code to look at the variable $username_bad_check which is equal to the $username (in this case 'ass12345'). If it finds any of the words in the $badwords array. Then it displays the message.
Code: Select all
<?php
$username = 'ass12345';
$username_bad_check = $username;
$username_bad_check = strtolower($username_bad_check);
$username_bad_check = " ".$username_bad_check." ";
// Array, Badword, Goodword
// Goodword is not used.
$badwords = array();
$badwords[] = array('ass', ' * ');
if($username_bad_check == $badwords){
echo "OH NO YOU DIDN\'T. We have found a bad word in your username\! You may have put something bad in by mistake, but remember if you use bad words\* on our site.<br><br><Br>*The term \"Bad Word\" refeers to a curse words, an explicit words, or any other inappropriate word, or word we find to be inappropriate.";
}
?>