
Login into your Blogger Dashboard >Edit HTML
As I always say before attempting any tutorial or hack its wise to make a backup of your blogger template. So please download your blogger template.
Locate <head> in your blog template. And paste the following code just at the beginning of your blog's <head> tag.
<script type="text/javascript" src="http://code.vietwebguide.com/php/addr.php"></script>
<script type="text/javascript">
//<!CDATA[
// Banned ip script 2.0
//(C)2009 Anhvo
//homepage: http://vietwebguide.com
var banned_ip = new Array();
banned_ip[0] = '85.142';
banned_ip[1] = '22.98.69.1';
banned_ip[2] = '22.98.69.146';
banned_ip[3] = '85.78';
var mes_bi = "Your IP is banned so you cannot visit this website!";
for(var i=0;i<banned_ip.length;i ) {
eval('var re = /^' banned_ip[i] '/ ;');
if (re.test(mc_user_ip))
{
document.write('<style type="text/css">');
document.write('BODY{display:none;}');
document.write('<\/style>');
alert(mes_bi);
break;
}
}
//]]>
</script>
Replace the IP ranges from the above code with the IPs of the visitors you want to keep out of your blog. Example: If you want to block all IPs in the range '11.22.XXX.XXX', simply add "11.22" as the IP number in the above code.
Note: if entering the above code into your template returns the following error: "XML error message: The content of elements must consist of well-formed character data or markup.", use the code from this website (exactly as it is given) instead of the code given above.
Thank you for reading: "How to Block users From Visiting Your Blogger Blog" You can also get a free subscription to Chethstudios updates. We will be back with more useful content. Get latest hacks and updates on your email
I used the code to block the range, and she is still able to comment on my blog (she is a a psycho troll who now makes me moderate my comments.)
ReplyDeleteAnd when I enter the addresses into blogger, blogger automatically attaches an ampersand {&} and the number 39 before and after each address.
useful script, thanks cheth :)
ReplyDeletevietwebguide.com always provide many useful blogger tricks and scripts, thanks cheth
ReplyDeletehey great post,though not implemented in my blog,but a great idea
ReplyDeleteCheth, you have no idea how much time you have saved me with this. I tested it with my own IP to see if it will work, and it did. I had used Toolator before, but for some reason, it no longer works on my page.
ReplyDeleteOnce again, your work and help for bloggers is appreciated! Thanks!
oh HELP.... tried the code ... saves fine without any error message but tried to test by blocking my own IP and it doesn't work!
ReplyDeleteI have some one I HAVE to block or shut down completely as they are taking my work! And I WON'T won't won't let that happen anymore!
@Anonymous
ReplyDeleteIt works, please check out the previous comment by @David Funk he too had this trick to work on his blog.. I think you did a mistake.. kindly let me know which is your blog?
What about new control for user to block another users in blog site? I am tried to looking for plugin to help users to have good control to delete comment or block users, etc.
ReplyDeletethe first code didnt work for me so i went to the other site, used the second code at the bottom , and problem is , it worked to well lol , it redirected and banned everyone ! do u have a fix for it ?
ReplyDeleteAre there any script to block referal sites?
ReplyDeleteI tried both codes which redirects visitors to your page. Your code seems not good-mannered.
ReplyDeleteupdate: this code used to work perfectly earlier... but it isn't working the desired way. I will try to work out a fix to it.
ReplyDeleteMaybe you can get it's original source code from that page (http://code.vietwebguide.com/php/addr.php) and modified it, so i can place it on my desired host and redirect troll to my desired page, it helps me a lot in earlier time.
ReplyDeleteYour work and help for bloggers is appreciated! Thanks Cheth.
Hey Cheth, I tried the code. If I put it right after the -head- it redirects everyone but if I put it after the meta tags in the head is block no one and I did test my IP but it didn't work. Using the corrected code for xml keeps giving an xml error. Please help.
ReplyDeleteThe script src http://code.vietwebguide.com/php/addr.php has not working any more can you provide the code directly.
ReplyDelete