Sometimes you need to disallow a visitor to access your website. The most common reason for this is Spammers. Although there are several other solutions to block multiple IP addresses, but in this post we are going to focus on simple php script.
<?php /* Online PHP Examples with Source Code website: http://4evertutorials.blogspot.in/ */ $blacklisted_ips = array("304.456.789.66", "626.789.123.85", "578.123.45.46"); if(in_array($_SERVER['REMOTE_ADDR'], $blacklisted_ips)) { header("Location: http://www.examples.com/block.php"); exit(); } ?>
0 comments:
Post a Comment