<%
'// Blacklists
Function IsUserBlacklisted(sIP, sName, sEMail)
Dim bBlacklisted
Dim objXMLHTTP
bBlacklisted = False
'// We need to make sure we can actually create the MSXML object
If IsObject(CreateObject("MSXML2.ServerXMLHTTP")) = False Then IsUserBlacklisted = "Error: MSXML2.ServerXMLHTTP could not be created, please check MSXML is installed (v6 or above is recommended)": Exit Function
'// Check Blacklists
set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")
objXMLHTTP.open "GET", "http://www.stopforumspam.com/api?name=" & sName & "&email=" & sEMail & "&ip=" & sIP, false
objXMLHTTP.send
if objXMLHTTP.status = 200 then
If Instr(1, objXMLHTTP.ResponseText, "yes", 1) > 0 Then
bBlacklisted = True
'Create blocked message email
strEmailBody = "Registrant " & strUsername & " at IP address " & getip() & " attempted to register with email " & STREmail & " and was found in the blacklist by stopforumspam."
'Send the e-mail using the Send Mail function created on the send_mail_function.inc file
blnSentEmail = SendMail(strEmailBody, strTxtForumAdmin, decodeString(strForumEmailAddress), strMainForumName, decodeString(strForumEmailAddress), "new registrant BLACKLISTED", strMailComponent, false)
end if
end if
set objXMLHTTP = nothing
IsUserBlacklisted = bBlacklisted
End Function
%>
This seems to work so far. You can use this function wherever you want to return a boolean for whether or not the username, IP address, or email passed to it is found in the stopforumspam DB. There's a whole bunch of error checking that can be done with the "status" property, but 200 is just "OK" according to MS. I put the call in register.asp where the user is already being checked to see if the IP has been blacklisted.
Create a file in the "functions" folder with the name "isuserblacklisted.asp" Paste the above code into it.
Add the following line at the top of register.asp where the other functions are:
<!--#include file="functions/function_IsUserBlacklisted.asp" -->
Then I added the following to line 634 of register.asp:
'check if user is blacklisted
if IsUserBlacklisted(getIP(), strUserName, STREmail) then blnEmailBlocked = True
If anyone has improvements to this, please speak up. Im just a jackleg coder, after all, copying stuff that others have done and taking credit for it. :-) Most of all, if you see some degernate situation where it wont work, please let me know as well.