Small mod: Blocking forum email spam - Postet den (14663 Views)
Snitz Forums Admin
ruirib
Innlegg: 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. <
   
 Sidestørrelse 
Postet den
Junior Member
Nertz
Innlegg: 341
341
Excellent Rui, thanks! Great timing too... I was trying to find time to do something like this.
cheers,
Nat<
Sadly, most Family Court Judges wrongfully reward opportunistic gold diggers
that use our children unjustly as "instruments" of power.

www.fathers-4-justice-canada.ca
Postet den
Snitz Forums Admin
ruirib
Innlegg: 26364
26364
Postet den
Junior Member
borge
Innlegg: 185
185
It's not working on my 3.4.03<
borge
Postet den
Forum Moderator
AnonJr
Innlegg: 5768
5768
What specifically is the problem/error?<
Postet den
Junior Member
borge
Innlegg: 185
185
I do not get any error message, it just ignores the mod and lets me post with a 0 post count

The 100 characters mod worked fine though<
borge
Postet den
Junior Member
borge
Innlegg: 185
185
It is actually not sending the possible spam e-mail, and gives a notice "E-mail has been sent". It fails to display the "You don't have enough posts to email other members" message, but does the job and sends the spam. It sends a waring to forum admin about possible spam.<
borge
Postet den
Forum Moderator
AnonJr
Innlegg: 5768
5768
hmm.. I wonder if there is a problem with the two working together; I wouldn't think so though. I almost think thats even better - let the spammer's think the e-mail was sent when it wasn't. The only problem is that it hurts the real members who want to send an email with fewer than the required posts since it does tell them it went through when it actually didn't. =/

Edit: you had to go and edit it while I was typing a reply! evil So it is sending the e-mail?<
Postet den
Junior Member
borge
Innlegg: 185
185
Yes, sorry, I notised the e-mails came in with a little delay. It is actually sending the e-mails, however I should probably say the messages were sent to a forum moderator account, hmmm...would it make a difference when sent to an ordinary member? I'll have to do more testing.<
borge
Postet den
Snitz Forums Admin
ruirib
Innlegg: 26364
26364
You can change the destination email by changing this line:
Code:

strRecipients = strSender
to
Code:

strRecipients = "whateverAddressYou@whish.com"
If it says the email was sent, then it was. Want to post a link to a text version of your pop_mail.asp file?<
Postet den
Forum Moderator
AnonJr
Innlegg: 5768
5768
The code rui posted looks like it doesn't care who is sending it or to whom it is going... I suspect it won't make a difference. Then again, I haven't really played with pop_mail.asp too much either...
Maybe a txt version of pop_mail.asp and inc_mail.asp would help...
Edit: rui, you beat me again. sleepy<
Du må legge inn en melding