function zerospam_log_spam($key, $url = false)
{
    global $wpdb;
    $settings = zerospam_settings();
    $ip = zerospam_get_ip();
    $url = $url ? $url : zerospam_get_url();
    $table_name = $wpdb->prefix . 'zerospam_log';
    switch ($key) {
        case 'registration':
            $key = 1;
            break;
        case 'comment':
            $key = 2;
            break;
        case 'cf7':
            $key = 3;
            break;
        case 'gf':
            $key = 4;
            break;
        case 'buddypress-registration':
            $key = 5;
            break;
    }
    $wpdb->insert($table_name, array('type' => $key, 'ip' => $ip, 'page' => $url), array('%s', '%s', '%s'));
    if (!empty($settings['auto_block']) && $settings['auto_block']) {
        zerospam_block_ip(array('ip' => $ip, 'type' => 'permanent', 'reason' => __('Auto block triggered on ', 'zerospam') . date('r') . '.'));
    }
}
Beispiel #2
0
 /**
  * Checks if the current IP is blocked.
  *
  * @since 2.0.0
  */
 public function ip_check()
 {
     if (!is_user_logged_in() && zerospam_is_blocked(zerospam_get_ip())) {
         do_action('zero_spam_ip_blocked');
         die(__($this->settings['blocked_ip_msg'], 'zerospam'));
     }
 }