Lampwrights Forum

Lampwrights Forum (
-   Pertaining to SPAM (
-   -   Checking IP's against spammer database (

Jeff 07-30-2010 12:27 PM

Checking IP's against spammer database
There is a good free RBL that checks users against a database of known forum spammers. You can check a users IP against it before allowing them to do anything on your site. Here is some example PHP code:


function blacklisted($ip)

        foreach($dnsbl_check as $val){
                return $rip.'.'.$val;

    return false;

Basically just pass the IP to this function and if it comes back as true, then the IP is listed.


thisbuzz 01-21-2011 12:07 PM

Hi Jeff .. where should we place this code, please?

In which file



Jeff 01-21-2011 12:24 PM


Originally Posted by thisbuzz (Post 94)
Hi Jeff .. where should we place this code, please?

In which file



It depends on your code.

thisbuzz 01-21-2011 12:36 PM

OK maybe I am not understanding how this works :)

the above code which starts with

function blacklisted

I thought that the code would check with the SPAM IP site?

so I was wondering where the code would be placed

my apologies in advance if I have the wrong end of the stick



Jeff 01-21-2011 12:40 PM

If you have some PHP code, and you want to check to see if an IP address is of a known spammer, put the function in the first post of this thread into your PHP script. WHERE exactly I cannot tell you as that is different in every script.

Then you just pass the IP to the function and it will tell you true or false:


if (blacklisted(''))
## This IP is blacklisted!

If you think you can just plug this into any script without any programming knowledge, then I would say no. You have to have some understanding how the code is working. This is a generic function, not a specific one for a particular program.

kpmedia 01-21-2011 12:57 PM

There's a plugin for this:
Works quite well. :)

thisbuzz 01-22-2011 02:19 AM

Thanks Jeff

All times are GMT -4. The time now is 08:46 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2019, vBulletin Solutions, Inc.