Chris Foote
New member
I've created a very simple PHP filter, designed to filter abusive language from an online form. I've posted the code below. The problem is that I can't figure out how to add another word to the existing code (obviously there are hundreds of words which will need to be included and I'd rather not create a separate if statement for each word).
Here's the code:
if (strpos($comments, "apples") !== false)
{header( "Location: $fail" );
}
Thanks
That's great, but I don't need to know how to create a filter. My filter works. I need to know how to add another word ("oranges", for example) to the code I've posted (I'd thought something like ($comments, "apples", "oranges") would work, but no luck).
Thanks for the suggestions, but I don't really need them. The code I've posted does exactly what it needs to and it's been exhaustively tested (although I admit there are better ways to do it, in this case simplicity is more important than functionality). I only need to know how to add another word to the code.
Here's the code:
if (strpos($comments, "apples") !== false)
{header( "Location: $fail" );
}
Thanks
That's great, but I don't need to know how to create a filter. My filter works. I need to know how to add another word ("oranges", for example) to the code I've posted (I'd thought something like ($comments, "apples", "oranges") would work, but no luck).
Thanks for the suggestions, but I don't really need them. The code I've posted does exactly what it needs to and it's been exhaustively tested (although I admit there are better ways to do it, in this case simplicity is more important than functionality). I only need to know how to add another word to the code.