Topic: Submit User Data To Stopforumspam (in progress)

Hey anyone, could just use a bit of help with the adding of api key
This is what I've got till now:


Installing the stopforumspam API key field into config

[code=xml]
    <install>
        <![CDATA[
            if (defined('EXT_CUR_VERSION'))
            {
                // you can make special update code for each previous extension version
            }
            else
            { // it's a fresh install
                $forum_db->query('INSERT INTO '.$forum_db->prefix.'config VALUES (\'stopforumspam_apikey\', \'\')') or error(__FILE__, __LINE__);
            }
        ]]>
    </install>
[/code]

uninstalling of the stopforumspam API key
[code=xml]
    <uninstall>
        <![CDATA[
            $sql = array(
                'DELETE'        =>    'config',
                'WHERE'        =>    'conf_name IN (\'stopforumspam_apikey\')'
            );
            $forum_db->query_build($sql) or error(__FILE__, __LINE__);
        ]]>
    </uninstall>
[/code]

add a field to administration where APIkey can be entered - aop_features_general_fieldset_end
[code=xml]
        <hook id="aop_features_general_fieldset_end">
            <![CDATA[
                    if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'.php')){
                       include $ext_info['path'].'/lang/'.$forum_user['language'].'.php';
                    }else{
                       include $ext_info['path'].'/lang/English.php';
                    }
                    ?>
                        <div class="content-head">
                            <h2 class="hn"><span>Stopforumspam</span></h2>
                        </div>
                        <fieldset class="sf-set group-item<?php echo ++$forum_page['group_count'] ?>">
                            <legend><span>Stopforumspam:</span></legend>
                                <div class="sf-box text">
                                    <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_recaptcha['public_key'];?></span></label>
                                    <span class="fld-input"><input size="25" type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[stopforumspam_apikey]" value="<?php echo $forum_config['stopforumspam_apikey'];?>" /></span>
                                </div>
                        </fieldset>
                    <?php
            ]]>
        </hook>
[/code]

add to administration - aop_features_validation

[code=xml]
        <hook id="aop_features_validation">
            <![CDATA[
                if (!isset($form['stopforumspam_apikey']) || empty($form['stopforumspam_apikey']))
                    $form['stopforumspam_apikey'] = '';
            ]]>
        </hook>
[/code]

Add to admin section - aop_pre_update_configuration
[code=xml]
        <hook id="aop_pre_update_configuration">
            <![CDATA[
                if (isset($form['stopforumspam_apikey']))
                {
                    if ($form['stopforumspam_apikey'] != $forum_config['stopforumspam_apikey'])
                        $forum_db->query('UPDATE '.$forum_db->prefix.'config SET conf_value = \''.$forum_db->escape($form['stopforumspam_apikey']).'\' WHERE conf_name = \'stopforumspam_apikey\'', true) or error(__FILE__, __LINE__);
                }
            ]]>
        </hook>
[/code]



=================================


todo:

  • add button in User management between  Ban User & Delete user: Delete & Report To SFS

  • add option in profile.php

so in admin/user.php lines 343-358
[code=php]
    // Setup control buttons
    $forum_page['mod_options'] = array();

    if ($forum_page['num_users'] > 0)
    {
        if ($forum_user['g_id'] == FORUM_ADMIN || ($forum_user['g_moderator'] == '1' && $forum_user['g_mod_ban_users'] == '1'))
            $forum_page['mod_options']['ban'] = '<span class="submit'.((empty($forum_page['mod_options'])) ? ' first-item' : '').'"><input type="submit" name="ban_users" value="'.$lang_admin_users['Ban'].'" /></span>';

        if ($forum_user['g_id'] == FORUM_ADMIN)
        {
            $forum_page['mod_options']['delete'] = '<span class="submit'.((empty($forum_page['mod_options'])) ? ' first-item' : '').'"><input type="submit" name="delete_users" value="'.$lang_admin_common['Delete'].'" /></span>';
            $forum_page['mod_options']['change_group'] = '<span class="submit'.((empty($forum_page['mod_options'])) ? ' first-item' : '').'"><input type="submit" name="change_group" value="'.$lang_admin_users['Change group'].'" /></span>';
        }
    }

    ($hook = get_hook('aus_show_users_pre_moderation_buttons')) ? eval($hook) : null;
[/code]

profile.php lines 2512-2523
[code=php]

        // Setup ban and delete options
        $forum_page['user_management'] = array();

        if ($forum_user['g_moderator'] == '1')
            $forum_page['user_management']['ban'] = '<div class="ct-set set'.++$forum_page['item_count'].'">'."\n\t\t\t\t".'<div class="ct-box">'."\n\t\t\t\t\t".'<h3 class="ct-legend hn">'.$lang_profile['Ban user'].'</h3>'."\n\t\t\t\t".'<p><a href="'.forum_link($forum_url['admin_bans']).'?add_ban='.$id.'">'.$lang_profile['Ban user info'].'</a></p>'."\n\t\t\t\t".'</div>'."\n\t\t\t".'</div>';
        else if ($forum_user['g_moderator'] != '1' && $user['g_id'] != FORUM_ADMIN )
        {
            $forum_page['user_management']['ban'] = '<div class="ct-set set'.++$forum_page['item_count'].'">'."\n\t\t\t\t".'<div class="ct-box">'."\n\t\t\t\t\t".'<h3 class="ct-legend hn">'.$lang_profile['Ban user'].'</h3>'."\n\t\t\t\t".'<p><a href="'.forum_link($forum_url['admin_bans']).'?add_ban='.$id.'">'.$lang_profile['Ban user info'].'</a></p>'."\n\t\t\t\t".'</div>'."\n\t\t\t".'</div>';
            $forum_page['user_management']['delete'] = '<div class="ct-set set'.++$forum_page['item_count'].'">'."\n\t\t\t\t".'<div class="ct-box">'."\n\t\t\t\t\t".'<h3 class="ct-legend hn">'.$lang_profile['Delete user'].'</h3>'."\n\t\t\t\t".'<p><a href="'.forum_link($forum_url['delete_user'], $id).'">'.$lang_profile['Delete user info'].'</a></p>'."\n\t\t\t\t".'</div>'."\n\t\t\t".'</div>';
        }

        ($hook = get_hook('pf_change_details_admin_pre_header_load')) ? eval($hook) : null;
