Collect several common program processing methods for shielding ip Lists. Blocking some IP addresses can make your website better and more stable, next, we will not analyze the program processing methods for the following shielding and collecting several common blocked ip address lists. Blocking some IP addresses can make your website better and more stable, we will not analyze the blocking below.
Script ec (2); script
Below I have collected several commonList of blocked ip addressesTo make your website better and more stable, we will not analyze the following blocking method.
$ Ip_str = "127.0.0.1, 192.1.1. *, 202. *, 127. *, 123. *, 142 .*,*";
$ Ip = "127.0.0.254 ";
Function StopIp ($ ip, $ ip_str)
{
If (strcmp (long2ip (sprintf ('% U', ip2long ($ ip), $ ip) return false; // if the ip address is not in the ip Format, false is returned.
$ Ip = explode (".", $ ip );
If (eregi ("(, *, | ,*. |, *) | (". $ ip [0]. ". (". $ ip [1]. "| *).? (". $ Ip [2]." | *)?.? (". $ Ip [3]." | *)?) ",", ". $ Ip_str.", ") return true;
}
If (StopIp ($ ip, $ ip_str) echo 1;
Function StopIp ($ ip, $ ip_str)
{
If (strcmp (long2ip (sprintf ('% U', ip2long ($ ip), $ ip) return false; // if the ip address is not in the ip Format, false is returned.
$ Ip = explode (".", $ ip );
If (eregi ("(, *, | ,*. |, *) | ,(". $ ip [0]. ". (". $ ip [1]. "| *).? (". $ Ip [2]." | *)?.? (". $ Ip [3]." | *),?) ",", ". $ Ip_str.", ") return true;
}
Function StopIp ($ ip, $ str)
{
If (stristr (",". $ str. ",", $ ip) return true; // it is not allowed if it is within the specified range.
If (stristr (",". $ str. ", *,") | stristr (",". $ str. ", *") return true; // if it appears for the first time ,*. or, * indicates that all sites are not allowed
$ Iplist = explode (",", $ str );
$ Ip = explode (".", $ ip );
For ($ I = 0; $ I {
If (eregi ($ ip [0]. ".. (". $ ip [1]. "| *).? (". $ Ip [2]." | *)?.? (". $ Ip [3]." | *)? ", $ Iplist [$ I]) return true;
}
}
// Test
$ Ip_str = "127.0.0.1, 192.1.1. *, 202. *, 127. *, 123. * "; // The list of blocked ip addresses is separated by", ". If you want to shield all ip addresses, use * to shield 127. the ip address format starting with 127. *
$ Ip = "137.0.0.2"; // Ip address to be verified
If (StopIp ($ ip, $ ip_str) echo 1;
For ($ I = 1; $ I <= 255; $ I ++)
{
For ($ k = 1; $ k <= 255; $ K ++)
{
For ($ a = 1; $ a <= 255; $ a ++)
{
$ Str. = "192. {$ I}. {$ k}. {$ }";
}
}
}
In this way, we can produce 255*255*255 large Ip address data volumes.