Saturday 20 October 2012

How To Block An IP Address On Blogger

Important: All scripts hosted on widcraft.googlecode.com don't work anymore because Google has blocked that SVN repository.

It's too hard to deal with spammers and copy cats but if some how you find their IP address then this article may help you. It's php based tutorial then we first need a php file hosting.

  • Copy/paste the PHP code below in a notepad
  • Replace IP Address 1, IP Address 2, and IP Address 3 with the actual IP addresses you want blocked
  • Save the file as a .php file (ex. ipblocker.php)

<?php
/*
Blogspot IP address blocker.
*/
$iplist = array(“IP Address 1″,”IP Address 2″,”IP Address 3″); // the list of banned IPs
$ip = getenv(“REMOTE_ADDR”); // get the visitors IP address
// echo “$ip”;
$found = false;
foreach ($iplist as $value) { // scan the list
if (strpos($ip, $value) === 0){
$found = true;
}
}
if ($found == true) {
echo “top.location = “error.html”;n”; // page to divert to
}
 ?>

Upload your newly created PHP file on any PHP supported web hosting service like 000webhost.com and zymic.com

Now paste following script in your blog's template just above </head> :

<script language=’javascript’ src='URL of your php File' type='text/javascript'></script>
Save your template and it's done.... :)
Important: Check our new website TricksPanda.com for WordPress tutorials, plugins and more.
 
Powered by Blogger.