Jump to content

Trouble getting my "naughty words" function to work


Jeffro

Recommended Posts

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.

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

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.

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.