diff --git a/admin/partials/blocked-ips-page.php b/admin/partials/blocked-ips-page.php index 867c8bb..2cc28c2 100644 --- a/admin/partials/blocked-ips-page.php +++ b/admin/partials/blocked-ips-page.php @@ -25,7 +25,8 @@ $duration = intval($_POST['duration'] ?? 24); if (filter_var($ip, FILTER_VALIDATE_IP)) { - $blocker->block($ip, $reason, $duration > 0 ? $duration : null); + // force: a human typed this address, so the safety guards do not apply. + $blocker->block($ip, $reason, $duration > 0 ? $duration : null, true); echo '
' . esc_html__('IP blocked successfully.', 'webdecoy') . '
' . esc_html__('Invalid IP address.', 'webdecoy') . '
| + + | +
+
+ + + ++ define(\'WEBDECOY_DISABLE\', true);' + ); + ?> + + |
+
|---|---|
| @@ -523,7 +547,7 @@ | diff --git a/admin/partials/statistics-page.php b/admin/partials/statistics-page.php index 32efd2c..bb062fe 100644 --- a/admin/partials/statistics-page.php +++ b/admin/partials/statistics-page.php @@ -98,10 +98,13 @@ "SELECT COUNT(*) FROM {$detections_table} WHERE created_at > %s", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- table name from $wpdb->prefix, not user input gmdate('Y-m-d 00:00:00') )); -// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- static query, no user input -$active_blocks = $wpdb->get_var( - "SELECT COUNT(*) FROM {$blocked_table} WHERE expires_at IS NULL OR expires_at > NOW()" // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- table name from $wpdb->prefix, not user input -); +// expires_at is stored in UTC, so it must be compared against a UTC value. MySQL's +// NOW() resolves in the database session time zone (SYSTEM by default, which +// WordPress never sets), so it disagrees with the column on any DB host not on UTC. +$active_blocks = $wpdb->get_var($wpdb->prepare( + "SELECT COUNT(*) FROM {$blocked_table} WHERE expires_at IS NULL OR expires_at > %s", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- table name from $wpdb->prefix, not user input + gmdate('Y-m-d H:i:s') +)); // WooCommerce stats (if active) $woo_stats = null; diff --git a/cdn-files/plugin-info.json b/cdn-files/plugin-info.json index ba2d62e..8354c48 100644 --- a/cdn-files/plugin-info.json +++ b/cdn-files/plugin-info.json @@ -1,13 +1,13 @@ { "name": "WebDecoy Bot Detection", "slug": "webdecoy", - "version": "2.3.1", + "version": "2.3.2", "author": "WebDecoy", "author_profile": "https://webdecoy.com", "requires": "6.1", "tested": "7.0", "requires_php": "7.4", - "download_url": "https://cdn.webdecoy.com/wordpress/webdecoy-2.3.1.zip", + "download_url": "https://cdn.webdecoy.com/wordpress/webdecoy-2.3.2.zip", "sections": { "description": " |