Or you could do the easy way :-)

$api_key = "your_key";

$url = "http://www.stopforumspam.com/add.php?username=".$user['username']."&ip_addr=".$user['registration_ip']."&email=".$user['email']."&api_key=".$api_key;

if(get_remote_file($url, 10)) {
    //hopefully, everything went ok...
} else {
    //something screwed up :))
}

Btw I haven't checked whether $user really contains data of user you want to ban so I hope you're sure about them. It would be quite bad if you would accidentally reported yourself instead big_smile

202

(7 replies, posted in PunBB 1.3 extensions)

I don't know, I tried some of those IP listed at botscout and 90% of them were at SFS too. And 300 limit? That's not a really big one... Moreover instructions to installing extension would have to be like "Go there, get API key..." :-(

But if you would like keep trying, here's the code (I haven't tested it, but it should be fine)

    <hook id="rg_start"><![CDATA[
if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
    require $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
else
    require $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';
    
$ip = get_remote_address();

$query = array(
    'SELECT'   => 'ip',
    'FROM'     => 'botscout',
    'WHERE'    => 'ip = \''.$ip.'\'',
    'LIMIT'    => '1'
);
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);

if($forum_db->num_rows($result) > 0) {
    message(sprintf($lang_botscout['Forbidden'], $ip));
} else {
    $url = 'http://botscout.com/test/?ip='.$ip.'&key=xxxxxxx;
    $remote_file = get_remote_file($url, 10);

    if(strpos("limit reached", $remote_file)) {
        //maybe we could log this somewhere? (email, maybe), but I don't think it's 'that' important
    } else {
        $array = explode('|', $remote_file);
        if($array[0] != "Y") {
            $query = array(
               'INSERT'   => 'ip, bot_visit, count',
               'INTO'     => 'botscout',
               'VALUES'   => '\''.$ip.'\', NOW(), \''.$array[2].'\''
            );
            $forum_db->query_build($query) or error(__FILE__, __LINE__);
            
            message(sprintf($lang_botscout['Forbidden'], $ip));
        }
    }
}
    ]]></hook>

BTW, sorry about that url, it wasn't correct, it should be like in the code, so

?ip='.$ip.'&key=xxxxxxxx;

203

(7 replies, posted in PunBB 1.3 extensions)

KeyDog wrote:

?ip='.$ip&key=xxxxxxxx;

Yup, it's correct wink

KeyDog & Grez & Slavok introduce... smile /dramatic entrance/ big_smile

Info: Cross-checks registering user's IP adress with StopForumSpam.com database.

Database: Bots which tried to register are stored in table PREFIXstopforumspam

Download: .zip (v1.1.2)

Changelog:

v1.1.0 Added guest posting protection.
v1.1.1 Fixed little bug
v1.1.2 Fixed bug in installation process

KeyDog wrote:

EDIT 2: We got this covered ? smile

Yup, we do. We check the IP whether it's in db, before trying to insert it there  smile

//And unless we would have visits like Facebook I believe it should work

Yup, I've got some of them too  wink

217.23.10.108      2010-07-20 01:23:02      2010-07-19 19:14:36      33
91.212.226.240     2010-07-20 01:59:24     2010-07-19 18:08:58     1782
91.212.226.210     2010-07-20 02:43:02     2010-07-19 18:32:46     2522
217.21.115.189     2010-07-20 04:13:06     2010-06-29 05:48:40     36
195.191.40.104     2010-07-20 08:28:09     2010-07-20 00:00:17     73

So, I guess we can change version to 1.0.0 and release it  smile

Ups, forgot about slashes in where clause for ip big_smile
Anyway... I was checking the function Slavok advised, and somehow it seems we've got working (little bit rewriten) extension now big_smile

Check it out (.zip)  smile

Each time query to db whether table exists? Why not use <install> and <unistall> at manifest.xml?

//As well I changed the table a little bit... ;-)

<install>
<![CDATA[
        $schema = array(
            'FIELDS'    =>    array(
                'ip'            => array(
                    'datatype'        =>    'VARCHAR(15)',
                    'allow_null'    =>    false,
                    'default'        =>    '\'0.0.0.0\''
                ),
                'lastseen'        => array(
                    'datatype'        => 'DATETIME',
                    'allow_null'    => false,
                    'default'        => '0'
                ),
                'frequency'        => array(
                    'datatype'        => 'SMALLINT UNSIGNED',
                    'allow_null'    => false,
                    'default'        => '0'
                )
            ),
            'PRIMARY KEY'        =>    array('ip')
        );
        $forum_db->create_table('stopforumspam', $schema);
    ]]>
</install>
    
<uninstall>
    <![CDATA[
        $forum_db->drop_table('stopforumspam');
    ]]>
</uninstall>

//"caching system" big_smile

$query = array(
   'SELECT'   => 'ip',
   'FROM'     => 'stopforumspam',
   'WHERE'    => 'ip='.get_remote_address(),
   'LIMIT'    => '1'
);
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
if($forum_db->num_rows($result) > 0) {
    //die('You are spammer')
} else {
    //Request to to SFS.com
        //Insert to db
}

//Query for inserting data into db

$query = array(
   'INSERT'   => 'ip, last_seen, frequency',
   'INTO'     => 'stopforumspam',
   'VALUES'   => '\''.$bot["ip"].'\', \''.$bot["lastseen"].'\', \''.$bot["frequency"].'\''
);
$forum_db->query_build($query) or error(__FILE__, __LINE__);

