[CODE] Integrating the spam filter into ASP applications

Mods for various forums/blogs for use with the SBST

Moderator: fspamlist

User avatar
MysteryFCM
Site Admin
Site Admin
Posts: 3721
Joined: Sun May 15, 2005 12:42 pm
Location: Newcastle, UK
Contact:

[CODE] Integrating the spam filter into ASP applications

Postby MysteryFCM » Sun Dec 07, 2008 9:49 pm

For those working with ASP applications that would like to query the blacklists, you can do so by using the following function (note: version specific calls are recommended for CreateObject(), the following doesn't use version specific, to allow for your not using the version I use);

Code: Select all

'// Blacklists
Function IsUserBlacklisted(sIP, sName, sEMail)
      '// 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
      '// Set init bool to false
      bBlacklisted = False
      '// Check Blacklists
      set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP") 
      objXMLHTTP.open "GET", "http://temerc.com/Check_Spammers/check_spammers_plain.php?name=" & sName & "&email=" & sEMail & "&ip=" & sIP, false
      objXMLHTTP.setRequestHeader "User-Agent", Request.ServerVariables("HTTP_HOST")
      objXMLHTTP.send ""
      if objXMLHTTP.status = 200 then
         If Instr(1, objXMLHTTP.ResponseText, "TRUE", vbTextCompare) > 0 Then bBlacklisted = True
      end if
      set objXMLHTTP = nothing
      IsUserBlacklisted = bBlacklisted
End Function


If your server also has PHP support, then you could of course, host the Check Spammers scripts yourself, and change the URL for check_spammers_plain.php, to the copy hosted on your server.

If you ONLY want to check the fSpamlist.com and StopForumSpam.com databases, then you can use the following instead if you wish;

Code: Select all

'// Blacklists
Function IsUserBlacklisted(sIP, sName, sEMail)
      '// 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
      '// Set init bool to false
      bBlacklisted = False
      set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP") 
      objXMLHTTP.open "GET", "http://www.stopforumspam.com/api?username=" & sName & "&email=" & sEMail & "&ip=" & sIP, false
      objXMLHTTP.setRequestHeader "User-Agent", Request.ServerVariables("HTTP_HOST")
      objXMLHTTP.send ""
      if objXMLHTTP.status = 200 then
         If Instr(1, objXMLHTTP.ResponseText, " yes ", vbTextCompare) > 0 Then bBlacklisted = True
      end if
      set objXMLHTTP = nothing
      '// Check fSpamList.com
      set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP") 
      objXMLHTTP.open "GET", "http://www.fspamlist.com/xml.php?username=" & sName & "&ip=" & sIP & "&email=" & sEMail, false
      objXMLHTTP.setRequestHeader "User-Agent", Request.ServerVariables("HTTP_HOST")
      objXMLHTTP.send ""
      if objXMLHTTP.status = 200 then
         If Instr(1, objXMLHTTP.ResponseText, "True", vbTextCompare) > 0 Then bBlacklisted = True
      end if
      set objXMLHTTP = nothing
      IsUserBlacklisted = bBlacklisted
End Function
Regards

Steven Burn
I.T. Mate / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!

Return to “Mods”

Who is online

Users browsing this forum: No registered users and 1 guest