Created
April 24, 2020 16:59
-
-
Save twfahey1/4d9414b3ef3291f97e726cc39b9329e2 to your computer and use it in GitHub Desktop.
Block IP addresses in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$deny = array("111.111.111", "222.222.222", "333.333.333"); | |
if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) { | |
header("location: https://example.com/"); | |
exit(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment