Wow that is huge, you should look into while loops and $istok, loop through every word in $1- and check if they're in a badwords list/variable.