10


Do you know you can even ban or restrict selected IP addresses to visit your blog. As i have found this tip so always want to share these tips with my readers .The tip works in a way that you just have to paste this script in your template as directed, But please whenever you make changes to your template make a backup of your template for safety reasons. Follow the steps :

blogger

  1. Sign-In to your blogger account
  2. Then Layout –> Edit HTML –> Expand Widget.
  3. Add this script just below your <head> taq, it will be right on top of the code.
  4. <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>

    5. Save your template, and have a preview.

    You can verify your script is running or not just add your friend IP address to ban from visiting your blog, refresh blog and try to visit from the same IP address, an error message will be displayed. Further you can remove after verification.

    The banned_ip[] = ‘xx.xx’, you have to add the IP address here to block the desired IP. Example: If you want to block all IPs in the range ’66.45.XXX.XXX’, simply add "66.45" as the IP number in the above code.

Pin It


10 Comments

  1. Best Registry Cleaner says:

    Really nice and impressive blog i found today.

  2. China Mbt Shoes says:

    Thank for this great post, i like what you

    read.

  3. tiffany jewellery says:

    very good information you write it very clean. I’m very lucky to get this information from

    you.

  4. John says:

    this isn’t working i even tried it to use after parsing

  5. Fahad says:

    You might be doing some mistake, well the code is correct i have re-checked also

  6. Team Roster says:

    Best you should change the blog subject How to restrict particular IP address from visiting your blog ? | iTechGiz to something more better for your subject you write. I liked the the writing yet.

  7. Fahad says:

    Thanks .. suggest me if you have any ?

  8. Bonjour, the template is extremely lovely ; you have made a good choice.

  9. don says:

    im having problems with the code :(

    Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
    XML error message: The content of elements must consist of well-formed character data or markup.

  10. A very nice post and really very helpful.
    Thanks a lot.

Leave a Reply

CommentLuv badge