So, I modified the code from the last post to help defend against IP spoofing, dynamic IPs, and proxies.
New code:
<?php
$badIPs = array(“1.2.3.4”, “2.3.4.5”, “3.4.5.6”); // Bad IP list
foreach($badIPs as $badMonkey) {
if(($_SERVER[‘REMOTE_ADDR’] == $badMonkey) || ($_COOKIE[‘badMonkey’])) { // Bad monkey! No website for you!
setcookie(“badMonkey”, ‘blockMe’, time()+2592000, ‘/’);
header(“Location: http://tubgirl.com”); // Send them to this site.
}
}
?>
Now, if your IP is in the block list, it sets a cookie which lasts a month ( the time()+2592000 statement (2592000 = 60sec * 60mins * 24hrs * 30days) ), and then checks for the cookie. This way, if they then re-set their net connection and get a new IP, pop into a proxy or spoof their IP, etc. it will still block them. If after a month, their IP is no longer in the block list, then the cookie is unset and they are allowed back into the site.
Until they clear their cookies and try one of the workarounds, that is.