My experience shows that a lot of con emails come from Senegal. If you maintain a forum or some kind of social network website, you might want to consider to block users from Senegal IPs. Here's a PHP code snippet with the current IP ranges assgined to Senegal ISPs, etc.
<?php
function getenv(name) {
ret = NULL;
if (isset($_SERVER) && array_key_exists(name, $_SERVER)) {
ret = $_SERVER[name];
}
else {
if (isset($_ENV) && array_key_exists(name, $_ENV)) {
ret = $_ENV[name];
}
}
return ret;
}
$IP_ADDR = trim(getenv('HTTP_X_FORWARDED_FOR'));
if (strlen($IP_ADDR) == 0) {
$IP_ADDR = trim(getenv('HTTP_CLIENT_IP'));
if (strlen($IP_ADDR == 0)) {
$IP_ADDR = trim(getenv('REMOTE_ADDR'));
}
}
$is_senegal_ip = FALSE;
if (strlen($IP_ADDR) > 0) {
$IP_ADDR1 = NULL;
$IP_ADDR2 = NULL;
$IP_ADDR3 = NULL;
$IP_ADDR4 = NULL;
$idx = strpos($IP_ADDR, ".");
if ($idx !== FALSE) {
$IP_ADDR1 = intval(substr($IP_ADDR, 0, $idx));
$previdx = $idx;
$idx = strpos($IP_ADDR, ".", $idx + 1);
if ($idx !== FALSE) {
$IP_ADDR2 = intval(substr($IP_ADDR, $previdx + 1, $idx - $previdx));
$previdx = $idx;
$idx = strpos($IP_ADDR, ".", $idx + 1);
if ($idx !== FALSE) {
$IP_ADDR3 = intval(substr($IP_ADDR, $previdx + 1, $idx - $previdx));
$IP_ADDR4 = intval(substr($IP_ADDR, $idx + 1));
}
}
}
if (
($IP_ADDR1 == 41 && $IP_ADDR2 == 208 && $IP_ADDR3 >= 128 && $IP_ADDR3 <= 191)
|| ($IP_ADDR1 == 41 && $IP_ADDR2 == 214 && $IP_ADDR3 <= 127)
|| ($IP_ADDR1 == 64 && $IP_ADDR2 == 15 && $IP_ADDR3 == 134 && $IP_ADDR4 >= 200 && $IP_ADDR4 <= 207)
|| ($IP_ADDR1 == 64 && $IP_ADDR2 == 182 && $IP_ADDR3 == 63 && $IP_ADDR4 >= 133 && $IP_ADDR4 <= 141)
|| ($IP_ADDR1 == 69 && $IP_ADDR2 == 13 && $IP_ADDR3 == 133 && $IP_ADDR4 >= 138 && $IP_ADDR4 <= 146)
|| ($IP_ADDR1 == 69 && $IP_ADDR2 == 13 && $IP_ADDR3 == 190 && $IP_ADDR4 >= 244 && $IP_ADDR4 <= 252)
|| ($IP_ADDR1 == 80 && $IP_ADDR2 == 84 && $IP_ADDR3 == 25 && $IP_ADDR4 >= 48 && $IP_ADDR4 <= 63)
|| ($IP_ADDR1 == 193 && $IP_ADDR2 == 219 && $IP_ADDR3 == 250 && $IP_ADDR4 >= 208 && $IP_ADDR4 <= 239)
|| ($IP_ADDR1 == 194 && $IP_ADDR2 == 117 && $IP_ADDR3 == 53 && $IP_ADDR4 <= 127)
|| ($IP_ADDR1 == 196 && $IP_ADDR2 == 1 && $IP_ADDR3 >= 92 && $IP_ADDR3 <= 100)
|| ($IP_ADDR1 == 196 && $IP_ADDR2 == 207 && $IP_ADDR3 >= 192)
|| ($IP_ADDR1 == 210 && $IP_ADDR2 == 7 && $IP_ADDR3 == 112 && $IP_ADDR4 >= 16 && $IP_ADDR4 <= 23)
|| ($IP_ADDR1 == 213 && $IP_ADDR2 == 154 && $IP_ADDR3 >= 64 && $IP_ADDR3 <= 95)
|| ($IP_ADDR1 == 213 && $IP_ADDR2 == 157 && (
$IP_ADDR3 <= 15
OR ($IP_ADDR3 >= 24 && $IP_ADDR3 <= 31)
OR $IP_ADDR3 >= 232
))
) {
$is_senegal_ip = TRUE;
}
}
?>
Comments
the block
thank you