I've been using the JavaScript found here: http://www.javascriptkit.com/script/scri... and it works for individual IP addresses, but have not figured out how to write the formula for a range of IP numbers. I would like to block the range 166.128.0.0 - 166.255.255.255.
Note: My web host is Yahoo! and they do not give their users access to the .htaccess file, that's why I'm using JavaScript code on the page instead.
How do I block IP address ranges from viewing my personal website?
<html>
<head>
<script>
// block a range or ranges of ip addresses
// use SSI to parse ip address into page, assigning
// resulting value to global JavaScript variable
var ipAddress = '<!--#echo var="REMOTE_ADDR"-->';
ipAddress = formatQuadTripleIp(ipAddress);
ipAddress = parseFloat(ipAddress);
// give a list of range bounds for ip addresses:
// each item is a pair of ip addresses as
// [lower bound, upper bound]
// each bound pair should be a comma-separated
// pair of ip addresses enclosed in
// square brackets and separated from
// the following pair by a comma
// each ip bound value should be a complete
// quad-triplet as "###nnn###nnn".
var ipBoundPairs = [
['001002003004', '001002003999'],
['011002003004', '011002003999'],