Small mod: Blocking forum email spam - Posted (14656 Views)
Snitz Forums Admin
ruirib
Posts: 26364
26364
Version 1.01 - 2006/08/25
Snitz forum version: 3.4.05

This mod will stop members emailing other forum members until they reach a given number of forum posts. It's useful to stop spammers who register just to send emails to forum members.
It's not a very elaborate mod, and the post limit must be changed in the code, but I'm providing it because with the current surge of spammers registering all over the place, it can be useful to avoid them annoying your valuable forum members.
It's even more interesting because it will allow the spammer to write the email and when the email is sent, it will show a message stating that it won't be sent, since the member does not have the required number of posts to send it. So, they'll have the trouble to compose the message only to be told it can't be sent, once that is tried. It will also send a message to the forum admin, notifying him of the spam attempt, so that the member can be blocked.
Code changes to an unchanged pop_mail.asp: Starting with a pop_mail.asp, at line# 46, add the following code:
Code:

'######## Email Spam Mod ############

if Request.QueryString("mode") = "DoIt" then
Err_Msg = ""

strSql = "SELECT M_NAME, M_POSTS FROM " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE M.MEMBER_ID = " & MemberID

set rs = my_Conn.Execute (strSql)

If Not rs.EOF then
intMPosts = rs("M_POSTS")

if intMPosts < 10 then
Err_Msg = "<li>You don't have enough posts to email other members.</li>"
strSpammerName = RS("M_NAME")

'Send email to forum admin
strRecipients = strSender
strFrom = strSender
strFromName = "Automatic Server Email"
strSubject = "Possible Spam Poster"
strMessage = "There is a possible spam poster at " & strForumTitle & vbNewLine & vbNewLine
strMessage = strMessage & "Member " & strSpammerName & ", with MemberID " & MemberID & ", has been trying to send emails to " & Request.Form("Name") & ", without having enough posts to be allowed to do it." & vbNewLine & vbNewLine
strMessage = strMessage & "Here are the message contents: " & VbNewLine & Request.Form("Msg") & vbNewLine & vbNewLine & vbNewLine & vbNewLine
strMessage = strMessage & "This is a message sent automatically by the Spam Control Mod ;)."

%>
<!--#INCLUDE FILE="inc_mail.asp" -->
<%


end If

End if

rs.Close
end if
'############# End of email spam mod #############

Then at line# 102, where you have
Code:

if Request.QueryString("mode") = "DoIt" then
Err_Msg = ""
comment the 2nd line, so that it will look like this:
Code:

if Request.QueryString("mode") = "DoIt" then
'Err_Msg = ""
The commented line can also be removed, of course.
This has been tested with 3.4.05 and has been working well. If you need to change the number of messages a member must have before emailing other members, just change the number in red to the desired value.
If you need help with this, please post in the mod implementation forum. <
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
New Member
RhinoOffRoad
Posts: 71
71
ruirib,
thank you very much sir, this mod is exactly what i was looking for. im so tired of these one-hit monkeys joining my board and emailing all my members only to get 100 posts (on the concealedcarryforum.com particularly) on the spam mails the members were getting. thanks again!<
Nathan In Montana
Posted
Starting Member
CertGuard
Posts: 10
10
Hey ruirib,

I hope I'm not stepping on any toes here. I received an email from this mod (which is working great BTW)
and decided that the text version of the message did nothing for me, being that I have my forums setup
to send me HTML emails. So, I went through and started formatting the text, then decided to add a few
features to the message.
In this mod variation for HTML emails, I have only modifed the information starting on, or about, line #46
in the pop_mail.asp file.
New features:
  • Offender visible from Subject line
  • Increased legibility of all data
  • Link to offender's profile
  • Link to WHOIS information for offender's IP Address
  • Server Time
  • Offender's RAW Data
  • Link back to this thread so admins like me remember where to find info on itwink
Code:
'######## Email Spam Mod ############

if Request.QueryString("mode") = "DoIt" then
Err_Msg = ""

strSql = "SELECT M_NAME, M_EMAIL, M_POSTS FROM " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE M.MEMBER_ID = " & MemberID

set rs = my_Conn.Execute (strSql)

If Not rs.EOF then
intMPosts = rs("M_POSTS")
intRID = Request.Querystring("id")

strSQL_x = "SELECT M_NAME FROM " & strMemberTablePrefix & "MEMBERS M"
strSql_x = strSql_x & " WHERE M.MEMBER_ID = " & intRID

set rs_x = my_Conn.Execute (strSql_x)

If Not rs_x.EOF then
R_Name = rs_x("M_NAME")
end if
rs_x.close

if intMPosts < 10 then
Err_Msg = "<li>You need more than " & intMPosts & " posts to send emails to other members. If you want to get someone's attention please just post it, we will not neglect you.</li>"
strSpammerName = RS("M_NAME")

