No, this has nothing to do with that amazing cinematic masterpiece by Cash Money, but instead about blocking website access.
A friend of mine just ICQ’d me, asking if there was an easy way to redirect unwanted IPs from reading her blog to a bit more of a visually caustic website (like the now-defunct goatse.cx).
I replied with this:
<?php
$badIPs = array(“1.2.3.4”, “2.3.4.5”, “3.4.5.6”); // List of bad IP addresses.
foreach($badIPs as $badMonkey) {
if($_SERVER[‘REMOTE_ADDR’] == $badMonkey) { // Bad monkey! No website for you!
header(“Location: http://tubgirl.com”); // Redirect them to this site.
}
}
?>
It’s pretty simple, you just have to make sure that you do the following:
0) Server/site/blog/page/etc. that runs PHP.
1) Pick out a suitable offensive site (Like TubGirl, for example).
2) Open the file that has the <html> and <head> tags. (assuming it’s a .php, .inc, .tpl, etc file)
3) Paste the code before the <html> tag.
4) Replace sample IPs with real ones and replace the site where you want to send them to.
That’s it! You can have an unlimited number of IPs to block. Since this isn’t JavaScript and takes place at the server level, it’s can’t really be circumvented by disabling JavaScript on the browser. The only real way around this is to hop on another IP address/connection, spoof the one you’re on, go through a proxy, use coral cache, or other similar methods. Really when it comes down to it, if someone _really_ wants to read those public entries, they can. This’ll just piss ’em off. ;)
Now, who actually clicked on the Tubgirl link? Let’s see a show of hands.