Block unwanted postings.. - Posted (874 Views)
Starting Member
Presario
Posts: 46
46
Please forgive me if this has already been asked in the past (Ive tried looking but cant find anything.).
I am trying to write a little script into the forum which will STOP any postings about a certain football/soccer team (local team I may add and not a professional club)..
Obviously the script will need to check the input box where the message is being written in and when submitted a warning will appear telling the user his/her posting WILL NOT be accepted.
I know I can use the bad word filter but this doesnt really do want I want.

I need to STOP the posting happening and the user being redirected either back to the posting screen OR back to the main forum index.
If anyone could help with this then I would be indebted..
<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Starting Member
Presario
Posts: 46
46
Right, I have got close to what I need to achieve :


select case MethodType case "Topic", "EditTopic", "TopicQuote", "Reply", "Edit", "ReplyQuote"
postTxt = trim(Request.Form("Message"))
if postTxt = "FC United" OR postTxt = "fc united" or postTxt = "fc utd" or postTxt = "FC Utd" or postTxt = "FC utd" or postTxt = "FCUoM" then Go_Result "Your post must NOT contain anything to do with FC United!", 0
end select


The problem with this is, if a member enters a message and includes any of the terms "FC United"... somewhere in the message it doesnt pick it up.
However, if they START the message with any of the terms it WILL pick it up and tell the poster that they cannot carry on with the posting when they submit.

So can anyone advise on how to change the script to scan the entire message, picking up the `FC` terms along the way??
<
Posted
Support Moderator
pdrg
Posts: 2897
2897
Or could you add the team's name to the badwords (swearwords) list?<
Posted
Starting Member
Presario
Posts: 46
46
Done that but it doesnt do what I want it to do unfortunately..


Yes I agree it deletes the names but Im after the posting not being accepted in full..<
Posted
Senior Member
MaD2ko0l
Posts: 1053
1053
i think u woudl have to moderate all the posts before they are viewable to the public.
the way you are trying to do it is to stop people from posting useing certain words but u can use different words/combinations to overcome what you have at the moment.<
© 1999-2010 MaD2ko0l
Posted
Junior Member
RArch
Posts: 103
103
You could improve your code by using the Instr function to search all "postTxt" for occurrences of your banned words.
Take a look here for some examples:
http://www.w3schools.com/vbscript/func_instr.asp

You should be able to use like this:

postTxt = lcase(postTxt) ' change to lower case
if Instr(postTxt, "fc united") or Instr(postTxt, "fc utd")... then ...
<
Posted
Starting Member
Presario
Posts: 46
46
Originally posted by RArch
You could improve your code by using the Instr function to search all "postTxt" for occurrences of your banned words.
Take a look here for some examples:
http://www.w3schools.com/vbscript/func_instr.asp

You should be able to use like this:

postTxt = lcase(postTxt) ' change to lower case
if Instr(postTxt, "fc united") or Instr(postTxt, "fc utd")... then ...


That is EXACTLY what I needed!!! Many thanks.. I have just incorporated that code (with some slight changes) into the post_info.asp page and it does what I need!
I agree there are ways around it if people want to post comments on the team `fc united` and I will sort that as and when , but hopefully when people go and try to post as they are doing, then this new script MAY put them off in the future...

Cheers anyway and thanks to all of you for your help!! <
Posted
Junior Member
RArch
Posts: 103
103
Glad it helped, why dont you post what you did as others may find it useful. <
Posted
Support Moderator
Shaggy
Posts: 6780
6780
I'd also recommend going the moderation route rather than hard coding checks for strings that members can easily get around; with moderation turned on, your admins and moderators can delete any posts that mention the team before other members see them and send an e-mail to the posting member informing them why their post was deleted.
<
Search is your friend “I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
 
You Must enter a message