3

How To Block Multiple IP Addresses using PHP

Few Days Before in a post i have discussed power of .htaccess and by using some methods you be able to block and stopping spammers,scrubbers and other online rubbish IPs with the use of .htaccess.But when .htaccess is not accessible,we may use some simple codes of PHP too to save our protect our work.

apache block ip range, apache deny ip, block ip, block ip in php, block multiple source ip addresses, htaccess allow ip range, php block ip address

This technique is moderately direct. Basically copy and paste the below code example into the top of any PHP page for which you wish to block access:

In the above code you can create .txt file and add those ips to which you want to block permanently access of your website or just simply create the array of those ips and place in above code.The function will deny access with a alert message, It all happens quickly, quietly, and without any fuss.
Thus, when using this code in your pages, simply replace the “dummy” IP addresses (i.e., “100.100.100”, “200.200.200”, …) with those that you wish to block (e.g., “123.456.789”, “123.456.*”, “123.*”, …).

3 Comments

  1. Greate article. Keep posting such kind of information on your blog.
    Im really impressed by your site.
    Hi there, You’ve performed a great job. I will definitely digg it and in my view suggest to my friends.
    I’m sure they’ll be benefited from this site.

Leave a Reply

Your email address will not be published. Required fields are marked *