Tuesday, August 26, 2008

Stop Forum Spam

I'm impressed with a site that my friend Huw Reddick recently alerted me to called Stop Forum Spam. It's a database of IP's, user name's and emails that have been used to spam forums. If you run a forum or maintain forum software then it's a great resource to query when someone's registering on your forum to try and cut down on spammers joining your forum. You can also submit spammer information to their database (manually) at this link. If, however, you're like me and hate spammers but are also very lazy then you'll want to automate this process as much as possible. Here's some C# code that will submit the spammers info for you:

        public bool SubmitForumSpammer(string ip, string username, string email, string apikey)
            WebRequest req = WebRequest.Create("http://www.stopforumspam.com/add");
            string postData = String.Format("username={0}&email={1}&ip_addr={2}&api_key={3}", username, email, ip, apikey);

            byte[] send = Encoding.Default.GetBytes(postData);
            req.Method = "POST";
            req.ContentType = "application/x-www-form-urlencoded";
            req.ContentLength = send.Length;

            Stream sout = req.GetRequestStream();
            sout.Write(send, 0, send.Length);

            WebResponse res = req.GetResponse();
            StreamReader sr = new StreamReader(res.GetResponseStream());
            string returnvalue = sr.ReadToEnd();

            return returnvalue.Contains("Data submitted successfully");


  1. Hey Guy,
    I wanted to make you aware of a service similar to Stop Forum Spam. It's called "BotScout.com" and they're also useful in screening out spammers and bots that try to register on forums, abuse contact pages, etc.
    They have an easy-to-use API similar to SFS and have mods available for most of the popular bulletin boards out there.
    Full Disclosure: I'm one of the folks that runs BotScout and would be glad to have you make use of our service too.

  2. Thanks Mike - I'll take a look at it.

  3. Will this work on an invisionfree forum?

  4. Yes - it should work on any forum. The code I supplied is for C# on ASP.NET but can be modified for any language.