function kpg_ss_check_white_block()
{
    sfs_errorsonoff();
    $options = kpg_ss_get_options();
    $stats = kpg_ss_get_stats();
    $post = get_post_variables();
    $post['block'] = true;
    $ansa = be_load('kpg_ss_check_white', kpg_get_ip(), $stats, $options, $post);
    sfs_errorsonoff('off');
    return $ansa;
}
示例#2
0
</textarea><br>

<div style="width:50%;float:left;">
<p class="submit"><input name="testopt" class="button-primary" value="Test Options" type="submit" /></p>
</div>
<div style="width:50%;float:right;">
<p class="submit"><input name="testcountry" class="button-primary" value="Test Countries" type="submit" /></p>
</div>
<br style="clear:both;">
<?php 
$nonce = '';
if (array_key_exists('kpg_stop_spammers_control', $_POST)) {
    $nonce = $_POST['kpg_stop_spammers_control'];
}
if (!empty($nonce) && wp_verify_nonce($nonce, 'kpgstopspam_update')) {
    $post = get_post_variables();
    if (array_key_exists('testopt', $_POST)) {
        // do the test
        $optionlist = array('chkaws', 'chkcloudflare', 'chkgcache', 'chkgenallowlist', 'chkgoogle', 'chkmiscallowlist', 'chkpaypal', 'chkscripts', 'chkvalidip', 'chkwlem', 'chkwluserid', 'chkwlist', 'chkyahoomerchant');
        $m1 = memory_get_usage(true);
        $m2 = memory_get_peak_usage(true);
        echo "<br>Memory used, peak: {$m1}, {$m2}<br>";
        echo "<ul>Allow Checks<br>";
        foreach ($optionlist as $chk) {
            $ansa = be_load($chk, $ip, $stats, $options, $post);
            if (empty($ansa)) {
                $ansa = 'OK';
            }
            echo "{$chk} : {$ansa}<br>";
        }
        echo "</ul>";
function kpg_ss_user_reg_filter($user_login)
{
    // the plugin should be all initialized
    // check the ip, etc.
    sfs_errorsonoff();
    $options = kpg_ss_get_options();
    $stats = kpg_ss_get_stats();
    // fake out the post variables
    $post = get_post_variables();
    $post['author'] = $user_login;
    $post['addon'] = 'chkRegister';
    // no really an addon - but may be moved out when working.
    if ($options['filterregistrations'] != 'Y') {
        remove_filter('pre_user_login', kpg_ss_user_reg_filter, 1);
        sfs_errorsonoff('off');
        return $user_login;
    }
    // if the suspect is already in the bad cache he does not get a second chance?
    // prevents looping
    $reason = be_load('chkbcache', kpg_get_ip(), $stats, $options, $post);
    sfs_errorsonoff();
    if ($reason !== false) {
        $rejectmessage = $options['rejectmessage'];
        $post['reason'] = 'Failed Registration: bad cache';
        $host['chk'] = 'chkbcache';
        $ansa = be_load('kpg_ss_log_bad', kpg_get_ip(), $stats, $options, $post);
        wp_die("{$rejectmessage}", "Login Access Denied", array('response' => 403));
        exit;
    }
    // check the white list
    $reason = kpg_ss_check_white();
    sfs_errorsonoff();
    if ($reason !== false) {
        $post['reason'] = 'passed registration:' . $reason;
        $ansa = be_load('kpg_ss_log_good', kpg_get_ip(), $stats, $options, $post);
        sfs_errorsonoff('off');
        return $user_login;
    }
    // check the black list
    //sfs_debug_msg("Checking black list on registration: /r/n".print_r($post,true));
    $ret = be_load('kpg_ss_check_post', kpg_get_ip(), $stats, $options, $post);
    $post['reason'] = 'Passed Registration ' . $ret;
    $ansa = be_load('kpg_ss_log_good', kpg_get_ip(), $stats, $options, $post);
    return $user_login;
}