'Send email to forum admin
strRecipients = strSender
strFrom = strSender
strFromName = "Automatic Server Email"
strSubject = "Possible Spam Poster [" & strSpammerName & "]"
strMessage = "<font style=""font-family: arial;"">" & vbNewLine & vbNewLine
strMessage = strMessage & "There is a possible spam poster at " & strForumTitle & "<br />" & vbNewLine & vbNewLine
strMessage = strMessage & "Member: <a href=""/forums/pop_profile.asp?mode=display&id=" & MemberID & """><b>" & strSpammerName & "(Member ID " & MemberID & ")</b></a><br />" & vbNewLine
strMessage = strMessage & " # of Posts: <b>" & intMPosts & "</b><br />" & vbNewLine
strMessage = strMessage & "Intended Recipient: <b>" & R_Name & "(Member #" & intRID & ")</b><br />" & vbNewLine
strMessage = strMessage & "Message: <br/><b>" & VbNewLine & replace(Request.Form("Msg"), vbNewLine, "<br />") & "</b><br />" & vbNewLine
strMessage = strMessage & "<hr /><br />" & vbNewLine
strMessage = strMessage & "Remote Address WHOIS: <a href=""http://whois.domaintools.com/" & Request.ServerVariables("remote_addr") & """>" & Request.ServerVariables("remote_addr") & "</a><br />" & vbNewLine
strMessage = strMessage & "Server Time - (1/24): <b>" & Now()-(1/24) & "</b><br/>" & vbNewline
strMessage = strMessage & "RAW DATA: <b>" & Request.ServerVariables("ALL_RAW") & "</b><br />" & vbNewline
strMessage = strMessage & "<hr /><br />" & vbNewLine
strMessage = strMessage & "This is a message sent automatically by the <a href=""http://forum.snitz.com/forum/topic.asp?TOPIC_ID=62640"">Spam Control Mod</a>."
strMessage = strMessage & "</font>"
%>
<!--#INCLUDE FILE="inc_mail.asp" -->
<%


end If

End if

rs.Close
end if
'############# End of email spam mod #############
<
Robert Williams Join the fight against braindumps!
Posted
Starting Member
Jaeda
Posts: 9
9
Originally posted by ruirib
Hmmm... that's why I hate psting stuff without testing.
The new code should be like this:

Code:

'######## Email Spam Mod ############

if Request.QueryString("mode") = "DoIt" then
Err_Msg = ""

strSql = "SELECT M_NAME, M_POSTS FROM " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE M.MEMBER_ID = " & MemberID

set rs = my_Conn.Execute (strSql)

If Not rs.EOF then
intMPosts = rs("M_POSTS")

if intMPosts < 5 then
Err_Msg = "<li>You don't have enough posts to email other members.<br>If you feel that you have received this message in error, please contact the forum administrator.</li>"
strSpammerName = RS("M_NAME")

rs.Close


strSql = "SELECT M.M_NAME FROM " & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE M.MEMBER_ID = " & intMemberID

set rs = my_Conn.Execute (strSql)

if rs.bof or rs.eof Then
strDestName = ""
Else
strDestname = rs("M_NAME")
End If

rs.close
Set rs = nothing

'Send email to forum admin
strRecipients = strSender
strFrom = strSender
strFromName = "Automatic Server Email"
strSubject = "Possible Spam Poster"
strMessage = "There is a possible spam poster at " & strForumTitle & vbNewLine & vbNewLine
strMessage = strMessage & "Member " & strSpammerName & ", with MemberID " & MemberID & ", has been trying to send emails to " & strDestName & ", without having enough posts to be allowed to do it." & vbNewLine & vbNewLine
strMessage = strMessage & "Here are the message contents: " & VbNewLine & Request.Form("Msg") & vbNewLine & vbNewLine & vbNewLine & vbNewLine
strMessage = strMessage & "This is a message sent automatically by the Spam Control Mod ;)."

%>
<!--#INCLUDE FILE="inc_mail.asp" -->
<%


end If

Else
rs.Close
Set rs = nothing
End If


end if
'############# End of email spam mod #############


okay I've done all of this... and it still lets the spam email go through to the member and it doesn't send a note to the spammer... any advise?<
Posted
Senior Member
leatherlips
Posts: 1838
1838
Excellent MOD! I just had a new member sign up today and start sending spam pm's to several of my members. I added the code for the email and the pm and it works great! Thanks!
Posted
Snitz Forums Admin
ruirib
Posts: 26364
26364
It's an old one... It is even included in the latest Snitz version wink.
Posted
Senior Member
leatherlips
Posts: 1838
1838
Originally posted by ruirib
It's an old one... It is even included in the latest Snitz version wink.
I have 3.4.05 with many updates so I never installed .07. Nevertheless, this mod is very useful! smile
You Must enter a message