A simple way to go about it:
// Make an array of bad words:
$bad_words = array('darn', 'heck', 'poop');
// If you don't want a bad word buried inside a username:
foreach ($bad_words as $word) {
if (strpos($signup_username, $word) !== false) {
echo 'not allowed';
}
}
// If you just don't want username == a bad word:
foreach ($bad_words as $word) {
if ($signup_username == $word) {
echo 'not allowed';
}
}
// Edit:
// Not the way I meant to do the second one.
// Here's a better way:
if (in_array($signup_username, $bad_words)) {
echo 'not allowed';
}
Of course, it's easily defeated. Here's a tutorial on the subject.