don't reinvent the wheel.... this just checks to see if there is a bad word in the string... just change eregi to eregi_replace and add in som **s for this to replace the bad ones.
<?
//**************************************************
// Bad_word Function *
// Function to check for rude words etc *
// in a given string. *
// It can easily be broken if a user is *
// determined but should deter the *
// average vandal! *
// Please send any suggestions for *
// additional words to nwilson@mail.dk *
//**************************************************
function bad_word ($intext) {
$check= eregi("fuc?k|[kc]unt|ar[zs]e?hole?|a[sz]?[zs]hole?|face$|pi[zs]?[zs]|@!#$|wank|pric?k|to[zs]?[sz]er|vagina|vaginer|pu[zs]?[zs][yi]|breath|mo?oke?[iy]|stink|bit?ch|bar?[sz]tar?d|s[kc]rew|bal?l[sz]|bol?lo[kc]?[ck][zs]|gonads?|idiot|mole[zs]ter|mole[sz]t|pen[iu][sz]|anu[sz]|coc?k|horrible|dirty?|filthy?|dic?k|head$|slime|kille[rd]|puke|vomit|suck|spastic|spaz|bugg?ery?|(you )|( you )|(u )|( u )|( of?f$)|( of?f )|[asz]{3,}", $intext);
if ($check) {
return TRUE;
exit;
} else { return FALSE;
}
}
?>