deny works

Discussion in 'ASP General' started by Eduardo Rosa, Jan 18, 2005.

  1. Eduardo Rosa

    Eduardo Rosa Guest

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

    thanks a lot
    Eduardo Rosa, Jan 18, 2005
    #1
    1. Advertising

  2. Eduardo Rosa

    Rob Meade Guest

    "Eduardo Rosa" wrote...

    > 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
    Rob Meade, Jan 18, 2005
    #2
    1. Advertising

  3. Eduardo Rosa

    Rob Meade Guest

    > 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
    Rob Meade, Jan 18, 2005
    #3
  4. Eduardo Rosa

    Eduardo Rosa Guest

    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





    "Rob Meade" <> escreveu na mensagem
    news:UOcHd.13151$...
    > "Eduardo Rosa" wrote...
    >
    >> 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
    >
    >
    Eduardo Rosa, Jan 18, 2005
    #4
  5. Eduardo Rosa

    Rob Meade Guest

    "Eduardo Rosa" wrote ...

    > 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
    Rob Meade, Jan 18, 2005
    #5
  6. Eduardo Rosa

    Jeff Cochran Guest

    On Tue, 18 Jan 2005 15:52:35 -0200, "Eduardo Rosa"
    <> wrote:

    >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
    Jeff Cochran, Jan 18, 2005
    #6
  7. Eduardo Rosa wrote:
    > 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.
    Dave Anderson, Jan 18, 2005
    #7
  8. "Rob Meade" <> wrote in message
    news:zGeHd.13257$...
    > "Eduardo Rosa" wrote ...
    >
    > > 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


    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
    Chris Hohmann, Jan 18, 2005
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. \Rob\
    Replies:
    4
    Views:
    3,488
    \Rob\
    May 12, 2004
  2. handlim

    Access deny in Windows XP

    handlim, Oct 28, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    328
    Imtiaz Hussain
    Oct 29, 2003
  3. alex
    Replies:
    0
    Views:
    320
  4. Gene

    Deny Access To A Page

    Gene, Apr 19, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    395
    Cowboy \(Gregory A. Beamer\)
    Apr 19, 2004
  5. Jeff
    Replies:
    2
    Views:
    929
    clintonG
    Sep 19, 2006
Loading...

Share This Page