Reply
Trying to eliminate the spammers from my guestbook
Old 09-08-2006, 01:23 PM Trying to eliminate the spammers from my guestbook
Experienced Talker

Posts: 30
Trades: 0
I have a guestbook on my site in ASP and as you would expect I get a lot of spammers submitting to it. I managed to change the script so that I have to approve every message before it goes on the site, so at least my visitors don't have a page full of Viagra adverts to look at.

To lower my workload in rejecting all these messages I want my submit page to automatically reject any message with a / symbol. This will cut out nearly all the spam as they nearly all post a URL with "http://" or "blahblah.com/viagra.html".

It currently rejects any message where the Name or Message boxes are empty.

Here's the code for that,

If sFirstName="" OR sMessage="" OR sHeard_About_Website="" Then

Response.write "Please click on the browser back button and fill in all required fields."

Is there a simple way to add any message containing / as something to reject?

I appreciate any help.
milkman is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 09-08-2006, 10:28 PM Re: Trying to eliminate the spammers from my guestbook
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,942
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Code:
If InStr (sMessage, "/") > 0 then 
     ' Reject the message.
end if
I could make it more complicated if you like.
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 09-09-2006, 06:14 AM Re: Trying to eliminate the spammers from my guestbook
chrishirst's Avatar
Super Moderator

Posts: 26,505
Location: Blackpool. UK
Trades: 0
how about a regex function

Code:
function checkCommentSpam(strIN)
' function to limit comment spammers
	dim RegEx
	dim WordList
	WordList = "http://|/|replica watches|replica watch" 
	'insert more words to block seperated by a "pipe" symbol ( | )

	set RegEx = New RegExp
	RegEx.Pattern = "\b(" & WordList & ")\b"
	RegEx.IgnoreCase = true
	RegEx.Global = True
	checkCommentSpam = RegEx.test(strIN)
	set regEx = nothing
end function
useage;
Code:
if checkCommentSpam(message) then
       ' discard message
else
       ' insert message into database
end if
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | Crowded Nightclub? | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-09-2006, 10:58 AM Re: Trying to eliminate the spammers from my guestbook
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,942
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Can't be throwing regular expressions out at people when they're not down with InStr yet, dude. That'll just blow their brains right up.
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 09-09-2006, 01:03 PM Re: Trying to eliminate the spammers from my guestbook
Experienced Talker

Posts: 30
Trades: 0
Thanks for the replies. I think I'll keep it simple.

I tried inserting that code but I couldn't get it to work, I tried,

If InStr (sMessage, "/") > 0 then
' Reject the message.
end if

If sFirstName="" OR sMessage="" OR sHeard_About_Website="" Then
Response.write "<div style=""position: absolute; top:210px; left:180px; width:420px; "" align=""center"">Please click on the browser back button and fill in all required fields.</div>"

I tried a few variations, it still rejects messages with no text but still allows messages that include the / symbol.

How should I be inserting it?

Thanks.
milkman is offline
Reply With Quote
View Public Profile
 
Old 09-09-2006, 01:27 PM Re: Trying to eliminate the spammers from my guestbook
Experienced Talker

Posts: 30
Trades: 0
After a bit more trusty trial and error I got it to work,

If InStr (sMessage, "/") > 0 OR sMessage="" OR sFirstName="" then


How would I also make it so that you cannot have a / in the FirstName?
Also how could I add more things I don't want to allow like www. ?

I tried a bit more trial and error, but if I just add

InStr (sFirstName, "/") > 0
or just,
(sFirstName, "/") > 0

I get an error message and the page doesn't display.

Thanks.
milkman is offline
Reply With Quote
View Public Profile
 
Old 09-09-2006, 02:10 PM Re: Trying to eliminate the spammers from my guestbook
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,942
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
If InStr (sMessage, "/") > 0 OR sMessage="" OR sFirstName="" or InStr (sFirstName, "/") > 0 then

Any time you have a condition to check, you either need an if, an or, or an and. (My English teachers will kill me if they ever see the previous sentence.)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 09-10-2006, 02:29 AM Re: Trying to eliminate the spammers from my guestbook
Junior Talker

Posts: 2
Trades: 0
Checking the reffer url maybe is helpful for preventing spam .
__________________
Garlic Recipes
anlefei is offline
Reply With Quote
View Public Profile
 
Old 09-10-2006, 11:55 AM Re: Trying to eliminate the spammers from my guestbook
Experienced Talker

Posts: 30
Trades: 0
Nice one, thanks a lot for your help.

Last edited by milkman; 09-10-2006 at 11:58 AM..
milkman is offline
Reply With Quote
View Public Profile
 
Old 09-23-2006, 03:50 PM Re: Trying to eliminate the spammers from my guestbook
Junior Talker

Posts: 3
Name: Pop
Trades: 0
Quote:
Originally Posted by milkman View Post
I have a guestbook on my site in ASP and as you would expect I get a lot of spammers submitting to it. I managed to change the script so that I have to approve every message before it goes on the site, so at least my visitors don't have a page full of Viagra adverts to look at.

To lower my workload in rejecting all these messages I want my submit page to automatically reject any message with a / symbol. This will cut out nearly all the spam as they nearly all post a URL with "http://" or "blahblah.com/viagra.html".

It currently rejects any message where the Name or Message boxes are empty.

Here's the code for that,

If sFirstName="" OR sMessage="" OR sHeard_About_Website="" Then

Response.write "Please click on the browser back button and fill in all required fields."

Is there a simple way to add any message containing / as something to reject?

I appreciate any help.
The following is what I use:
fnParse
'Create session variables at bottom of page so that session variables will always be empty on the first pass.
'In the if, and, then, statement name, email and comments must match to be redirected
If strComments = (Session("strComments")) and Session("strFName") = (strFName) and Session("strEmail") = (strEmail) Then Response.Redirect("Display.asp")


'pull our text from the form field, and parse it
'this function parses a string, filtering out the unwanted entries defined by yourself
Private Function fnParse()
'Declare our variable
Dim rex, match, matches
'Create an instance of the regexp object
Set rex = New regexp
'the almighty regexp pattern, put your swear words here, no spaces, seperated by a vertical
'break/bar ( | )
rex.Pattern = "http://|href|Iraq|pisem|"
'global determines whether we search the whole string, or just
'be satisfied w/ the first hit we come across.
rex.Global = True
'ignorecase, self explanatory
rex.IgnoreCase = True
'execute the regexp on our text string
Set matches = rex.Execute(strComments)
'go thru the matches (unwanted words)
For Each match in matches
strComments = Response.Redirect("reject.asp")
Next
'Clean up
Set rex = Nothing
Exit Function
End Function
popspipe is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Trying to eliminate the spammers from my guestbook
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.16286 seconds with 13 queries