Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > deny works

Reply
Thread Tools

deny works

 
 
Eduardo Rosa
Guest
Posts: n/a
 
      01-18-2005
Hi people,
Somebody knows where I can get a tutorial, or any help, to make "deny words"
in my forum?

thanks a lot


 
Reply With Quote
 
 
 
 
Rob Meade
Guest
Posts: n/a
 
      01-18-2005
"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 )

Regards

Rob


 
Reply With Quote
 
 
 
 
Rob Meade
Guest
Posts: n/a
 
      01-18-2005
> 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


 
Reply With Quote
 
Eduardo Rosa
Guest
Posts: n/a
 
      01-18-2005
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" <(E-Mail Removed)> escreveu na mensagem
news:UOcHd.13151$(E-Mail Removed). uk...
> "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 )
>
> Regards
>
> Rob
>
>



 
Reply With Quote
 
Rob Meade
Guest
Posts: n/a
 
      01-18-2005
"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





 
Reply With Quote
 
Jeff Cochran
Guest
Posts: n/a
 
      01-18-2005
On Tue, 18 Jan 2005 15:52:35 -0200, "Eduardo Rosa"
<(E-Mail Removed)> 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
 
Reply With Quote
 
Dave Anderson
Guest
Posts: n/a
 
      01-18-2005
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.


 
Reply With Quote
 
Chris Hohmann
Guest
Posts: n/a
 
      01-18-2005
"Rob Meade" <(E-Mail Removed)> wrote in message
news:zGeHd.13257$(E-Mail Removed) k...
> "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!,b umper,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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie: allow deny vs deny allow Jeff ASP .Net 2 09-19-2006 02:12 AM
When I turn on my PC, it works, works, works. Problem! Fogar Computer Information 1 01-17-2006 12:57 AM
Domain controller GPO does not deny logon locally right to IWAM_machinename when running aspnet.wp.exe \Rob\ ASP .Net 4 05-12-2004 12:13 AM
After rebooting my PC works, works, works! Antivirus problem? Adriano Computer Information 1 12-15-2003 05:30 AM
permit only outbound icmp requests and inbound replies, deny other Mark Matheney Cisco 1 12-10-2003 02:00 PM



Advertisments