This sounds like a job for [MAN]eregi()[MAN]
You would need to have a pre-defined list of disallowed words saved in a fashion that eregi() could work with. Maybe in a table, in a file (word1, word2, word3,...). If the list of disalowwed words is short, it wouldn't be a problem to loop through them and check your user input.
Maybe use eregi_replace(), your could repalce the disallowed words with **** or &%%# or whatever you like!