deny works

E

Eduardo Rosa

Hi people,
Somebody knows where I can get a tutorial, or any help, to make "deny words"
in my forum?

thanks a lot
 
R

Rob Meade

...
Hi people,
Somebody knows where I can get a tutorial, or any help, to make "deny words"
in my forum?

Hi,

Depends how you want to do it - I did something similar for 'ignore words'
for searches, in my case I loaded in some 390 common words from an excel
spreadsheet into SQL server, I then populate an array with these one the
relevant page, and then ignore them etc...

Not sure whether you'd want to do this upon submission of the post and then
replace them with say nothing, or **** them out or something, but the same
process would apply...a simplistic example could be:
<%
Dim aIgnoreWords(3)

aIgnoreWords(0) = "bottom"
aIgnoreWords(1) = "arse"
aIgnoreWords(2) = "bum"

strPostContent = "I have a really large bottom, my bum is huge, its the
largest arse I've ever seen!!!"

Response.Write "Before tidy up: " & strPostContent
Response.Write "<br><br>"

For intLoop = 0 To (UBound(aIgnoreWords)-1)

strPostContent = Replace(strPostContent, aIgnoreWords(intLoop), "***")

Next intLoop

Response.Write "After tidy up: " & strPostContent
%>

I hope this helps, by the way it's untested but should give you a pointer in
the right direction, and perhaps a little smile :eek:)

Regards

Rob
 
R

Rob Meade

For intLoop = 0 To (UBound(aIgnoreWords)-1)
strPostContent = Replace(strPostContent, aIgnoreWords(intLoop), "***")

Next intLoop


Just spotted this - sorry, remove the intLoop part from that last line - so
it reads:

For intLoop = 0 To (UBound(aIgnoreWords)-1)

strPostContent = Replace(strPostContent, aIgnoreWords(intLoop), "***")

Next


Regards

Rob
 
E

Eduardo Rosa

thanks Rob

that's some like that, but I need a smarter code that don't replace words
like sit (sit down) from site (website).

thanks again
 
R

Rob Meade

...
that's some like that, but I need a smarter code that don't replace words
like sit (sit down) from site (website).

You'll need to stick a space on either end then to make it a seperate
word...

<%
Dim aIgnoreWords(3)

aIgnoreWords(0) = "bottom"
aIgnoreWords(1) = "arse"
aIgnoreWords(2) = "bu" ' NOTE - I've changed this so that it shouldn't
spot bum in the sentance

strPostContent = "I have a really large bottom, my bum is huge, its the
largest arse I've ever seen!!!"

Response.Write "Before tidy up: " & strPostContent
Response.Write "<br><br>"

For intLoop = 0 To (UBound(aIgnoreWords)-1)

strPostContent = Replace(strPostContent, chr(32) & aIgnoreWords(intLoop)
& chr(32), "***")

Next

Response.Write "After tidy up: " & strPostContent
%>

The chr(32) & aIgnoreWords(intLoop) & chr(32) puts a space either end of the
word matching.

Note - when I did this for my searching I had to go down the road of all
punctuation also, ie. (_ = space in the following example),

_bum_
_bum!
_bum.
_bum?

and so on...

Thats for the end of a sentance, you could of course have the same at the
start of a sentance, thus...

_bum_
bum_
..bum_
?bum_
!bum_

you should also decide whether you are concerned about case sensitivity, ie

LCase / UCase to add to the above...

Hope this helps,

Rob
 
J

Jeff Cochran

Somebody knows where I can get a tutorial, or any help, to make "deny words"
in my forum?

It's rather simple, but depends on where you want to deny them, how
you want to deal with them if denied, etc. For example, instead of
"damn" you could either disallow the word and remove it, disallow the
word and force the user to change the post before it's accepted, or
accept the word but replace it with a different word such as "darn" or
asterisks such as "****".

Best tutorial would be to grab a few of the open source or freeware
forum scripts that exist and review the methods and coding they use.
You can learn a lot by looking at other people's code. Including the
wrong way to do things. :)

Jeff
 
D

Dave Anderson

Eduardo said:
thanks Rob

that's some like that, but I need a smarter code that don't replace
words like sit (sit down) from site (website).

Of course, that means you will have to filter both "frell" and "frelling"
(not to mention "frelled").



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
C

Chris Hohmann

Rob Meade said:
...


You'll need to stick a space on either end then to make it a seperate
word...

<%
Dim aIgnoreWords(3)

aIgnoreWords(0) = "bottom"
aIgnoreWords(1) = "arse"
aIgnoreWords(2) = "bu" ' NOTE - I've changed this so that it shouldn't
spot bum in the sentance

strPostContent = "I have a really large bottom, my bum is huge, its the
largest arse I've ever seen!!!"

Response.Write "Before tidy up: " & strPostContent
Response.Write "<br><br>"

For intLoop = 0 To (UBound(aIgnoreWords)-1)

strPostContent = Replace(strPostContent, chr(32) & aIgnoreWords(intLoop)
& chr(32), "***")

Next

Response.Write "After tidy up: " & strPostContent
%>

The chr(32) & aIgnoreWords(intLoop) & chr(32) puts a space either end of the
word matching.

Note - when I did this for my searching I had to go down the road of all
punctuation also, ie. (_ = space in the following example),

_bum_
_bum!
_bum.
_bum?

and so on...

Thats for the end of a sentance, you could of course have the same at the
start of a sentance, thus...

_bum_
bum_
.bum_
?bum_
!bum_

you should also decide whether you are concerned about case sensitivity, ie

LCase / UCase to add to the above...

Hope this helps,

Rob

He's a solution using regular expressions, retooled from this article:
http://aspfaq.com/show.asp?id=2344

<%
CONST s = "arsenal,arse,_arse_,bellbottoms,bottom,!bottom!,bumper,bum,.bum."
Dim re : Set re = New RegExp
re.Pattern="(^|[^a-z])(arse|bottom|bum)([^a-z]|$)"
re.IgnoreCase=True
re.Global=True
Response.Write re.Replace(s,"$1***$3")
%>

HTH-
Chris Hohmann
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top