I was just messing around with a little PHP, and I thought of this way to block access to certain IP addresses from accessing your web page. I originally made it to make it so people who aren't me cannot view a certain page, but just changed it from if not to if and there you have it.
PHP Code:
<html>
<head>
<title>Banned IP</title>
</head>
<?php
If ($_SERVER['REMOTE_ADDR'] == "1.1.1.1"){ // Replace 1.1.1.1 with the IP you want to block access
echo 'Your IP is banned from accessing this webpage.<br /><br />';
}
?>
</html>