IMO you don't even need to use any "cache", you could use that table in db, where are you storing bots which tried registering to your forum. Just cross check if that IP isn't in your database and only if db returns 0 rows send query to SFS site  wink

That's weird... worked fine on localhost  neutral

@sakthi

for 1.3.4 find line 631 in ./include/parser.php and replace

this

    else
        return '<a href="'.$full_url.'">'.$link.'</a>';

with

    else {
        global $forum_user;
        if($forum_user['username'] == 'Anonymous') {
            return '<span class="warntext">[guest will see what you write here]</span>';
        } else {
            return '<a href="'.$full_url.'">'.$link.'</a>';
        }
    }

Well, as I am looking on the code I believe they weren't - default value (and you can't change it) for "remember me" is 14 days, so if (from some very strange reason) it wouldn't work with this it wouldn't have changed by editing timeout visit :-)

$expire = ($save_pass) ? time() + 1209600 : time() + $forum_config['o_timeout_visit'];

But anyway, the main thing is that it's working properly now  wink

213

(3 replies, posted in Discussions)

Hi

I believe punBB and Wordpress integration plugin could suit you.

Or, if you are a programmer you could check logging script on Wiki.

Well, SimpleXML would be easy solution, but since it isn't in core of PHP we should use regular expressions. (Badly I sux at them sad, so this isn't probably the best solution but it seems to work...) smile

if (strpos($urlchecker, 'yes')) {
   $bot = array();
   $bot["ip"] = get_remote_address();
   preg_match_all('/<type>(.*?)<\/type>/', $urlchecker, $matches);
   $bot["type"] = $matches[1][0];
   preg_match_all('/<lastseen>(.*?)<\/lastseen>/', $urlchecker, $matches);
   $bot["lastseen"] = $matches[1][0];
   preg_match_all('/<frequency>(.*?)<\/frequency>/', $urlchecker, $matches);
   $bot["frequency"] = $matches[1][0];

   //store into db


   
   die("No permission"); //got ya!
}

They could used "Remember me" function when logging  wink

Well, you could store it in db or in some file, but I don't think it's necessary because 5k daily limit should be sufficient for most forums wink

KeyDog wrote:

Which ones?

Wel,l as I'm looking again on the domain name I think "not really relevant ones" - I tested few which were spamming one CMS I have access to  big_smile

I'm to lazy to do the "hooks thing" big_smile I prefer advising only smile

@KeyDog sorry, forgot one line  neutral Insert it before $result

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

Well, the first one figure does (despite it's stupid description)  wink

This code will try both file_get_contents and cURL ;-)

$url = 'http://www.stopforumspam.com/api?ip='.get_remote_address();

if(ini_get('allow_url_fopen') == 1) {

    $urlchecker = file_get_contents($url);
    if (strpos($urlchecker, 'yes')) {
        die($lang_common['No permission']); //got ya!
    }
    
} elseif(extension_loaded('curl')) {

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_HEADER, FALSE);
    curl_setopt($curl, CURLOPT_TIMEOUT, 20);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($curl);
    $ok = curl_errno($curl) === 0 && curl_getinfo($curl, CURLINFO_HTTP_CODE) === 200;
    
    if(!$ok) {
        //something gone wrong
    } else {
        if (strpos($result, 'yes')) {
            die($lang_common['No permission']); //got ya!
        }
    }
    
    curl_close ($curl);

} else {
    //You are doomed! I suggest contacting your hosting support for allowing_url_fopen or enabling curl :-)
}

//Edited

Well I guess it wouldn't be that hard to programe extension which would do that, but personally I don't really believe in this type of antispam. How big hit rate do they have? I tried it on few spambots and it was about 50%. Isn't better (and simpler) just use extension which would enhance registration with question (which could you type in administration) that would be site-related?

I.e for forum about Terminator I used question "Who in the future is leader of mankind and will destroy Skynet? Hint: it's Sarah Connor's son)" or you for national forum you could use part of nursery rhyme which everyone knows.

Hi. I highlighted string which is causing the problem smile (just delete it and it should work fine  wink )

Socuine wrote:

$forum_page['item_body']['info']['lastpost'] = '<li class="info-lastpost"><span class="label">'.$lang_index['Last post'].'</span><strong><a href="'.forum_link($forum_url['post'], $cur_forum['last_post_id']).'">'.limit_characters(forum_htmlencode($cur_forum['subject'])).'</a></strong> <cite>'.sprintf($lang_index['Last poster'], forum_htmlencode($cur_forum['last_poster'])).'</cite><strong>'.format_time($cur_forum['last_post']).'</strong></li>';</strong><cite>'.sprintf($lang_index['Last poster'], forum_htmlencode($cur_forum['last_poster'])).'</cite></li>';

224

(6 replies, posted in Discussions)

@TheLifelessOne Maybe you could try PunBB Migration Tool - you can find it in Downloads section

Not really clean solution but it should work...

Oxygen_cs.css, line 223 (aprox.) (or whichever template you are using)
Add

position: relative;

And in Admininistration > Settings > Setup add your link like this

0 = <div style="position: absolute; right: 15px; top: 7px;"><a href="http://google.com">Google</a></div>

(Guess you'll have to change those "right" and "top" vals, but I believe you can handle that tongue)