How to Block IP Addresses with PHP

Change google.com with the website you want the end user to be redirected to if they are on the deny IP list.

<?php
$deny = array("111.111.111", "222.222.222", "333.333.333");
if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) {
   header("location: http://www.google.com/");
   exit();
} ?>