|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
I've seen alot of boring forms where a vbscript window will popup if the user submits a bad word in the form. Does anyone know of a tutorial or how to make a bad word filter written in asp that basically goes through an array of bad words and if detected the output would be something like:
<%response.write("Profanity is not allowed.")%> |
|
#2
|
|||
|
|||
|
I would just write a function that returns a boolean value if there is a profanity word in the search:
Function IsProfanity(searchstring) dim blnIsProfane blnIsProfane = FALSE 'create an array of profane words here dim arrProfanity(20) 'or however many words you want to come up with arrProfanity(0) = "badword" ... ... 'now split your searchstring up into an array dim arrSearchString arrSearchString = split(searchstring, " ") 'now loop through every word in your search for i=0 to ubound(arrSearchString) 'now loop through every profane word in your array for j=0 to ubound(arrProfanity) if arrSearchString(i) = arrProfanity(j) then blnIsProfane = TRUE exit for end if next next IsProfanity = blnIsProfane End Function Then if your function returns FALSE, there is no profanity and you can go on with your search. Otherwise, display the message. No guarantees, just off the top of my head. Hope that helps. (sorry i couldn't get the formatting to show in my post) Jill |
|
#3
|
||||
|
||||
|
Hello,
Thank you very much for your help. I was unable to implement your scripting, but I will as I get better with asp. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Filtering: |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|