Jeffro Posted August 30, 2011 Share Posted August 30, 2011 okay.. so I found a list of bad words on line that I want to work into my website's insert. I took the time to create a long comma-delimited list and I'm trying to use this in my page but I keep getting errors. I'm not sure what I'm supposed to be escaping because of the many numerous characters in this list. Might someone help? As I didn't want to post a bunch of foul words on this forum, I posted it here: http://snipt.org/xmpgk You might not want to visit if you don't like bad words. As the list currently is, I'm getting this error: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/jeffro/public_html/all/xyzman/inserttodb.php on line 114 ....right on the line where $newwords begins. Quote Link to comment https://forums.phpfreaks.com/topic/246006-trouble-getting-my-naughty-words-function-to-work/ Share on other sites More sharing options...
Jeffro Posted August 30, 2011 Author Share Posted August 30, 2011 Got it! Turns out that everything in the naughty word list was fine. It was a single quote I forgot on the newwords list that was causing the problem.. when I copied and pasted the last 10 lines. If anyone needs a bad words string replace, here's the working version. http://snipt.org/xmpgl Quote Link to comment https://forums.phpfreaks.com/topic/246006-trouble-getting-my-naughty-words-function-to-work/#findComment-1263405 Share on other sites More sharing options...
QuickOldCar Posted August 30, 2011 Share Posted August 30, 2011 You have 2 spots in the second array where it's missing a quote. Making the second array to replace is the hard way to go about this. http://get.blogdns.com/dynaindex/Safe-Filter/ Here's my bad words safe filter with the code below to give you an alternate way. Quote Link to comment https://forums.phpfreaks.com/topic/246006-trouble-getting-my-naughty-words-function-to-work/#findComment-1263406 Share on other sites More sharing options...
Jeffro Posted August 30, 2011 Author Share Posted August 30, 2011 You have 2 spots in the second array where it's missing a quote. Making the second array to replace is the hard way to go about this. http://get.blogdns.com/dynaindex/Safe-Filter/ Here's my bad words safe filter with the code below to give you an alternate way. Thanks, QuickOldCar. A far different approach. I didn't figure mine was the best but it does work. Appreciate it! Quote Link to comment https://forums.phpfreaks.com/topic/246006-trouble-getting-my-naughty-words-function-to-work/#findComment-1263556 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.