1. Creating the files
You can create these offline and upload them or create them in your online file manage.
block.php
Replace XXX.XXX.XXX with IP addresses you want to block
<?php
$deny = array(“XXX.XXX.XXX”, “XXX.XXX.XXX”);
if (in_array ($_SERVER[‘REMOTE_ADDR’], $deny)) {
header(“Window-target: _parent”);
header(“location: http://yourhosting.url/block.html”);
exit();
} ?>
block.html
<html>
<head>
<title>Access Denied</title>
<meta http-equiv=”window-target” content=”_top”>
<script language=”JavaScript”>
<!—
if(top != self) {
window.open(location.href, ‘_top’);
}
//—>
</script>
<script>if(top != self) top.location.href = location.href;</script>
</head>
<body onload=”doFramesBuster()”>
<center>
Your access denied message here
</center>
</body>
</html>
2. On Tumblr
Go to the customize page of the blog you want to use this on.
Theme > Use Custom HTML
Find the “<body>” tag and just after it paste the following code:
<iframe security=”none” src=”http://yourhosting.url/block.php” width=”0” height=”0”>
3. How it works
The block.php file runs in a hidden frame and checks its list of IP addresses, if you are visiting from a listed IP it redirects the frame to block.html. The block.html file then uses javascript to “frame bust”. This means it replaces the page you’re using with block.html.
4. Note
Its reasonably easy to circumvent if the person has a good know how of how these things work, uses a proxy or knows how to block “frame busting”.