Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Blocking members from sending e-mail
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

matko
New Member

54 Posts

Posted - 31 May 2007 :  06:38:06  Show Profile  Reply with Quote
<font size="1"><b>Credits:</b>This MOD is based on idea of ruirib in Small mod: Blocking forum email spam</font id="size1">

<b>Version 1.0
Snitz forum version 3.4.06</b>

This mod will prevent members to send an e-mail to other members until they reach certain number of posts or until admin allows them to do so. Usefull to block e-mail spammers while allowing admin to overide this for users he knows or recommended users. Override can be set in User profile. It will also send a message to the forum admin, notifying him of the spam attempt, so that the member can be blocked.

<b>Difficulty:</b> easy to implement

<font color="blue">1. In admin section go to Alternative mod setup and run this code:</font id="blue">

[ALTER]
MEMBERS
ADD#M_ALLOWEMAIL#SMALLINT##0
[END]

[UPDATE]
MEMBERS
M_ALLOWEMAIL#1#
[END]

[ALTER]
MEMBERS_PENDING
ADD#M_ALLOWEMAIL#SMALLINT##0
[END]

[UPDATE]
MEMBERS_PENDING
M_ALLOWEMAIL#1#
[END]


<font color="blue">2. in unmodified <b>pop_mail.asp</b> find this code (at around line 45):</font id="blue">

if Request.QueryString("ID") <> "" and IsNumeric(Request.QueryString("ID")) = True then
intMemberID = cLng(Request.QueryString("ID"))
else
intMemberID = 0
end if
'##################### e-mail anti-spam MOD #######################
strSql = "SELECT M_NAME, M_POSTS, M_ALLOWEMAIL 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")
intAllowEmail = rs("M_ALLOWEMAIL")

if intMPosts < <font color="red">10</font id="red"> and intAllowEmail="0" then
Err_Msg = "<li>You can't send e-mail yet.</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 anti-spam mod #############


<font size="1">In red is number of posts member has to reach before allowed to send e-mail. Next version of this mod (if there is interest from people) can allow to set this value via admin menu, currently it has to be set in the code.</font id="size1">

<font color="blue">3. in <b>pop_mail.asp </b> look for this code (around line 102)</font id="blue">

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


<font color="blue">and comment Err_Msg= "" so it looks like this:</font id="blue">
if Request.QueryString("mode") = "DoIt" then
  <font color="green">'</font id="green">Err_Msg = ""


<font color="blue">4. In unmodified <b>pop_profile.asp</b> look for this code (around 969)</font id="blue">

strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_QUOTE"
strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_BIO"
strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_SIG"


<font color="blue">and right <b>BELOW</b> these lines add this code</font id="blue">

strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_ALLOWEMAIL"


<font color="blue">So it looks like this</font id="blue">

strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_BIO"
strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_SIG"
<font color="green">strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_ALLOWEMAIL"</font id="green">
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS"


<font color="blue">5. In the same <b>pop_profile.asp</b> look for this (around 1586):</font id="blue">
if strBio = "1" then
   strSql = strSql & ", M_BIO = '" & chkString(Request.Form("Bio"),"message") & "'" 
end if


<font color="blue">and right BELOW these lines add this:</font id="blue">

strSQL = strSql & ", M_ALLOWEMAIL = " & cLng(Request.Form("allowemail"))


<font color="blue">so it looks like this</font id="blue">

if strBio = "1" then
   strSql = strSql & ", M_BIO = '" & chkString(Request.Form("Bio"),"message") & "'" 
end if
<font color="green">strSQL = strSql & ", M_ALLOWEMAIL = " & cLng(Request.Form("allowemail"))</font id="green">
strSql = strSql & " WHERE MEMBER_ID = " & cLng(Request.Form("MEMBER_ID"))

my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords


<font color="blue">6. in <b>inc_profile.asp</b> look for this code (around 532)</font id="blue">


     if rs("M_LEVEL") = 3 then Response.Write(" selected")
     Response.Write ">Administrator</option>" & vbNewLine & _
     "                      </select>" & vbNewLine
end if
Response.Write "                      </td>" & vbNewLine & _
   "                    </tr>" & vbNewLine


<font color="blue">and right BELOW this add this code</font id="blue">


response.write " <tr>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ align=""right"" valign=""middle"" nowrap><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>User allowed to send<br />e-mail before limit of <br />posts is reached? </font></b></td>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ valign=""bottom"">" & vbNewLine
response.write " <select name=""allowemail"">" & vbNewLine & _
" <option value=""1"""
if rs("M_ALLOWEMAIL")="1" then Response.Write(" selected")
Response.Write ">Yes</option>" & vbNewLine & _
" <option value=""0"""
if rs("M_ALLOWEMAIL")="0" then Response.Write(" selected")
Response.Write ">No</option>" & vbNewLine & _
" </select>" & vbNewLine
Response.Write " </td>" & vbNewLine & _
" </tr>" & vbNewLine


