Author |
Topic |
|
Presario
Starting Member
46 Posts |
Posted - 04 December 2006 : 11:55:13
|
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..
< |
Edited by - Presario on 04 December 2006 12:00:23 |
|
Presario
Starting Member
46 Posts |
Posted - 04 December 2006 : 13:18: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??
< |
Edited by - Presario on 04 December 2006 13:21:55 |
|
|
pdrg
Support Moderator
United Kingdom
2897 Posts |
Posted - 04 December 2006 : 13:52:45
|
Or could you add the team's name to the badwords (swearwords) list?< |
|
|
Presario
Starting Member
46 Posts |
Posted - 04 December 2006 : 14:07:06
|
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..< |
|
|
MaD2ko0l
Senior Member
United Kingdom
1053 Posts |
Posted - 04 December 2006 : 14:18:03
|
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 |
|
|
RArch
Junior Member
United Kingdom
103 Posts |
Posted - 04 December 2006 : 15:37:50
|
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 ...
< |
|
|
Presario
Starting Member
46 Posts |
Posted - 04 December 2006 : 16:10:03
|
quote: 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!! < |
|
|
RArch
Junior Member
United Kingdom
103 Posts |
Posted - 04 December 2006 : 16:53:13
|
Glad it helped, why dont you post what you did as others may find it useful. < |
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 05 December 2006 : 04:16:09
|
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.” |
|
|
|
Topic |
|