[/code]

Re: Submit User Data To Stopforumspam (in progress)

made some more progress; but stuck with how to submit from profile
what I've added



// users.php   line added ~353

[code=php]
            $forum_page['mod_options']['sfs'] = '<span class="submit'.((empty($forum_page['mod_options'])) ? ' first-item' : '').'"><input type="submit" name="submit_sfs" value="'.$lang_sfssubmit['SFS Admin'].'" /></span>';
[/code]


// profile.php  line added ~2512

[code=php]
            $forum_page['user_management']['sfs'] = '<div class="ct-set set'.++$forum_page['item_count'].'">'."\n\t\t\t\t".'<div class="ct-box">'."\n\t\t\t\t\t".'<h3 class="ct-legend hn">'.$lang_sfssubmit['SFS'].'</h3>'."\n\t\t\t\t".'<p><a href="'.forum_link($forum_url['submit_sfs'], $id).'">'.$lang_sfssubmit['Submit user to SFS'].'</a></p>'."\n\t\t\t\t".'</div>'."\n\t\t\t".'</div>';
[/code]
   


//language file of extension - lang/sfssubmit.php

[code=php]
<?php

if (!defined('FORUM')) die();

$lang_sfssubmit = array(
'SFS'       =>  'Submit to SFS',
'Submit user to SFS'        =>  'Submit this user to Stopforumspam.com',   
'SFS Admin'       =>  'Add to SFS',
);
?>
[/code]


todo:

  • need to add   sfssubmit action to profile.php  like on line 843
    else if (isset($_POST['ban']))    etc

  • also need to add those two first lines above via correct way in the extension

Re: Submit User Data To Stopforumspam (in progress)

Hi guys, I wanted to ask what's the state of this extension - did it progress? I'm getting somewhat tired of copying&pasting spammer data manually over to the stopforumspam db, so something like this would be quite handy.

Thanks

Re: Submit User Data To Stopforumspam (in progress)

Just for the record, I've added the following code to my profile.php:

[code=php]if (isset($_POST['delete_user_comply']))
    {
        ($hook = get_hook('pf_delete_user_form_submitted')) ? eval($hook) : null;
       
//added this ----->
        function PostToHost($host, $path, $data_to_send) {
            $fp = fsockopen($host,80);
            fputs($fp, "POST $path HTTP/1.1\n" );
            fputs($fp, "Host: $host\n" );
            fputs($fp, "Content-type: application/x-www-form-urlencoded\n" );
            fputs($fp, "Content-length: ".strlen($data_to_send)."\n" );
            fputs($fp, "Connection: close\n\n" );
            fputs($fp, $data_to_send);
            fclose($fp);
        }

        PostToHost("www.stopforumspam.com", "/post.php", "username=" . $user['username'] . "&ip_addr=" . $user['registration_ip'] . "&email=" . $user['email'] . "&api_key=XXXXXXXXXXXXX");       
//<--------

        delete_user($id, isset($_POST['delete_posts']));

        ($hook = get_hook('pf_delete_user_pre_redirect')) ? eval($hook) : null;

        redirect(forum_link($forum_url['index']), $lang_profile['User delete redirect']);
    }[/code]

Seems to work nicely, submitting user to stopforumspam.com when I decide to delete a user completely (spamming is the sole reason when I delete them). API key is hardcoded in, so for this to become universally usable it would need to go somewhere into a configuration, and there should be an explicit checkbox to mark the user for submitting to stopforumspam. Should be somehow merged with KeyDog's code, but I can't do it - not enough PHP&PunBB exps sad

Re: Submit User Data To Stopforumspam (in progress)

Sorry for getting back so late....
It didn't progress so I'm glad you had a go at a solution for submitting to sfs directly!


PS:
A user registers, I check the profile and see a spam signature
--> I think it would be good to have a link below Current signature labeled Submit to SFS
that would then submit and delete the user...

http://keydogbb.info/img/spam.png

Re: Submit User Data To Stopforumspam (in progress)

BTW: Would be cool if this method worked from the

http://..../admin/users.php?action=find_user

page. There dozens of users could be deleted at once.
Handy for spam traps...

Saves a lot of time already though, so thanks a lot.

Re: Submit User Data To Stopforumspam (in progress)

Still looking for an extension developer to perfection an extension for this
useful features would be:

1. allow moderators to submit users to stopforumspam.com   and ban in one step
2. the API key entry possibility in admin section instead of coding...
3. allow admins to submit users to stopforumspam.com when deleting a user...