<font color="blue">so it looks like this</font id="blue">


if rs("M_LEVEL") = 3 then Response.Write(" selected")
Response.Write ">Administrator</option>" & vbNewLine & _
" </select>" & vbNewLine
end if
Response.Write " </td>" & vbNewLine & _
" </tr>" & vbNewLine
<font color="green"> response.write " <tr>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ align=""right"" valign=""middle"" nowrap><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>User allowed to send<br />e-mail before limit of <br />posts is reached? </font></b></td>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ valign=""bottom"">" & vbNewLine
response.write " <select name=""allowemail"">" & vbNewLine & _
" <option value=""1"""
if rs("M_ALLOWEMAIL")="1" then Response.Write(" selected")
Response.Write ">Yes</option>" & vbNewLine & _
" <option value=""0"""
if rs("M_ALLOWEMAIL")="0" then Response.Write(" selected")
Response.Write ">No</option>" & vbNewLine & _
" </select>" & vbNewLine
Response.Write " </td>" & vbNewLine & _
" </tr>" & vbNewLine</font id="green">

end if
if not(strUseExtendedProfile) then



And that's it. I hope you'll find it usefull, if you have any suggestions how to improve this, please let me know.


Edited by - matko on 31 May 2007 13:18:58

AnonJr
Moderator

United States
5768 Posts

Posted - 31 May 2007 :  08:23:33  Show Profile  Visit AnonJr's Homepage  Reply with Quote
Cool. Its a neat addition. The only change I'd make is put your code in [scrollcode] tags so it doesn't stretch the page. <
Go to Top of Page

matko
New Member

54 Posts

Posted - 31 May 2007 :  13:17:22  Show Profile  Reply with Quote
AntonJr: I didn't know such a tag exists

I put widest part of code in scrollcode now, so the page is not stretching anymore.<
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 31 May 2007 :  15:20:22  Show Profile  Visit AnonJr's Homepage  Reply with Quote
Its one of those little hidden gems that is set up just here. The code for adding it (or something like it) is floating around here if you want to add it to your forum.<
Go to Top of Page

dcohn
New Member

98 Posts

Posted - 02 July 2007 :  02:27:06  Show Profile  Visit dcohn's Homepage  Reply with Quote
Matko

Does everyone default to yes they can send without reaching and can that be changed to NO as the default so it is more like RUI's code without your added options. Otherwise I must go into every user with a yes and under the amount and change to no.


Where you write

2. in unmodified pop_mail.asp find this code (at around line 45):

I assume you mean you find the first few lines and then add the balance of the contents, correct?

Sorry for being so anal.

THANK YOU for what I have been looking for. I have a serious problem on a Feline health forum where crazies attack new users with lies etc.

I was also wondering whether these users that cannot email CAN email the ADMIN or does that defeat the purpose when it is used to prevent spammers?

IE In my case I need to just control people from their own bad behavior as well as protect against the more common spammer issue.

Thanks again as this is a great addition as it is for us non coder types.

Doug<


Edited by - dcohn on 02 July 2007 22:37:53
Go to Top of Page

TastyNutz
Junior Member

USA
251 Posts

Posted - 29 July 2007 :  14:24:08  Show Profile  Visit TastyNutz's Homepage  Reply with Quote
I've added this mod and it successfully blocks email from members without enough posts. But the Admin override isn't working. I select "Yes" from the menu and click 'Submit' but the database doesn't update. When I check the profile again, the menu option has reverted back to "No."

Any ideas what I missed?<


PowerQuad Disability Support Forum
Go to Top of Page

TastyNutz
Junior Member

USA
251 Posts

Posted - 29 July 2007 :  20:41:34  Show Profile  Visit TastyNutz's Homepage  Reply with Quote
Oops. Missed a line of code.

Works great now!<


PowerQuad Disability Support Forum
Go to Top of Page

BroIgnatius
New Member

56 Posts

Posted - 05 October 2007 :  21:33:37  Show Profile  Reply with Quote
I am getting this error message when someone tries to register:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] The field 'FORUM_MEMBERS_PENDING.M_ALLOWEMAIL' cannot contain a Null value because the Required property for this field is set to True. Enter a value in this field.

/bbs/register.asp, line 730


line 730 is:
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords


Any help appreciated.


<

Edited by - BroIgnatius on 05 October 2007 22:30:20
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07