10ipBlok

The simplest protection of the site from spam when the IP address is known

Once I looked at the statistics of AWstats, I noticed suspicious activity, and in general there was an opinion that it was a bot, it scans my page, well, I thought nothing and here is a screenshot as you can see there are 10 types of addresses in which tens of thousands of views

10ipBlok
10ipBlok

There is an idle way to protect against these malwares.

for this purpose it is enough to add a couple of lines of code in the wile index.php, which will detect the malicious ip and block its operation (for example, display an error), the rest of the site will continue to be displayed in the correct form

And so consider the code:

<? echo $a=$_SERVER["REMOTE_ADDR"]; ?>
  
<?php
if ($a == '151.106.25.134' or
    $a == '5.188.210.23' or
    $a == '5.188.210.20' or
    $a == '5.188.210.21' or
    $a == '5.188.210.24' or
    $a == '77.111.244.57') {
    echo "a == b";
} 
else {
    define('WP_USE_THEMES', true);
    require( dirname( __FILE__ ) . '/wp-blog-header.php' );
}
?>


Assigns a variable to $ a.
= $ _ SERVER [«REMOTE_ADDR»];
The value of the IP address that is connected
<?   $a=$_SERVER["REMOTE_ADDR"]; ?>  

Next, enter the address range and set the logical formula or such an un address or such
<? php
if ($ a == ‘151.106.25.134’ or
     $ a == ‘5.188.210.23’ or
     $ a == ‘5.188.210.20’ or
     $ a == ‘5.188.210.21’ or
     $ a == ‘5.188.210.24’ or
     $ a == ’77 .111.244.57 ‘)

if the un address is listed, the program will display echo "a == b";


If everything is good, then continue to connect the site algorithm
}
else {
     define (‘WP_USE_THEMES’, true);
     require (dirname (__FILE__). ‘/wp-blog-header.php’);
}
?>

<?php
if ($a == '151.106.25.134' or
    $a == '5.188.210.23' or
    $a == '5.188.210.20' or
    $a == '5.188.210.21' or
    $a == '5.188.210.24' or
    $a == '77.111.244.57') {
    echo "a == b";
} 
else {
    define('WP_USE_THEMES', true);
    require( dirname( __FILE__ ) . '/wp-blog-header.php' );
}
?>