How can you block certain IP Addresses from accessing your site?

<?php
$banned = array("24.91.102.173", "64.21.162.113");
if (in_array($_SERVER['REMOTE_ADDR'], $banned)) {
echo "You have been banned.";
exit;
}

?>

 

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.