Checking for "dirty" words

Results 1 to 4 of 4

Thread: Checking for "dirty" words

  1. #1
    Join Date
    Dec 1969
    Posts
    150

    Default Checking for "dirty" words

    I am designing a site that accepts user input that may eventually be displayed to other users. Thus, I want to prevent users from entering socially unacceptable words. Does anyone know of a routine or component that checks user input for the presence of such undesirable words?

  2. #2
    Join Date
    Dec 1969
    Posts
    190

    Default RE: Checking for

    If InStr(1, yourstring, dirtyword, 1) Then<BR> Uh oh!<BR>Else<BR> OK<BR>End If

  3. #3
    Join Date
    Dec 1969
    Posts
    1,315

    Default RE: Checking for dirty

    how about<BR><BR>sub dirtycheck<BR>dim sql<BR>dim RS<BR>dim conn<BR>dim dirty<BR><BR> set Conn = server.createobject("ADODB.Connection")<BR> Conn.ConnectionString = "DSN=dirtytable"<BR> Conn.open<BR><BR> sql = "select dirtyword from dirtylist"<BR> set RS = conn.execute(sql)<BR><BR> dirty = false<BR> while ((not (RS.eof)) and (not(dirty)))<BR> if InStr(1, yourstring, RS("dirtyword"), 1) then<BR> dirty = true<BR> end if<BR> RS.movenext<BR> wend<BR><BR> if dirty then<BR> &#039dirty word handler<BR> end if<BR><BR> RS.close<BR> Conn.close<BR> set RS = nothing<BR> set Conn = nothing<BR>end sub<BR><BR><BR>this requires a table in your database called dirtylist with a column called dirtyword...siply load this column with all the words you want to check for.<BR><BR>i hope this code works...i haven&#039t checked the syntax ;)<BR>cheers<BR><BR>John<BR><BR>jwalker@cit.nepean .uws.edu.au

  4. #4
    Join Date
    Dec 1969
    Posts
    915

    Default RE: Checking for

    Here is a javasvcript that may help you out without having to change your DB Model.<BR><BR>/* This routine does not create an alert box. Instead<BR> it simply replaces any words you decide are offensive<BR> at your Web Site with curse symbols. The "smut" string<BR> may be replaced with "xxx" or anything you deem more<BR> appropriate. The "cmp" string should be comprised only<BR> of words you don&#039t wish to appear in postings or<BR> submissions at YOUR Web Site. If you<BR> lengthen or shorten the list, be sure to change the<BR> stop number in the "for" loop (i&#060;7 here, because there are 7 <BR> words in the list.<BR> Don&#039t forget a space after the last word in your own<BR> list of "forbidden" words. */<BR><BR>function CheckFormField1() {<BR> smut="!@#$%&*";<BR> cmp="sex babes porno "<BR> +"asshole pedophile man-boy man/boy "<BR> +"&#039 ";<BR> txt=document.Request_Form.Form_Field.value;<BR> tstx="";<BR> for (var i=0;i&#060;7;i++){<BR> pos=cmp.indexOf(" ");<BR> wrd=cmp.substring(0,pos);<BR> wrdl=wrd.length<BR> cmp=cmp.substring(pos+1,cmp.length);<BR> while (txt.indexOf(wrd)&#062;-1){<BR> pos=txt.indexOf(wrd);<BR> txt=txt.substring(0,pos)+smut.substring(0,wrdl)<BR > +txt.substring((pos+wrdl),txt.length);<BR> }<BR> }<BR>}


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •