This is probably v.easy but my php is very rusty. I need to implement a bad word filter…I currently have this:
if(!in_array($_POST['Name'],$profanities)) { echo $row['Name']; }
…and an profanities array with bad words in it. Problem is I want to be able to check if any portion of the name the user has entered contains one of those bad words….what I’ve currently got only checks if the name is the exact bad word….how do i do this?
thanks
This will match a bad word on its own only… i.e. it will match
badinIs it bad?but not inbaddy. You can remove the word boundaries if you want to match that, or perhaps trystrstr().However, a valid name may contain a substring that is considered bad if you decide to check for simple string matching.
What if I wanted to name my username after my hometown?